Skip to content

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

fix(plugins): tolerate offline Schannel revocation points

vastsa24ef059475be
diff --git a/crates/host-core/src/network_proxy.rs b/crates/host-core/src/network_proxy.rs
index d0cc48aaa..e55357e64 100644
--- a/crates/host-core/src/network_proxy.rs
+++ b/crates/host-core/src/network_proxy.rs
@@ -191,6 +191,60 @@ pub fn curl_proxy_args() -> Vec<String> {
}
}
+/// Keep Windows Schannel downloads working when a revocation distribution
+/// point is offline, while retaining normal certificate verification. Older
+/// curl versions used best-effort revocation checks by default; newer ones
+/// expose this flag explicitly.
+#[cfg(windows)]
+pub(crate) fn curl_tls_args() -> Vec<String> {
+ let (version, help) = curl_version_and_help();
+ curl_tls_args_for(&version, &help)
+}
+
+#[cfg(not(windows))]
+pub(crate) fn curl_tls_args() -> Vec<String> {
+ Vec::new()
+}
+
+#[cfg(any(windows, test))]
+fn curl_tls_args_for(version: &[u8], help: &[u8]) -> Vec<String> {
+ let version = String::from_utf8_lossy(version).to_ascii_lowercase();
+ let option = b"--ssl-revoke-best-effort";
+ let supported = help.windows(option.len()).any(|window| window == option);
+ if version.contains("schannel") && supported {
+ vec![String::from_utf8_lossy(option).into_owned()]
+ } else {
+ Vec::new()
+ }
+}
+
+#[cfg(windows)]
+fn curl_version_and_help() -> (Vec<u8>, Vec<u8>) {
+ use std::process::Command;
+ use std::sync::OnceLock;
+
+ static CURL_TLS_ARGS: OnceLock<(Vec<u8>, Vec<u8>)> = OnceLock::new();
+ CURL_TLS_ARGS
+ .get_or_init(|| {
+ let version = Command::new("curl")
+ .arg("--version")
+ .output()
+ .ok()
+ .filter(|output| output.status.success())
+ .map(|output| output.stdout)
+ .unwrap_or_default();
+ let help = Command::new("curl")
+ .args(["--help", "all"])
+ .output()
+ .ok()
+ .filter(|output| output.status.success())
+ .map(|output| output.stdout)
+ .unwrap_or_default();
+ (version, help)
+ })
+ .clone()
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -274,4 +328,15 @@ mod tests {
]
);
}
+
+ #[test]
+ fn curl_tls_args_only_use_supported_schannel_best_effort_revocation() {
+ let option = b"--ssl-revoke-best-effort";
+ assert_eq!(
+ curl_tls_args_for(b"curl 8.13.0 Schannel", option),
+ vec!["--ssl-revoke-best-effort"]
+ );
+ assert!(curl_tls_args_for(b"curl 8.13.0 OpenSSL", option).is_empty());
+ assert!(curl_tls_args_for(b"curl 7.55.1 Schannel", b"--ssl-no-revoke").is_empty());
+ }
}
diff --git a/crates/host-core/src/plugins/install.rs b/crates/host-core/src/plugins/install.rs
index 8ec766dc0..46f29d791 100644
--- a/crates/host-core/src/plugins/install.rs
+++ b/crates/host-core/src/plugins/install.rs
@@ -754,6 +754,7 @@ pub(crate) fn download_url_observed(
"pi-desktop-host-core".into(),
];
args.extend(crate::network_proxy::curl_proxy_args());
+ args.extend(crate::network_proxy::curl_tls_args());
if package_guard.is_some() && url.starts_with("https://") {
// Downgrading to plain HTTP mid-redirect would take the request off
// the host the allowlist approved.
diff --git a/crates/host-core/src/plugins/resolve.rs b/crates/host-core/src/plugins/resolve.rs
index 98eb6109d..6b37d0c1b 100644
--- a/crates/host-core/src/plugins/resolve.rs
+++ b/crates/host-core/src/plugins/resolve.rs
@@ -222,6 +222,7 @@ fn post_json(url: &str, body: &str) -> Result<(u16, Vec<u8>, String)> {
"pi-desktop-host-core".into(),
];
args.extend(crate::network_proxy::curl_proxy_args());
+ args.extend(crate::network_proxy::curl_tls_args());
if url.starts_with("https://") {
args.push("--proto".into());
args.push("=https".into());
diff --git a/docs/adr/0177-user-configurable-outbound-proxy.md b/docs/adr/0177-user-configurable-outbound-proxy.md
index badb57bf9..755024a84 100644
--- a/docs/adr/0177-user-configurable-outbound-proxy.md
+++ b/docs/adr/0177-user-configurable-outbound-proxy.md
@@ -52,6 +52,11 @@ A single Settings control should apply one proxy to app-owned traffic.
`localhost,127.0.0.1,::1,<local>` so loopback MCP and local models stay
direct.
+For host-core curl in every proxy mode, Windows builds use Schannel's
+best-effort revocation mode when the installed curl advertises it. This
+tolerates unavailable or offline revocation distribution points while keeping
+certificate verification on.
+
5. **Not rewritten**: workspace Bash (host-core spawn env strips proxy
keys so credentials cannot leak into `env`), and the system browser used
for OAuth (`shell.openExternal`). Plugin utility processes keep their
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index ac2f82f57..7bf7d7534 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -3215,21 +3215,30 @@ identify the platform validation still needed.
- **Acceptance**: G (remote marketplace source)
- **Status**: Documented / host-core unit covered
-#### E2E-024Z: Windows localized curl diagnostics stay readable
-
-- **Preconditions**: Windows x64 host. The official catalog request is forced
- to fail with a localized, non-UTF-8 curl/Schannel diagnostic (a deterministic
- fake curl in the test PATH may emit GBK stderr and exit 35).
-- **Steps**: 1) Select Extensions → Marketplace with GitHub (official) as the
- source. 2) Refresh the marketplace. 3) Inspect the error toast. 4) Switch to
- the CNB mirror and refresh again.
-- **Expected**: The failed request remains a `PLUGIN_NETWORK` failure and
- retains the readable localized diagnostic without Unicode replacement
- characters; switching to the mirror can refresh the catalog normally.
+#### E2E-024Z: Windows curl handles offline revocation checks and localized errors
+
+- **Preconditions**: Windows x64 host with curl built against Schannel. For the
+ offline-revocation case, use a proxy route that can reach the HTTPS fixture
+ while its certificate revocation distribution point is unavailable. For the
+ diagnostic case, force the catalog request to fail with localized, non-UTF-8
+ curl output (a deterministic fake curl may emit GBK stderr and exit 35).
+- **Steps**: 1) Select Extensions → Marketplace with Official as the source.
+ 2) Refresh the catalog and install a package through the system proxy while
+ the revocation distribution point is offline. 3) Confirm the installed curl
+ advertises `--ssl-revoke-best-effort` and inspect the verified package. 4)
+ Force a localized curl/Schannel failure, refresh again, and inspect the error
+ toast. 5) Switch to the CNB backup and refresh.
+- **Expected**: When the installed Schannel curl supports the option, catalog
+ and package requests tolerate an unavailable revocation distribution point
+ without disabling certificate verification; package size and SHA-256 checks
+ still gate installation. A real network/TLS failure remains
+ `PLUGIN_NETWORK`, with localized diagnostics readable and no Unicode
+ replacement characters; switching to a reachable backup can refresh the
+ catalog normally.
- **Specs linked**: `07-plugins/07-plugin-marketplace.md`,
- `03-runtime/07-process-model.md`
+ `03-runtime/07-process-model.md`, ADR 0177
- **Acceptance**: G (remote marketplace source)
-- **Status**: Documented / host-core unit covered; Windows rendered validation pending
+- **Status**: Documented; host-core unit covered; Windows proxy/TLS validation pending
#### E2E-024B: Marketplace install with permission review
diff --git a/docs/spec/07-plugins/07-plugin-marketplace.md b/docs/spec/07-plugins/07-plugin-marketplace.md
index ce9611c74..ce73199d4 100644
--- a/docs/spec/07-plugins/07-plugin-marketplace.md
+++ b/docs/spec/07-plugins/07-plugin-marketplace.md
@@ -62,7 +62,10 @@ System mode sends host-core `curl` through Electron's authenticated loopback
SOCKS relay, which resolves each destination using the active OS proxy/PAC
configuration. Direct mode forces the marketplace request direct; Custom uses
the configured proxy and bypass list. The relay credential is runtime-only and
-is not inherited by workspace shell commands.
+is not inherited by workspace shell commands. On Windows, host-core uses
+Schannel's best-effort revocation mode when the installed `curl` supports it,
+so an unavailable revocation distribution point does not block the HTTPS
+request; certificate verification and package size/hash checks remain enabled.
The official channel is the plugin center: its catalog is the generated
`catalog.json` the center publishes, and a package installed from it is