Repository navigation
Security: refuse a two-factor challenge as a session - #62
Merged
Merged
Conversation
Notes returns a five-minute challenge token after the password step of a 2FA sign-in, signed with the shared JWT secret and carrying the person's sub. It was accepted here as a session, so a password alone got past the second factor. It now answers 401. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01V1geD2ELWgL2sDpxYbx3Aw
davior
marked this pull request as ready for review
November 4, 2026 18:44
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
A 2FA bypass, live in production. When someone with two-factor on signs in to Notes, the password step returns a five-minute challenge token for the second step. It is signed with the shared
JWT_SECRET_KEYand carries the person'ssub. GAM'scurrent_userchecks signature, expiry and subject, but not thetwofa_pendingclaim, so the challenge was accepted as a full session: the password alone opened GAM, as a bearer header or as thegecko_sessioncookie.current_usernow refuses any token withtwofa_pending(401unauthorized, "This sign-in still needs its second step"). Normal sessions are unaffected; they never carry the claim.Found while porting sign-in to the suite (M6). The same gap is in Notes itself, GVC and the suite, each fixed in its own PR.
Test plan
test_a_two_factor_challenge_is_not_a_session: a challenge-shaped token is refused both as a bearer header and as the cookie.pytest -q: 1544 passed.Deployment
docker compose up --build -d). No configuration, no migrations.curl -f http://localhost:${APP_PORT}/api/health; signing in through Notes still reaches GAM as before.Generated by Claude Code