Skip to content

feat: improved authority validation checks - #861

Open
tremwil wants to merge 1 commit into
hyperium:masterfrom
tremwil:feat/improved-authority-validation
Open

feat: improved authority validation checks#861
tremwil wants to merge 1 commit into
hyperium:masterfrom
tremwil:feat/improved-authority-validation

Conversation

@tremwil

@tremwil tremwil commented Aug 10, 2026

Copy link
Copy Markdown

Rewrites the http::uri::Authority validation to follow RFC 3986 more strictly, rejecting a illegal authorities that are currently accepted (such as broken IPv6 literals or non-digit ports).

All validation code is written such that it can execute in a const context, to maintain support for Authority::from_static.

At the same time, this allows the host to be percent-encoded. Allowed percent encodings are restricted to characters that can't be encoded as-is to prevent url-confusion attacks with authorities that the crate currently accepts. That is, authorities that are semantically equivalent to a previously accepted one but compare differently due to the use of percent encodings are rejected. This would unblock usecases such as #836 (comment) and #528 while hopefully addressing the security concerns laid out in #528 (comment).

@tremwil
tremwil force-pushed the feat/improved-authority-validation branch from fc20eb4 to c04d8ce Compare August 10, 2026 12:24
Rewrites the `http::uri::Authority` validation to follow RFC 3986 more
strictly, rejecting a illegal authorities that are currently accepted
(such as broken IPv6 literals or non-digit ports).

All validation code is written such that it can execute in a `const`
context, to maintain support for `Authority::from_static`.

At the same time, this allows the host to be percent-encoded. Allowed
percent encodings are restricted to characters that can't be encoded
as-is to prevent url-confusion attacks with authorities that the crate
currently accepts. That is, authorities that are semantically equivalent
to a previously acccepted one but compare differently due to the use of
percent encodings will be rejected.
@tremwil
tremwil force-pushed the feat/improved-authority-validation branch from c04d8ce to 27407fc Compare August 10, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant