fix: don't DNS-resolve redirect_uris during client registration - #488
Merged
masv3971 merged 2 commits intoJul 29, 2026
Merged
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.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the OAuth/OIDC dynamic client registration validation logic to stop DNS-resolving redirect_uris during registration, aligning validation with the fact that redirect URIs are not fetched server-side and avoiding false rejections for non-resolving domains.
Changes:
- Removed DNS resolution and private-IP blocking from the
redirect_urivalidator. - Kept SSRF/DNS protections in
safe_uri(for server-fetched metadata URIs). - Added registration validation tests covering ccTLD and non-resolving hostnames.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/helpers/validate.go | Removes DNS/SSRF checks from redirect_uri validation logic and updates comments accordingly. |
| internal/verifier/apiv1/handler_client_registration_test.go | Adds test cases ensuring non-resolving redirect URI hostnames are accepted. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Native-app redirect URIs (e.g. com.example.app:/oauth2redirect) use custom schemes without an authority component. Only require a hostname for http/https schemes; for custom schemes, require at least a path or opaque component beyond the scheme.
|
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).