[core] Share paths and errors: decode once and refuse invalid UTF-8 and any NFKC look-alike of path structure, dots before any escape; hide everything before the last @ of a URL

This commit is contained in:
2026-11-07 19:18:17 +01:00
parent dd10557b87
commit 43918943da
6 changed files with 113 additions and 61 deletions
+17
View File
@@ -255,3 +255,20 @@ fn a_password_in_an_upstream_url_is_never_repeated() {
.unwrap();
assert_eq!(e.params()["url"], "http://\u{2026}@10.0.0.2:3000");
}
#[test]
fn credentials_with_slash_query_or_hash_are_never_repeated() {
for url in [
"http://admin:hunter/2@10.0.0.1:80",
"http://admin:hunter?2@10.0.0.1:80",
"http://admin:hunter#2@10.0.0.1:80",
"ftp://admin:hunter2@10.0.0.1",
] {
let errs = errors_for(&format!("hostname = \"app.test\"\nupstreams = [\"{url}\"]\n"));
assert!(!errs.is_empty(), "{url} accepted");
for e in &errs {
let all = format!("{e} {:?}", e.params());
assert!(!all.contains("hunter"), "{url}: {all}");
}
}
}