fix(security): guard OIDC discovery against SSRF - #600
Merged
Conversation
OidcClient fetched the admin-configured issuer_url and the endpoints its discovery doc advertises (token/jwks/userinfo) with no host restriction — an admin could target cloud metadata / localhost / the internal network, and the token_endpoint receives the client_secret. Add SsrfGuard::assertPublicHttps (https-only; blocks localhost, private/reserved IP literals, and hosts that resolve to a non-public address) before each outbound fetch.
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| Security | 1 high |
🟢 Metrics 14 complexity · 0 duplication
Metric Results Complexity 14 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Merged
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.
OWASP-audit fix (HIGH).
OidcClientfetched the admin-configuredissuer_url+ every discovery-advertised endpoint (token/jwks/userinfo) with no host restriction — SSRF to cloud metadata / localhost / internal network, and thetoken_endpointreceives theclient_secret. NewApp\Support\SsrfGuard::assertPublicHttps(https-only; blocks localhost + private/reserved IP literals + hosts resolving to non-public) called before each outbound fetch. Unresolvable hosts are allowed (no reachable target; keeps tests off live DNS). NewSsrfGuardTest; existing OIDC tests green. Full suite 1153 pass / 1 skip; PHPStan 0-new; Pint clean; no migrations. VERSION 2.0.1-rc.1.