Repository navigation
fix(auth): give every JWT a unique jti so same-second sessions don't collide - #491
Merged
Merged
Conversation
…collide
Access tokens were signed with { _id } only, so two issued for one candidate in the same second were byte-identical and logging out one session blacklisted the other.
- src/utils/jwt.ts: jwtSign sets jwtid: crypto.randomUUID() on every token (access and refresh)
- src/auth/auth.service.ts, src/auth/auth.controller.ts: drop the hand-built refresh jti (jsonwebtoken rejects payload jti + jwtid) and the now-unused crypto import
- tests: new src/__tests__/utils/jwt.test.ts; integration test for two same-second logins where logout of one leaves the other at 200; caller unit tests and refreshTokenReuse helper adjusted
- .claude/rules/api.md: auth flow payload now { _id, jti }
- agent-hub: ship note for auth-http-integration-tests
npm test: Test Suites: 75 passed, 75 total / Tests: 792 passed, 792 total
npm run build: exit 0 (tsc exit 0); lint 273 problems (<= 274 baseline), none new in changed files
Node: fix-access-token-jti (SEALED)
Evidence: agent-hub/evidence/verifier/2026-11-18/fix-access-token-jti-seal.md
Closes #490
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
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.
df91bcc fix(auth): give every JWT a unique jti so same-second sessions don't collide
Closes #490