Skip to content

Preserve nonce through login page; allow GET on end_session_endpoint#77

Merged
eswan18 merged 1 commit into
mainfrom
fix/login-nonce-and-logout-get
Apr 17, 2026
Merged

Preserve nonce through login page; allow GET on end_session_endpoint#77
eswan18 merged 1 commit into
mainfrom
fix/login-nonce-and-logout-get

Conversation

@eswan18
Copy link
Copy Markdown
Owner

@eswan18 eswan18 commented Apr 17, 2026

Summary

  • Nonce bug (the main one): HandleLoginGet wasn't reading nonce from the query string, so when an unauthenticated user was redirected from /oauth/authorize/oauth/login the rendered hidden input was empty. The form POST submitted an empty nonce, the ID token was issued without the nonce claim (due to omitempty), and authlib-based clients (e.g. asset_manager) rejected the token for failing nonce validation. Consent and MFA flows already preserved nonce — HandleLoginGet was the lone outlier.
  • Logout GET: /oauth/logout is advertised as end_session_endpoint in OIDC discovery, but was registered as POST-only. Added GET so browser redirects per OIDC RP-Initiated Logout 1.0 actually work.

Test plan

  • go test ./... passes
  • New TestLoginGetPreservesNonce asserts the login form renders the nonce from the query string
  • New TestIDTokenIncludesNonceThroughBrowserFlow walks the full browser flow (authorize → login GET → login POST → authorize → consent → token) and verifies the nonce appears in the issued ID token
  • New TestLogoutAcceptsGET verifies GET on /oauth/logout returns 302 instead of 404/405
  • Manually verify asset_manager login works end-to-end against staging after merge

🤖 Generated with Claude Code

HandleLoginGet was not reading the nonce from the query string, so when an
unauthenticated user was redirected from /oauth/authorize to the login form
the rendered hidden input was empty. The POST then submitted an empty nonce,
the resulting ID token had no nonce claim, and clients like authlib rejected
the token for failing nonce validation. Consent and MFA already preserved
nonce correctly — HandleLoginGet was the lone outlier.

Also register GET on /oauth/logout so the endpoint advertised as
end_session_endpoint in the OIDC discovery document works when browsers
navigate to it via redirect, per OIDC RP-Initiated Logout 1.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@eswan18 eswan18 merged commit 7d970bb into main Apr 17, 2026
1 check passed
@eswan18 eswan18 deleted the fix/login-nonce-and-logout-get branch April 17, 2026 14:11
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.

1 participant