Skip to content

fix: don't DNS-resolve redirect_uris during client registration - #488

Merged
masv3971 merged 2 commits into
SUNET:mainfrom
sirosfoundation:fix/redirect-uri-dns-validation
Jul 29, 2026
Merged

fix: don't DNS-resolve redirect_uris during client registration#488
masv3971 merged 2 commits into
SUNET:mainfrom
sirosfoundation:fix/redirect-uri-dns-validation

Conversation

@leifj

@leifj leifj commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Fixes #487

Problem

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.

Fix

Remove DNS resolution and private-IP blocking from the redirect_uri validator. 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_uri validator (used for server-side fetches like logo_uri) retains its DNS/SSRF checks.

Tests

Added test cases for ccTLD (example.se) and non-resolving hostnames (nonexistent.test).

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.

@s-jairl s-jairl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_uri validator.
  • 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.

Comment thread pkg/helpers/validate.go Outdated
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.
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@masv3971
masv3971 merged commit e78c3f2 into SUNET:main Jul 29, 2026
5 checks passed
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.

OIDC client registration rejects redirect_uris with non-resolving hostnames

4 participants