The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(agent): add test for sanitize redacting unparseable URLs\n\nAdd a test to verify that the sanitize function redacts URLs that cannot be parsed as absolute URLs, since such values may contain credential-bearing components like protocol-relative userinfo. The test also confirms that parseable absolute URLs are normalized rather than dropped.\n\nAuto-committed-on: dragonfly\n
Steven Enamakel74283f35795f
diff --git a/src/embed/agent_tests.rs b/src/embed/agent_tests.rsindex 76ceb0f9e6..dfa9cebc23 100644--- a/src/embed/agent_tests.rs+++ b/src/embed/agent_tests.rs@@ -144,3 +144,17 @@ fn insecure_route_error_names_the_redacted_endpoint() {);assert!(msg.contains("api.example"), "origin stays readable: {msg}");}++#[test]+fn sanitize_redacts_unparseable_urls() {+ // A value that does not parse as an absolute URL cannot be proven free of+ // credential-bearing components (e.g. protocol-relative userinfo), so it+ // must never be echoed verbatim into diagnostics.+ assert_eq!(sanitize_url_for_display("//user:sk-secret@host/path"), "<redacted>");+ assert_eq!(sanitize_url_for_display("not a url at all"), "<redacted>");+ // A parseable absolute URL is normalized, not dropped.+ let normalized = sanitize_url_for_display("https://user:[email protected]/v1?k=leaky");+ assert!(normalized.contains("api.example"));+ assert!(!normalized.contains("sk-secret"));+ assert!(!normalized.contains("leaky"));+}