Repository navigation
Reject a path that does not start with / after a URI authority - #87
Merged
Merged
Conversation
RFC 3986 section 3.3 requires the path after an authority to be empty or to start with "/". The parser's pattern instead left whatever followed an authority it could not split in the path: `http://[localhost]/` parsed with host "" and path "[localhost]/", `http://[::1]x/` with host "::1" and path "x/", and `http://a[b]/` with host "a". These now throw `ParseError`, as the `URI(; host, path)` constructor already did for the same components. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #87 +/- ##
==========================================
+ Coverage 93.75% 93.93% +0.18%
==========================================
Files 5 5
Lines 416 429 +13
==========================================
+ Hits 390 403 +13
Misses 26 26 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Parse errors showed the userinfo, the whole input, or a host or port that a
raw '@' or '/' in a password had split off ("Invalid URI port: s3cr3t" for
`http://user:s3cr3t/x@host/`). They now show the input with everything from
the authority up to its last '@' replaced by "***". The constructor's userinfo
error and `splitfilepath`'s scheme error no longer echo their argument, and
the strict-mode round-trip check throws a ParseError with the redacted input
instead of an AssertionError that printed it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`findlast(f, ::String)` passes `f` on to `findprev` without specializing on it, which the --trim=safe native job reports as an unresolved call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
quinnj
referenced
this pull request
Oct 22, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After an authority, a URI path must be empty or start with
/(RFC 3986 §3.3). TheURI(; host, path)constructor already enforces this. The string parser did not: whatever followed an authority its pattern could not split ended up in the path.http://[localhost]/"", path"[localhost]/"ParseErrorhttp://[a]:80/"", path"[a]:80/"ParseErrorhttp://[::1]x/"::1", path"x/"ParseErrorhttp://foo[bar]/"foo", path"[bar]/"ParseError//[x]y"", path"[x]y"ParseErrorparse_uri_referencenow throwsParseError("Invalid URI authority: …")in these cases, sotryparsereturnsnothing. IPv6 literals followed by a port, path, query, fragment, or nothing still parse, as before. Follows #74.Error messages. Parse errors no longer show the userinfo, the whole input, or a host or port that a raw
@or/in a password split off. Before,URI("http://user:s3cr3t/x@host/")reportedInvalid URI port: s3cr3t. Messages now show the input with everything from the authority up to its last@replaced by***, e.g.Invalid URI port in http://***@host/. The keyword constructor's userinfo error andsplitfilepath's scheme error no longer echo their argument. The strict-mode round-trip check (parse_uri_reference(str; strict=true)) now throwsParseErrorwith the redacted input, instead of anAssertionErrorthat printed it.Verification. Cases added to "Invalid Authorities" in
test/uri.jl, plus three that must keep parsing. Without the change, 14 of the new assertions fail. A further loop checks thatsprint(showerror, err)never contains the password, for each rewritten message; 6 of those fail on the previous messages. The full suite passes on Julia 1.12 and 1.10. The--trim=safenative job's build and checks pass locally on Julia 1.13.2. The first version of the redaction usedfindlast, which the trim verifier rejects; that is fixed in 2d12258.Review.
parse_uri_reference, which every string path goes through:URI(str),parse,tryparse,parse_uri,resolvereference/absurion strings, and Serialization's legacy reparse, which falls back to the stored fields when parsing fails./. Those components could not be produced by the keyword constructor.mailto:,urn:, andhttp:ghave no authority and are unaffected, as arefile:///C:/xandfile://C:/x(hostC, empty port, path/x).http://[v1.x]/, already parsed to host""and now throw instead.throwinsrc/. The keyword constructor's host and port errors still echo what the caller passed as host or port.ensurevalid(strict mode) runs only after host validation, which rejects@, so its host message keeps the host._redacteduses only concrete string operations, so the--trim=safenative job's parse path stays resolvable.🤖 Generated with Claude Code