Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(config-sync): support LAN HTTP WebDAV endpoints

vastsa7c8b37f796a4
diff --git a/apps/desktop/src/components/settings/ConfigSyncPage.tsx b/apps/desktop/src/components/settings/ConfigSyncPage.tsx
index 5973349b8..188a21704 100644
--- a/apps/desktop/src/components/settings/ConfigSyncPage.tsx
+++ b/apps/desktop/src/components/settings/ConfigSyncPage.tsx
@@ -85,11 +85,13 @@ export function ConfigSyncPage() {
});
const [selection, setSelection] =
useState<ConfigSyncCategorySelection>(DEFAULT_SELECTION);
+ const [allowInsecureHttp, setAllowInsecureHttp] = useState(false);
const refresh = useCallback(async () => {
try {
const next = await api.configSyncGetState();
setState(next);
+ setAllowInsecureHttp(next.allowInsecureHttp === true);
if (next.configured) {
setForm((current) => ({
...current,
@@ -130,7 +132,10 @@ export function ConfigSyncPage() {
useEffect(() => {
void refresh();
- return api.onConfigSyncChanged((next) => setState(next));
+ return api.onConfigSyncChanged((next) => {
+ setState(next);
+ setAllowInsecureHttp(next.allowInsecureHttp === true);
+ });
}, [refresh]);
const updateForm = (key: keyof typeof form, value: string) =>
@@ -150,7 +155,7 @@ export function ConfigSyncPage() {
appPassword: form.appPassword || undefined,
directory: form.directory,
deviceLabel: form.deviceLabel || t("settings.configSync.defaultDevice"),
- allowInsecureHttp: false,
+ allowInsecureHttp,
categories: selection,
includeSecrets: selection.credentials,
includeMemory: selection.memory,
@@ -169,6 +174,7 @@ export function ConfigSyncPage() {
directory: form.directory,
deviceLabel: form.deviceLabel || t("settings.configSync.defaultDevice"),
backupPassword: form.backupPassword,
+ allowInsecureHttp,
categories: selection,
includeSecrets: selection.credentials,
includeMemory: selection.memory,
@@ -185,6 +191,7 @@ export function ConfigSyncPage() {
} else {
setState(await api.configSyncDisconnect());
setHistory([]);
+ setAllowInsecureHttp(false);
setForm((current) => ({ ...current, appPassword: "", backupPassword: "" }));
setSelection(DEFAULT_SELECTION);
}
@@ -342,6 +349,7 @@ export function ConfigSyncPage() {
const configured = state?.configured === true;
const locked = state?.locked === true;
const categories = selection;
+ const isHttpEndpoint = /^http:\/\//i.test(form.endpoint.trim());
return (
<div className="settings-stack settings-config-sync">
@@ -353,13 +361,39 @@ export function ConfigSyncPage() {
<Field label={t("settings.configSync.endpoint")}>
<Input
value={form.endpoint}
- onChange={(event) => updateForm("endpoint", event.target.value)}
+ onChange={(event) => {
+ const value = event.target.value;
+ updateForm("endpoint", value);
+ if (!/^http:\/\//i.test(value.trim())) {
+ setAllowInsecureHttp(false);
+ }
+ }}
placeholder={t("settings.configSync.endpointPlaceholder")}
aria-label={t("settings.configSync.endpoint")}
autoComplete="url"
disabled={busy !== null}
/>
</Field>
+ {isHttpEndpoint ? (
+ <div className="settings-config-sync-http-option">
+ <label className="settings-config-sync-category">
+ <input
+ type="checkbox"
+ checked={allowInsecureHttp}
+ onChange={(event) => setAllowInsecureHttp(event.target.checked)}
+ aria-describedby="config-sync-http-warning"
+ />
+ <span>{t("settings.configSync.allowInsecureHttp")}</span>
+ </label>
+ <div
+ id="config-sync-http-warning"
+ className="settings-config-sync-warning"
+ role={allowInsecureHttp ? "alert" : undefined}
+ >
+ {t("settings.configSync.allowInsecureHttpWarning")}
+ </div>
+ </div>
+ ) : null}
<Field label={t("settings.configSync.username")}>
<Input
value={form.username}
diff --git a/apps/desktop/src/styles/settings.css b/apps/desktop/src/styles/settings.css
index 2298b8bf7..a5c94407b 100644
--- a/apps/desktop/src/styles/settings.css
+++ b/apps/desktop/src/styles/settings.css
@@ -469,6 +469,20 @@
width: 100%;
}
+.settings-config-sync-http-option {
+ display: grid;
+ grid-column: 1 / -1;
+ gap: 8px;
+ padding: 10px 12px;
+ border: 1px solid color-mix(in srgb, var(--ds-warning) 32%, transparent);
+ border-radius: var(--radius-md);
+ background: color-mix(in srgb, var(--ds-warning) 7%, transparent);
+}
+
+.settings-config-sync-http-option .settings-config-sync-warning {
+ margin: 0;
+}
+
.settings-config-sync-actions {
display: flex;
align-items: center;
diff --git a/apps/desktop/test/config-sync-settings.test.mjs b/apps/desktop/test/config-sync-settings.test.mjs
index a00aa8864..60050e509 100644
--- a/apps/desktop/test/config-sync-settings.test.mjs
+++ b/apps/desktop/test/config-sync-settings.test.mjs
@@ -21,6 +21,8 @@ test("cloud sync is a searchable settings destination", () => {
test("cloud sync keeps credentials and vault operations on the host boundary", () => {
assert.match(syncPage, /api\.configSyncConfigure\(/);
assert.match(syncPage, /setState\(await api\.configSyncSyncNow\(\)\)/);
+ assert.match(syncPage, /allowInsecureHttp/);
+ assert.match(syncPage, /settings\.configSync\.allowInsecureHttpWarning/);
assert.match(syncPage, /api\.configSyncUnlock\(/);
assert.match(syncPage, /api\.configSyncMapProject\(/);
assert.match(syncPage, /api\.configSyncListHistory\(/);
diff --git a/crates/host-core/src/config_sync/engine.rs b/crates/host-core/src/config_sync/engine.rs
index def6f6d82..9525ee4a4 100644
--- a/crates/host-core/src/config_sync/engine.rs
+++ b/crates/host-core/src/config_sync/engine.rs
@@ -69,6 +69,9 @@ pub struct StoredConfig {
pub directory: String,
pub device_label: String,
pub allow_insecure_http: bool,
+ /// Endpoint-specific compatibility for servers that report missing GETs as 502.
+ #[serde(default)]
+ pub missing_object_status: Option<u16>,
pub categories: BTreeMap<String, bool>,
pub include_secrets: bool,
pub include_memory: bool,
@@ -207,6 +210,7 @@ struct PublicState {
directory: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
device_label: Option<String>,
+ allow_insecure_http: bool,
categories: BTreeMap<String, bool>,
include_secrets: bool,
include_memory: bool,
@@ -348,6 +352,7 @@ fn transport_with_password(config: &StoredConfig, password: String) -> Result<We
password,
directory: config.directory.clone(),
allow_insecure_http: config.allow_insecure_http,
+ missing_object_status: config.missing_object_status,
})
}
@@ -621,6 +626,7 @@ pub fn public_state(st: &mut AppState) -> Result<Value> {
username: None,
directory: None,
device_label: None,
+ allow_insecure_http: false,
categories: default_categories(),
include_secrets: false,
include_memory: false,
@@ -714,6 +720,7 @@ pub fn public_state(st: &mut AppState) -> Result<Value> {
username: Some(config_ref.username.clone()),
directory: Some(config_ref.directory.clone()),
device_label: Some(config_ref.device_label.clone()),
+ allow_insecure_http: config_ref.allow_insecure_http,
categories: config_ref.categories.clone(),
include_secrets: config_ref.include_secrets,
include_memory: config_ref.include_memory,
@@ -810,6 +817,7 @@ fn config_from_input(
.and_then(Value::as_bool)
.or_else(|| existing.map(|value| value.allow_insecure_http))
.unwrap_or(false),
+ missing_object_status: existing.and_then(|value| value.missing_object_status),
categories,
include_secrets,
include_memory,
@@ -1118,6 +1126,8 @@ mod tests {
let device_b_dir = tempfile::tempdir()?;
let device_a = configure_test_device(device_a_dir.path(), &fixture.endpoint).await?;
let device_b = configure_test_device(device_b_dir.path(), &fixture.endpoint).await?;
+ let device_a_state = get_state(device_a.clone()).await?;
+ assert_eq!(device_a_state.get("allowInsecureHttp"), Some(&json!(true)));
let project_a = device_a_dir.path().join("project");
let project_b = device_b_dir.path().join("project");
std::fs::create_dir_all(&project_a)?;
diff --git a/crates/host-core/src/config_sync/handlers.rs b/crates/host-core/src/config_sync/handlers.rs
index c35077f9d..781124cc3 100644
--- a/crates/host-core/src/config_sync/handlers.rs
+++ b/crates/host-core/src/config_sync/handlers.rs
@@ -75,6 +75,7 @@ pub(crate) async fn test(state: Arc<Mutex<AppState>>, params: Value) -> Result<V
directory: directory.trim().into(),
device_label: "test".into(),
allow_insecure_http: allow_insecure,
+ missing_object_status: None,
categories: default_categories(),
include_secrets: false,
include_memory: false,
@@ -163,6 +164,8 @@ pub(crate) async fn configure(state: Arc<Mutex<AppState>>, params: Value) -> Res
if !probe.conditional_writes {
bail!("CONFIG_SYNC_UNSUPPORTED: WebDAV server did not prove reliable conditional writes");
}
+ let transport = transport.with_probe_result(&probe);
+ config.missing_object_status = probe.missing_object_status;
transport.ensure_collection("vault").await?;
let remote_header = transport.get("header").await?;
if let Some((bytes, _)) = remote_header {
diff --git a/crates/host-core/src/config_sync/transport.rs b/crates/host-core/src/config_sync/transport.rs
index e0b7693d9..48a7a5fe0 100644
--- a/crates/host-core/src/config_sync/transport.rs
+++ b/crates/host-core/src/config_sync/transport.rs
@@ -1,6 +1,7 @@
use anyhow::{bail, Context, Result};
use reqwest::header::{HeaderMap, HeaderValue, ETAG, IF_MATCH, IF_NONE_MATCH, LOCATION};
use reqwest::{Client, Method, StatusCode, Url};
+use std::net::IpAddr;
use uuid::Uuid;
const MAX_REMOTE_OBJECT_BYTES: usize = 64 * 1024 * 1024;
@@ -12,11 +13,13 @@ pub struct WebDavConfig {
pub password: String,
pub directory: String,
pub allow_insecure_http: bool,
+ pub missing_object_status: Option<u16>,
}
#[derive(Debug, Clone)]
pub struct ProbeResult {
pub conditional_writes: bool,
+ pub missing_object_status: Option<u16>,
}
#[derive(Debug, Clone)]
@@ -26,6 +29,7 @@ pub struct WebDavTransport {
username: String,
password: String,
directory: String,
+ missing_object_status: Option<StatusCode>,
}
fn validate_relative_directory(value: &str) -> Result<String> {
@@ -50,6 +54,36 @@ fn validate_relative_directory(value: &str) -> Result<String> {
Ok(parts.join("/"))
}
+fn is_lan_http_host(host: &str) -> bool {
+ let host = host
+ .trim()
+ .trim_start_matches('[')
+ .trim_end_matches(']')
+ .trim_end_matches('.')
+ .to_ascii_lowercase();
+ if matches!(host.as_str(), "localhost" | "localhost.localdomain") || host.ends_with(".local") {
+ return true;
+ }
+
+ match host.parse::<IpAddr>() {
+ Ok(IpAddr::V4(address)) => {
+ let octets = address.octets();
+ address.is_loopback()
+ || address.is_link_local()
+ || octets[0] == 10
+ || (octets[0] == 172 && (16..=31).contains(&octets[1]))
+ || (octets[0] == 192 && octets[1] == 168)
+ }
+ Ok(IpAddr::V6(address)) => {
+ let segments = address.segments();
+ address.is_loopback()
+ || (segments[0] & 0xfe00) == 0xfc00
+ || (segments[0] & 0xffc0) == 0xfe80
+ }
+ Err(_) => false,
+ }
+}
+
fn validate_endpoint(raw: &str, allow_insecure_http: bool) -> Result<Url> {
let mut url = Url::parse(raw.trim()).context("parse WebDAV endpoint")?;
if !matches!(url.scheme(), "https" | "http") {
@@ -61,6 +95,11 @@ fn validate_endpoint(raw: &str, allow_insecure_http: bool) -> Result<Url> {
if url.host_str().is_none() || !url.username().is_empty() || url.password().is_some() {
bail!("CONFIG_SYNC_INVALID: endpoint must not contain userinfo");
}
+ if url.scheme() == "http" && !is_lan_http_host(url.host_str().unwrap_or_default()) {
+ bail!(
+ "CONFIG_SYNC_INVALID: HTTP is limited to localhost, .local, or private LAN addresses"
+ );
+ }
url.set_query(None);
url.set_fragment(None);
let path = url.path().trim_end_matches('/').to_string();
@@ -83,9 +122,15 @@ impl WebDavTransport {
username: config.username.trim().to_string(),
password: config.password.clone(),
directory,
+ missing_object_status: compatible_missing_object_status(config.missing_object_status),
})
}
+ pub fn with_probe_result(mut self, probe: &ProbeResult) -> Self {
+ self.missing_object_status = compatible_missing_object_status(probe.missing_object_status);
+ self
+ }
+
fn url(&self, relative: &str) -> Result<Url> {
if relative.is_empty() || relative.starts_with('/') || relative.contains("..") {
bail!("CONFIG_SYNC_INVALID: unsafe remote object path");
@@ -178,7 +223,9 @@ impl WebDavTransport {
let response = self
.send(Method::GET, relative, None, HeaderMap::new())
.await?;
- if response.status() == StatusCode::NOT_FOUND {
+ if response.status() == StatusCode::NOT_FOUND
+ || self.missing_object_status == Some(response.status())
+ {
return Ok(None);
}
if !response.status().is_success() {
@@ -275,12 +322,21 @@ impl WebDavTransport {
.await?
.is_some_and(|(bytes, _)| bytes == second_body);
self.delete(&probe).await?;
+ let missing_object_status = match self
+ .send(Method::GET, &probe, None, HeaderMap::new())
+ .await?
+ .status()
+ {
+ StatusCode::BAD_GATEWAY => Some(StatusCode::BAD_GATEWAY.as_u16()),
+ _ => None,
+ };
Ok(ProbeResult {
conditional_writes: !second
&& readable
&& matched_update
&& stale_rejected
&& updated_readable,
+ missing_object_status,
})
}
}
@@ -293,6 +349,10 @@ fn strong_etag(headers: &HeaderMap) -> Option<String> {
Some(value.to_string())
}
+fn compatible_missing_object_status(value: Option<u16>) -> Option<StatusCode> {
+ (value == Some(StatusCode::BAD_GATEWAY.as_u16())).then_some(StatusCode::BAD_GATEWAY)
+}
+
pub fn remote_error_is_offline(error: &anyhow::Error) -> bool {
let text = error.to_string().to_lowercase();
text.contains("request failed")
@@ -316,6 +376,8 @@ pub(crate) mod tests {
collections: HashSet<String>,
next_etag: u64,
weak_etag: bool,
+ missing_status: Option<u16>,
+ ignore_preconditions: bool,
}
async fn read_request(stream: &mut TcpStream) -> Option<(String, String, HeaderMap, Vec<u8>)> {
@@ -385,6 +447,7 @@ pub(crate) mod tests {
404 => "Not Found",
405 => "Method Not Allowed",
412 => "Precondition Failed",
+ 502 => "Bad Gateway",
_ => "Bad Request",
};
let mut response = format!(
@@ -423,6 +486,8 @@ pub(crate) mod tests {
format!("\"{etag}\"")
};
(200, value.clone(), Some(etag))
+ } else if let Some(status) = state.missing_status {
+ (status, Vec::new(), None)
} else {
(404, Vec::new(), None)
}
@@ -438,7 +503,10 @@ pub(crate) mod tests {
.and_then(|value| value.to_str().ok())
.and_then(|value| value.trim_matches('"').parse::<u64>().ok())
.is_some_and(|expected| state.etags.get(&path) == Some(&expected));
- if (none_match && existing) || (headers.contains_key(IF_MATCH) && !match_ok) {
+ if !state.ignore_preconditions
+ && ((none_match && existing)
+ || (headers.contains_key(IF_MATCH) && !match_ok))
+ {
(412, Vec::new(), None)
} else {
state.next_etag = state.next_etag.saturating_add(1);
@@ -470,12 +538,22 @@ pub(crate) mod tests {
}
pub(crate) async fn fixture(weak_etag: bool) -> Fixture {
+ fixture_with_options(weak_etag, None, false).await
+ }
+
+ async fn fixture_with_options(
+ weak_etag: bool,
+ missing_status: Option<u16>,
+ ignore_preconditions: bool,
+ ) -> Fixture {
let listener = TcpListener::bind("127.0.0.1:0")
.await
.expect("bind fixture");
let address = listener.local_addr().expect("fixture address");
let state = Arc::new(Mutex::new(FixtureState {
weak_etag,
+ missing_status,
+ ignore_preconditions,
..FixtureState::default()
}));
let task = tokio::spawn(async move {
@@ -499,14 +577,21 @@ pub(crate) mod tests {
password: String::new(),
directory: "vault".into(),
allow_insecure_http: true,
+ missing_object_status: None,
})
.expect("transport")
}
#[test]
- fn endpoint_requires_https_unless_explicitly_acknowledged() {
- assert!(validate_endpoint("http://dav.example.test/root", false).is_err());
- assert!(validate_endpoint("http://dav.example.test/root", true).is_ok());
+ fn endpoint_requires_https_unless_explicitly_acknowledged_for_lan_hosts() {
+ assert!(validate_endpoint("http://192.168.1.10/root", false).is_err());
+ assert!(validate_endpoint("http://192.168.1.10/root", true).is_ok());
+ assert!(validate_endpoint("http://localhost/root", true).is_ok());
+ assert!(validate_endpoint("http://nas.local/root", true).is_ok());
+ assert!(validate_endpoint("http://0.0.0.0/root", true).is_err());
+ assert!(validate_endpoint("http://[::]/root", true).is_err());
+ assert!(validate_endpoint("http://dav.example.test/root", true).is_err());
+ assert!(validate_endpoint("https://dav.example.test/root", false).is_ok());
assert!(validate_endpoint("https://user:[email protected]/root", true).is_err());
}
@@ -538,6 +623,31 @@ pub(crate) mod tests {
fixture.task.abort();
}
+ #[tokio::test]
+ async fn probe_rejects_servers_that_ignore_conditional_headers() {
+ let fixture = fixture_with_options(false, None, true).await;
+ let transport = fixture_transport(&fixture.endpoint);
+ let probe = transport.probe().await.expect("probe");
+ assert!(!probe.conditional_writes);
+ fixture.task.abort();
+ }
+
+ #[tokio::test]
+ async fn probe_records_bad_gateway_as_the_missing_object_status() {
+ let fixture = fixture_with_options(false, Some(502), false).await;
+ let transport = fixture_transport(&fixture.endpoint);
+ let probe = transport.probe().await.expect("probe");
+ assert!(probe.conditional_writes);
+ assert_eq!(probe.missing_object_status, Some(502));
+ let transport = transport.with_probe_result(&probe);
+ assert!(transport
+ .get("missing")
+ .await
+ .expect("missing get")
+ .is_none());
+ fixture.task.abort();
+ }
+
#[tokio::test]
async fn empty_vault_initialization_has_one_winner() {
let fixture = fixture(false).await;
diff --git a/docs/adr/0300-host-owned-encrypted-portable-configuration-sync.md b/docs/adr/0300-host-owned-encrypted-portable-configuration-sync.md
index 30fe25c83..5dfb2a2fa 100644
--- a/docs/adr/0300-host-owned-encrypted-portable-configuration-sync.md
+++ b/docs/adr/0300-host-owned-encrypted-portable-configuration-sync.md
@@ -37,7 +37,16 @@ folder paths never become cross-device identity.
WebDAV initialization and head publication require reliable conditional writes:
`If-None-Match: *` for creation and strong-ETag `If-Match` for updates. A CAS
failure restarts reconciliation. Servers that cannot prove this capability are
-reported as unsupported rather than silently using last-writer-wins.
+reported as unsupported rather than silently using last-writer-wins. HTTPS is
+the default transport; the settings UI may explicitly acknowledge LAN HTTP
+risk, and Host restricts that exception to localhost, `.local`, or private /
+link-local IP addresses. Public HTTP endpoints remain rejected.
+
+The capability probe may record an endpoint-specific `502 Bad Gateway` response
+for a missing object, because some WebDAV gateways use that status instead of
+`404`. Only that observed status is treated as absence for subsequent reads;
+arbitrary `502` responses are not globally treated as an empty remote. This
+compatibility does not allow servers that ignore conditional-write headers.
## Consequences
diff --git a/docs/spec/03-runtime/22-config-sync.md b/docs/spec/03-runtime/22-config-sync.md
index 7315cc6b3..b25eb8408 100644
--- a/docs/spec/03-runtime/22-config-sync.md
+++ b/docs/spec/03-runtime/22-config-sync.md
@@ -86,10 +86,20 @@ capability probe writes a temporary object with conditional creation twice,
obtains a strong ETag, verifies a matching `If-Match` update, and verifies a
stale `If-Match` is rejected before the object is removed.
-HTTPS is required by default. Redirects, endpoint userinfo, path traversal,
+Some WebDAV gateways report a missing object as `502 Bad Gateway` instead of
+`404 Not Found`. The capability probe records this behavior for the selected
+endpoint after deleting its temporary object; subsequent reads treat only that
+observed status as absence. Other non-success responses remain errors. This
+does not relax conditional-write requirements: a server that ignores
+`If-None-Match` or `If-Match` remains unsupported for bidirectional sync.
+
+HTTPS is required by default. The settings page may expose an explicit
+LAN-risk acknowledgement for HTTP, but Host accepts that exception only for
+localhost, `.local` names, or private/link-local IP addresses. Public HTTP
+endpoints remain rejected. The warning explains that HTTP does not protect
+WebDAV credentials in transit. Redirects, endpoint userinfo, path traversal,
unsafe remote names, oversized objects, weak ETags, and unbounded KDF
-parameters are rejected. An HTTP exception, when exposed by a future UI, must
-be an explicit LAN-risk acknowledgement.
+parameters are rejected.
## 4. Merge and activation
diff --git a/docs/spec/04-ux/06-settings-ia.md b/docs/spec/04-ux/06-settings-ia.md
index 05c2c465a..d829b61b3 100644
--- a/docs/spec/04-ux/06-settings-ia.md
+++ b/docs/spec/04-ux/06-settings-ia.md
@@ -156,7 +156,10 @@ Settings is a **full-window page** that replaces the app sidebar + main chrome (
- **Safety**: the page never renders raw credentials or vault keys. Imported
MCP, skills, subagents, plugins, automations, and project-scoped data remain
pending until local activation approval and any required folder mapping are
- complete. Disconnect preserves local and remote data.
+ complete. HTTPS remains the default. For a trusted LAN endpoint, the page
+ can explicitly acknowledge HTTP risk; public HTTP endpoints are rejected and
+ the warning explains that WebDAV credentials are not encrypted in transit.
+ Disconnect preserves local and remote data.
- **State and recovery**: show distinct configured, locked, syncing, offline,
unsupported-server, conflict, awaiting-activation, paused, and error states.
Users can sync now, unlock, pause this device, approve/reject staged items,
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 90b298a14..0f93784d3 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -8019,7 +8019,16 @@ identify the platform validation still needed.
reject one staged entity, edit disjoint settings on both devices, and sync
again. 7) Exercise a concurrent head writer, wrong password, weak ETag,
ciphertext corruption, redirect, archive traversal, and network interruption.
-- **Expected:** The test refuses unreliable conditional writes. WebDAV sees
+ 8) Use the explicit LAN HTTP acknowledgement with a loopback/private fixture,
+ verify the setting survives a state refresh, and confirm a public HTTP
+ endpoint is rejected even when the checkbox is selected.
+- **Expected:** The test refuses unreliable conditional writes. HTTP remains
+ opt-in and is accepted only for localhost, `.local`, or private/link-local
+ addresses; public HTTP endpoints are rejected and the UI explains the
+ credential exposure risk. A fixture that reports a missing object as 502 is
+ accepted only after the capability probe observes that endpoint-specific
+ behavior; a server that ignores conditional headers remains unsupported.
+ WebDAV sees
only authenticated ciphertext and opaque object names; raw secrets never
appear in renderer state or logs. Identical and disjoint edits converge,
conflicts remain reviewable, explicit deletions use tombstones, category
diff --git a/docs/zh-CN/spec/03-runtime/22-config-sync.md b/docs/zh-CN/spec/03-runtime/22-config-sync.md
index f7d68121a..53f30e037 100644
--- a/docs/zh-CN/spec/03-runtime/22-config-sync.md
+++ b/docs/zh-CN/spec/03-runtime/22-config-sync.md
@@ -43,7 +43,12 @@ Host-core 持有 vault key、WebDAV 传输、修订状态、合并基线、待
初始化使用 `If-None-Match: *`。已有 head 必须有 strong ETag,并使用 `If-Match` 发布。前置条件失败时会从重新读取的 head 开始重新协调;绝不会盲目覆盖。能力探测会用临时对象进行两次条件创建,取得 strong ETag,验证匹配的 `If-Match` 更新,并验证旧的 `If-Match` 会被拒绝,然后删除该对象。
-默认要求 HTTPS。redirect、endpoint userinfo、路径穿越、不安全远端名称、过大对象、weak ETag 和无界 KDF 参数都会被拒绝。未来 UI 若暴露 HTTP 例外,必须要求明确确认 LAN 风险。
+部分 WebDAV 网关会把不存在的对象返回为 `502 Bad Gateway`,而不是
+`404 Not Found`。能力探测会在删除临时对象后记录所选 endpoint 的这一行为;后续读取只会将该
+endpoint 已观测到的状态视为对象不存在,其他非成功响应仍然报错。这不会放宽条件写要求:忽略
+`If-None-Match` 或 `If-Match` 的服务器仍不支持双向同步。
+
+默认要求 HTTPS。设置页可显式确认 LAN HTTP 风险,但 Host 仅接受 localhost、`.local` 或私有/链路本地 IP;公网 HTTP 仍会被拒绝。redirect、endpoint userinfo、路径穿越、不安全远端名称、过大对象、weak ETag 和无界 KDF 参数都会被拒绝。
## 4. 合并与激活
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 67407c32f..e25fb7794 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -8377,8 +8377,8 @@ the latest destination. These assertions measure work counts, not device FPS.
### E2E-CONFIG-SYNC-webdav-portable-configuration
- **前提:** 已构建的任务候选版本、隔离的 Host 配置,以及支持 strong ETag 和条件 PUT 的本地 WebDAV fixture。不使用真实 WebDAV 账户、provider 或生产桌面。
-- **步骤:** 1)打开设置 → 云同步,填写 fixture URL、设备标签、目录和备份密码。2)运行能力测试,确认使用临时对象。3)选择 provider/MCP/skill 类别,保持凭据和 memory 未选中;在第二次预览中启用凭据,确认只显示脱敏计数。4)配置设备 A,创建 user provider 和 MCP 定义并同步。5)让设备 B 连接同一 vault,同步后检查待激活/映射,并验证审批前不会运行命令或任务。6)批准一个变更后的安全实体,拒绝一个暂存实体,在两台设备上编辑不相交设置并再次同步。7)测试并发 head writer、错误密码、weak ETag、密文损坏、redirect、归档路径穿越和网络中断。
-- **预期:** 测试拒绝不可靠的条件写入。WebDAV 只能看到已认证的密文和不透明对象名;原始秘密不会出现在 Renderer 状态或日志中。相同和不相交的编辑会收敛,冲突保持可审查,明确删除使用 tombstone,类别退出不是删除,可执行导入在本地审批和映射前保持不激活。恢复不会暴露部分应用的本地配置。
+- **步骤:** 1)打开设置 → 云同步,填写 fixture URL、设备标签、目录和备份密码。2)运行能力测试,确认使用临时对象。3)选择 provider/MCP/skill 类别,保持凭据和 memory 未选中;在第二次预览中启用凭据,确认只显示脱敏计数。4)配置设备 A,创建 user provider 和 MCP 定义并同步。5)让设备 B 连接同一 vault,同步后检查待激活/映射,并验证审批前不会运行命令或任务。6)批准一个变更后的安全实体,拒绝一个暂存实体,在两台设备上编辑不相交设置并再次同步。7)测试并发 head writer、错误密码、weak ETag、密文损坏、redirect、归档路径穿越和网络中断。8)使用回环/私有地址的 fixture 勾选“允许在受信任的内网地址使用 HTTP”,确认刷新状态后仍保留;即使勾选,公网 HTTP 地址也必须被拒绝。
+- **预期:** 测试拒绝不可靠的条件写入。HTTP 默认关闭,仅允许 localhost、`.local` 或私有/链路本地地址;公网 HTTP 地址会被拒绝,界面会提示凭据暴露风险。若 fixture 探测到该 endpoint 对不存在对象返回 502,后续只兼容该 endpoint 的这一行为;忽略条件头的服务器仍必须标记为不受支持。WebDAV 只能看到已认证的密文和不透明对象名;原始秘密不会出现在 Renderer 状态或日志中。相同和不相交的编辑会收敛,冲突保持可审查,明确删除使用 tombstone,类别退出不是删除,可执行导入在本地审批和映射前保持不激活。恢复不会暴露部分应用的本地配置。
- **规格:** `03-runtime/22-config-sync.md`、`03-runtime/14-secrets-storage.md`、`05-security/01-security.md`、ADR 0300。
- **验收:** F(持久化)、Security、Quality。
- **里程碑:** M6+。
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index f14c49f77..e5378ce78 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -679,6 +679,9 @@ sklm: {
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "HTTP für eine vertrauenswürdige LAN-Adresse zulassen",
+ allowInsecureHttpWarning:
+ "HTTP verschlüsselt WebDAV-Anmeldedaten nicht. Nur für eine vertrauenswürdige LAN-Adresse aktivieren; öffentliche HTTP-Endpunkte werden abgelehnt.",
username: "Username",
appPassword: "App password",
directory: "Remote directory",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index fd21d488a..a54e9c7d1 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -925,6 +925,9 @@ sklm: {
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "Allow HTTP for a trusted LAN address",
+ allowInsecureHttpWarning:
+ "HTTP does not encrypt WebDAV credentials. Enable only for a trusted LAN address; public HTTP endpoints are rejected.",
username: "Username",
appPassword: "App password",
directory: "Remote directory",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index 9b2e313db..ddb8e6078 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -679,6 +679,9 @@ sklm: {
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "Allow HTTP for a trusted LAN address",
+ allowInsecureHttpWarning:
+ "HTTP does not encrypt WebDAV credentials. Enable only for a trusted LAN address; public HTTP endpoints are rejected.",
username: "Username",
appPassword: "App password",
directory: "Remote directory",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index c4ea52aea..4b796dcb5 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -679,6 +679,9 @@ sklm: {
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "Allow HTTP for a trusted LAN address",
+ allowInsecureHttpWarning:
+ "HTTP does not encrypt WebDAV credentials. Enable only for a trusted LAN address; public HTTP endpoints are rejected.",
username: "Username",
appPassword: "App password",
directory: "Remote directory",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index b5c012ba8..7ad6fcb47 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -687,6 +687,9 @@ sklm: {
"Synchronize portable configuration through an encrypted WebDAV vault. Conversation history, source files, and runtime state are never included.",
endpoint: "WebDAV URL",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "Allow HTTP for a trusted LAN address",
+ allowInsecureHttpWarning:
+ "HTTP does not encrypt WebDAV credentials. Enable only for a trusted LAN address; public HTTP endpoints are rejected.",
username: "Username",
appPassword: "App password",
directory: "Remote directory",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 29c94b55c..0e2b93179 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -686,6 +686,9 @@ sklm: {
connectionDescription: "Şifreli bir WebDAV kasası üzerinden taşınabilir yapılandırmayı senkronize edin.",
endpoint: "WebDAV URL'si",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "Allow HTTP for a trusted LAN address",
+ allowInsecureHttpWarning:
+ "HTTP does not encrypt WebDAV credentials. Enable only for a trusted LAN address; public HTTP endpoints are rejected.",
username: "Kullanıcı adı",
appPassword: "Uygulama parolası",
directory: "Uzak dizin",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index cdbfe54b4..6d81a7f7d 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -676,6 +676,8 @@ sklm: {
connectionDescription: "通过加密的 WebDAV 保管库同步可移植配置。不会包含对话历史、源文件或运行时状态。",
endpoint: "WebDAV 地址",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "允许在受信任的内网地址使用 HTTP",
+ allowInsecureHttpWarning: "HTTP 不会加密 WebDAV 凭据。仅对你控制的受信任内网地址启用;公网 HTTP 地址会被拒绝。",
username: "用户名",
appPassword: "应用密码",
directory: "远程目录",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index 39f614962..1e832c8c7 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -676,6 +676,8 @@ sklm: {
connectionDescription: "透過加密的 WebDAV 保管庫同步可攜式設定。不會包含對話記錄、原始碼或執行階段狀態。",
endpoint: "WebDAV 網址",
endpointPlaceholder: "https://dav.example.com/",
+ allowInsecureHttp: "允許在受信任的內網位址使用 HTTP",
+ allowInsecureHttpWarning: "HTTP 不會加密 WebDAV 憑據。僅對你控制的受信任內網位址啟用;公網 HTTP 位址會被拒絕。",
username: "使用者名稱",
appPassword: "應用程式密碼",
directory: "遠端目錄",
diff --git a/packages/shared/src/types/config-sync.ts b/packages/shared/src/types/config-sync.ts
index d1ea74c80..2d330b84d 100644
--- a/packages/shared/src/types/config-sync.ts
+++ b/packages/shared/src/types/config-sync.ts
@@ -101,6 +101,8 @@ export type ConfigSyncState = {
username?: string;
directory?: string;
deviceLabel?: string;
+ /** True only when the configured WebDAV endpoint is an acknowledged LAN HTTP target. */
+ allowInsecureHttp?: boolean;
categories: ConfigSyncCategorySelection;
includeSecrets: boolean;
includeMemory: boolean;