Repository navigation
[Server][Client] Refuse OAuth URLs that hide where their host points - #713
Merged
chr-hertel merged 6 commits intoNov 10, 2026
Merged
chr-hertel merged 6 commits into
chr-hertel merged 6 commits into
Conversation
chr-hertel
requested review from
CodeWithKyrian,
Nyholm and
soyuka
as code owners
November 9, 2026 23:31
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Percent-encoded hosts bypass the loopback restriction because browsers normalize accepted URLs to local addresses, allowing an untrusted authorization server to redirect users to local services.
1 open issue
What changed in this PR
Hardens shared OAuth URL validation for the server and client by rejecting address forms that can conceal local or private-network destinations.
Changes:
- Rejects unspecified addresses, IPv4 embedded in IPv6, and non-standard IPv4 forms.
- Adds accepted- and rejected-URL test cases.
- Documents the compatibility changes and the need for separate DNS-based egress controls.
| File | Description |
|---|---|
tests/Unit/Server/Transport/Http/OAuth/SecureUrlTest.php |
Adds coverage for allowed hosts and rejected address forms. |
src/Server/Transport/Http/OAuth/SecureUrl.php |
Adds host-address validation to OAuth URL parsing. |
docs/client/authorization.md |
Explains new rejections and remaining DNS-related risks. |
CHANGELOG.md |
Records server and client compatibility breaks. |
Review effort: Balanced
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.

Follow-up to #666:
SecureUrl::parse()now refuses hosts that reach this machine or a private network without looking like it -0.0.0.0,::, IPv4 within IPv6 ([::ffff:127.0.0.1]) and IPv4 in another form than four decimal numbers (127.1,2130706433,0x7f000001). Over plain http they were already refused, but over https they got past the loopback check.[BC Break] for the server's issuer,
jwks_uriand resource and for the URLs a client discovers, both in the CHANGELOG. A DNS name that resolves to loopback is still left to egress control, e.g.NoPrivateNetworkHttpClient.