test(net): cover the reported unschemed proxy values in redaction

Refs #7233 (CW-7824). 832ac8544b already keeps malformed HTTP(S)_PROXY
values out of the MCP warning and makes redact_proxy_userinfo return
"<invalid proxy URL>" for input without a scheme. The existing redaction
table now carries the reporter's four unschemed rows (a space in the host,
a non-numeric port, an unclosed IPv6 bracket, an empty host), assembled
from the placeholder credentials like the rest of the table, and asserts
the password never survives.

Verified (macOS, offline, locked): cargo test -p codewhale-net --lib
redact_proxy_userinfo_strips_password 1 passed, 0 failed (72 filtered).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
CodeWhale BotandClaude Opus 5.5 committed 2026-11-07 12:51:37 -08:00
1 parent 90b48c7ffd
commit f230a76b2b
1 file changed
+7
+7
View File
@@ -1053,5 +1053,12 @@ mod tests {
assert_eq!(redacted, "http://proxy.example");
assert_eq!(redact_proxy_userinfo("not-a-url"), "<invalid proxy URL>");
for host in ["ho st:8080", "proxy.example:port-not-a-number", "[::1:8080", ""] {
let malformed = format!("{placeholder_user}:{placeholder_pass}@{host}");
let redacted = redact_proxy_userinfo(&malformed);
assert_eq!(redacted, "<invalid proxy URL>", "{host:?}");
assert!(!redacted.contains(placeholder_pass));
}
}
}