Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(mcp): cover header forwarding excluding host auth secrets

Steven Enamakel5591efc39df3
diff --git a/crates/openhuman-core/src/mcp/server/http_tests.rs b/crates/openhuman-core/src/mcp/server/http_tests.rs
index 78ca8b75a8..b4a557bc52 100644
--- a/crates/openhuman-core/src/mcp/server/http_tests.rs
+++ b/crates/openhuman-core/src/mcp/server/http_tests.rs
@@ -68,3 +68,21 @@ async fn invalid_module_http_status_fails_closed_as_internal_server_error() {
"bad status"
);
}
+
+#[test]
+fn module_protocol_headers_exclude_host_authentication_secrets() {
+ let mut headers = HeaderMap::new();
+ headers.insert(AUTHORIZATION, HeaderValue::from_static("Bearer private-host-token"));
+ headers.insert("proxy-authorization", HeaderValue::from_static("Basic private-proxy-token"));
+ headers.insert("cookie", HeaderValue::from_static("session=private-cookie"));
+ headers.insert(HEADER_SESSION_ID, HeaderValue::from_static("session-7"));
+ headers.insert("mcp-protocol-version", HeaderValue::from_static("2025-11-25"));
+ headers.insert("accept", HeaderValue::from_static("application/json"));
+ let forwarded = request_headers(&headers);
+ assert!(!forwarded.contains_key("authorization"));
+ assert!(!forwarded.contains_key("proxy-authorization"));
+ assert!(!forwarded.contains_key("cookie"));
+ assert_eq!(forwarded[HEADER_SESSION_ID], "session-7");
+ assert_eq!(forwarded["mcp-protocol-version"], "2025-11-25");
+ assert_eq!(forwarded["accept"], "application/json");
+}