Skip to content

Harden OIDC callback redirect handoff against open redirects - #12

Merged
wechuli merged 2 commits into
mainfrom
copilot/fix-code-scanning-alerts
Sep 18, 2026
Merged

wechuli merged 2 commits into
mainfrom
copilot/fix-code-scanning-alerts

Conversation

Copilot AI commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

The OIDC callback flow could preserve an absolute external next URL at the final handoff step, creating an open-redirect sink after successful authentication. This change re-validates the stored redirect target at the redirect sink and adds a regression test for hostile absolute URLs.

  • Redirect sink hardening

    • Re-sanitize transaction.next inside the callback handoff before constructing the final destination URL.
    • Ensures absolute external URLs cannot bypass earlier validation if untrusted state reaches the sink.
    const destination = new URL(safeRelativePath(next), appOrigin).toString();
  • Regression coverage

    • Add a focused unit test for a stored redirect target like https://evil.example.test/phish.
    • Verifies the handoff falls back to a same-origin path instead of preserving the attacker-controlled origin.

Co-authored-by: wechuli <15605874+wechuli@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix code scanning alert(s) flagged in repository Harden OIDC callback redirect handoff against open redirects Sep 18, 2026
Copilot AI requested a review from wechuli September 18, 2026 10:02
@wechuli
wechuli marked this pull request as ready for review September 18, 2026 10:03
@wechuli
wechuli merged commit b36680f into main Sep 18, 2026
3 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.

2 participants