[codex] validate magic-link redirect target#438
Conversation
Greptile SummaryThis PR fixes an open-redirect vulnerability in the magic-link auth callback where an unvalidated
Confidence Score: 5/5Safe to merge — the fix correctly closes the open-redirect vulnerability with a well-tested, defence-in-depth approach. The two-step validation (leading-slash guard followed by WHATWG URL origin comparison) handles all known redirect-bypass patterns: host-like values, absolute URLs, protocol-relative paths, backslash-normalised paths, empty strings, and null. The targeted regression suite confirms each case. No other redirect path in the file uses the user-supplied next parameter, so the blast radius is contained. No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "test(auth): cover empty magic-link redir..." | Re-trigger Greptile |
|
Addressed the two test-only gaps in |
What changed
nextvalues against the configured application origin/dashboardfor host-like, absolute, protocol-relative, and mixed-slash inputsRoot cause
The callback concatenated
NEXT_PUBLIC_APP_URLand an unvalidatednextvalue. A value such as@example.comformedhttps://ugig.net@example.com, whose effective host isexample.com.Validation
Fixes #437