fix: validate OIDC redirect URL protocol before navigation#587
fix: validate OIDC redirect URL protocol before navigation#587
Conversation
Semgrep Security ScanNo security issues found. |
PR Metrics
Updated Wed, 15 Apr 2026 14:03:16 GMT · run #867 |
Greptile SummaryThis PR adds client-side validation of the OIDC redirect URL before navigating, closing an open-redirect / XSS vector where a malicious OIDC provider response could redirect to a Key changes:
Confidence Score: 5/5Safe to merge — the security fix is correct, both prior review concerns are addressed, and no logic bugs were found. The validation logic is sound: the No files require special attention; Important Files Changed
Sequence DiagramsequenceDiagram
participant App as OidcRedirect (frontend)
participant Backend
participant Provider as OIDC Provider
App->>Backend: GET /v1/auth/oidc/config
alt OIDC mode enabled
Backend-->>App: { issuerOrigin: "https://auth.example.com" }
else Non-OIDC / unavailable
Backend-->>App: 404 / error → expectedOrigin = undefined
end
App->>Backend: POST /v1/api/auth/sign-in/oauth2
Backend-->>App: { url: "https://auth.example.com/authorize?..." }
App->>App: validateOidcRedirectUrl(url, expectedOrigin)
alt Protocol is javascript: or data:
App-->>App: throw → show error UI
else HTTP on non-localhost
App-->>App: throw → show error UI
else Origin mismatch (when expectedOrigin set)
App-->>App: throw → show error UI
else Valid URL
App->>Provider: window.location.href = validatedUrl.href
end
Reviews (6): Last reviewed commit: "feat: add OIDC issuer origin validation ..." | Re-trigger Greptile |
|
LGTM. The OIDC redirect validation is correct and covers the relevant attack vectors. Tests are comprehensive. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d2d065a. Configure here.
ReviewSecurity
Bugs
|
|
Code Review One convention violation found. Project Convention Compliance
Everything else looks good. The |
Code ReviewBugs & Data Loss Error state is unrecoverable — Once Security / Breaking Changes: No issues found. Convention Compliance: No issues found. |
|
Code Review — OIDC Redirect URL Validation No bugs, security issues, or convention violations found above the reporting threshold. The One thing to be aware of: the Looks good to merge. ✅ |
Code ReviewSecurity
The inner Convention
All three test cases use |

Summary
validateOidcRedirectUrlto rejectjavascript:,data:, and non-HTTPS (except localhost) redirect URLs before navigating, preventing open-redirect and XSS via a malicious OIDC provider responseCloses THU-375 #25
Test plan
bun run type-checkpassesbun test src/components/oidc-redirectpasses (8/8, stable across 5 reruns)🤖 Generated with Claude Code
Note
Medium Risk
Touches the OIDC sign-in redirect flow and adds a new backend endpoint used during login, so a mistake could block authentication or mis-validate redirects. The changes are small and covered by unit tests, reducing risk.
Overview
Hardens the OIDC login redirect by validating the provider-supplied redirect URL before navigation, rejecting non-
https:schemes (excepthttpforlocalhost/127.0.0.1) and optionally enforcing an expected issuerorigin.Adds a lightweight backend
GET /v1/auth/oidc/configendpoint (only active inauthMode: 'oidc') that returns the configured issuer origin for the frontend to validate against, plus unit tests for both the frontend validator and the new backend route.Reviewed by Cursor Bugbot for commit 3be7c6d. Bugbot is set up for automated code reviews on this repo. Configure here.