Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

test(wiki): pin admission webhook scheme validation

AkitaOnRails126efad972c7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c77ed3de..80d18fd0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,16 @@ version in [`docs/changelog/`](docs/changelog/):
## [Unreleased]
+### Fixed
+
+- Admission webhook URLs are validated when the chain is built: only
+ `http://` and `https://` URLs are accepted. A webhook configured with any
+ other scheme (`file:`, `ftp:`, a custom scheme), a bare hostname, or an
+ empty URL could never be called, yet previously loaded fine and then
+ errored on every covered write at request time — under a `reject` failure
+ policy that aborted each write. The server now refuses to start and names
+ the offending webhook instead (#1766).
+
## [3.2.8] - 2026-10-27
### Fixed
diff --git a/crates/ai-memory-wiki/tests/suite/admission.rs b/crates/ai-memory-wiki/tests/suite/admission.rs
index 5b006aa6..f0498971 100644
--- a/crates/ai-memory-wiki/tests/suite/admission.rs
+++ b/crates/ai-memory-wiki/tests/suite/admission.rs
@@ -448,6 +448,48 @@ async fn chain_rejects_more_than_max_admission_webhooks() {
);
}
+#[test]
+fn chain_rejects_non_http_webhook_urls_at_construction() {
+ // Only http:// and https:// webhook URLs are accepted: anything else
+ // (file://, ftp://, a custom scheme, a bare hostname, an empty value)
+ // can never produce a working webhook — reqwest has no handler for it —
+ // so the chain refuses it at construction rather than erroring on every
+ // write at request time.
+ let hook = |url: &str| WebhookConfig {
+ name: "hook".into(),
+ url: url.into(),
+ timeout_ms: 1_000,
+ failure_policy: FailurePolicy::Ignore,
+ events: vec![AdmissionOp::WritePage],
+ blocking: true,
+ };
+ for bad in [
+ "file:///etc/passwd",
+ "ftp://example.com/hook",
+ "gopher://example.com/hook",
+ "example.com/bare-hostname",
+ "",
+ " ",
+ ] {
+ let err = AdmissionChain::new(vec![hook(bad)])
+ .expect_err("non-http(s) webhook URL must be refused");
+ assert!(
+ err.to_string().contains("unsupported URL scheme"),
+ "{bad:?}: unexpected error message: {err}"
+ );
+ }
+ // Legitimate controls: a blanket refusal must not be mistaken for
+ // correctness, and scheme matching is case-insensitive like URL parsing.
+ for good in [
+ "http://127.0.0.1:1/hook",
+ "https://example.com/hook",
+ "HTTP://EXAMPLE.COM/hook",
+ ] {
+ AdmissionChain::new(vec![hook(good)])
+ .unwrap_or_else(|e| panic!("http(s) webhook URL {good:?} must be accepted: {e}"));
+ }
+}
+
#[tokio::test]
async fn oversized_response_is_treated_as_noop() {
// A webhook returning > MAX_RESPONSE_BYTES gets dropped — never
diff --git a/docs/admission-webhooks.md b/docs/admission-webhooks.md
index d78d7af1..7da52330 100644
--- a/docs/admission-webhooks.md
+++ b/docs/admission-webhooks.md
@@ -354,6 +354,10 @@ events = ["write_page", "consolidate", "delete", "purge_project", "move_project"
blocking = false # fire-and-forget after the write; never blocks it
```
+Only `http://` and `https://` webhook URLs are accepted; any other scheme, a
+bare hostname, or an empty `url` fails server startup when the chain is
+built.
+
### `blocking` (default `true`)
A webhook is either **blocking** or **non-blocking**: