[core] Share paths and errors: refuse overlong UTF-8, %u, look-alike dots and slashes and trimmed dot segments; never repeat URL credentials in an error

This commit is contained in:
2026-11-07 18:53:42 +01:00
parent 4448527b16
commit 2b66729f1b
5 changed files with 105 additions and 13 deletions
+3 -1
View File
@@ -422,7 +422,9 @@ fn rejects_bad_upstream_urls() {
] {
let e = single_error(&format!("hostname = \"app.test\"\nupstreams = [{bad:?}]\n"));
assert!(
matches!(e, ValidationError::BadUpstreamUrl { ref url, .. } if url == bad),
// Credentials are never repeated in an error.
matches!(e, ValidationError::BadUpstreamUrl { ref url, .. }
if url == bad || (bad.contains('@') && url == "http://\u{2026}@127.0.0.1:8080")),
"upstream {bad:?} gave {e:?}"
);
}