fix(security): introspect auth bypass, backchannel SSRF, session rollover#606
Merged
lakhansamani merged 1 commit intomainfrom Apr 12, 2026
Merged
Conversation
…over logging - Introspect endpoint: require client_secret when server has one configured. Previously the AND condition allowed callers to skip auth by omitting the secret. Now uses crypto/subtle.ConstantTimeCompare for timing-safe comparison. - Backchannel logout: replace plain http.Client with SafeHTTPClient to block SSRF against private/loopback addresses via DNS-pinning validation. - Session rollover: log failed old-session deletion instead of silently discarding the error from the fire-and-forget goroutine. - Remove duplicate copy-paste test (RFC7636 plain method) that was always failing on main.
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.
Summary
Introspect endpoint client_secret bypass (Medium): The
/oauth/introspecthandler previously usedclientSecret != "" && h.Config.ClientSecret != ""— both sides had to be non-empty, so omitting the secret bypassed authentication entirely. Now requiresclient_secretwhenever the server has one configured, usingcrypto/subtle.ConstantTimeComparefor timing-safe comparison.Backchannel logout SSRF (Low): Replaced plain
http.Client{}withvalidators.SafeHTTPClient()which resolves DNS upfront, pins the IP, and rejects private/loopback addresses. Aligns with defense-in-depth posture already applied totest_endpointand webhooks.Session rollover fire-and-forget (Low): Wrapped goroutine with error logging so failed old-session deletions are visible in logs instead of silently discarded.
Duplicate test fix: Removed copy-paste duplicate
RFC7636_plain_code_challenge_method_is_acceptedtest that actually testedunsupportedmethod with wrong assertion — was failing on main.Security review
Reviewed by security-engineer agent. All fixes verified correct. The agent flagged
token.go:248(clientSecret != "") as a potential similar bypass, but on inspection this is correct RFC 6749/7636 behavior — public clients use PKCE without a secret, and when no PKCE is used, the secret is already required (lines 239-245).Test plan
TestIntrospectMissingClientSecretRejectsWhenConfigured— new test, verifies secret is required when configuredTestIntrospectWrongClientSecretRejects— new test, verifies wrong secret is rejectedTestIntrospectActiveAccessToken— updated to include secret, passesTestIntrospectActiveIDToken— updated to include secret, passesTestBackchannelLogoutRejectsLocalhostSSRF— new test, verifies SSRF protection is wired inTestBackchannelLogoutJWTClaims— verifies JWT claim structure per OIDC BCL 1.0 §2.4TEST_DBS=sqlite, 44s)