fix: don't DNS-resolve redirect_uris during client registration#488
Open
leifj wants to merge 1 commit into
Open
fix: don't DNS-resolve redirect_uris during client registration#488leifj wants to merge 1 commit into
leifj wants to merge 1 commit into
Conversation
The redirect_uri validator resolved hostnames via net.LookupIP() and rejected URIs whose hostnames didn't resolve (for http/https). This caused ccTLD domains like example.se to fail registration while example.org (which resolves to an IANA-reserved IP) succeeded. Redirect URIs are never fetched server-side — they're URLs the browser is redirected to. The SSRF concern that motivated the DNS check doesn't apply here. Remove the DNS resolution and private-IP blocking from the redirect_uri validator, keeping only the syntactic checks required by RFC 6749 (scheme present, no fragment). The safe_uri validator (used for server-side fetches like logo_uri) retains its DNS/SSRF checks. Add test cases for ccTLD and non-resolving hostnames.
|
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.



Fixes #487
Problem
The
redirect_urivalidator resolved hostnames vianet.LookupIP()and rejected URIs whose hostnames didn't resolve (for http/https). This caused ccTLD domains likeexample.seto fail registration whileexample.org(which resolves to an IANA-reserved IP) succeeded.Fix
Remove DNS resolution and private-IP blocking from the
redirect_urivalidator. Redirect URIs are never fetched server-side — they're URLs the browser is redirected to. The SSRF concern that motivated the DNS check doesn't apply.Keep only the syntactic checks required by RFC 6749 (scheme present, no fragment).
The
safe_urivalidator (used for server-side fetches likelogo_uri) retains its DNS/SSRF checks.Tests
Added test cases for ccTLD (
example.se) and non-resolving hostnames (nonexistent.test).