Repository navigation
[Security] Add revocable sessions and login throttling - #71
Draft
patrickschiller wants to merge 1 commit into
Draft
patrickschiller wants to merge 1 commit into
patrickschiller wants to merge 1 commit into
Conversation
Signed-off-by: Patrick Schiller <[email protected]>
This branch has not been deployed
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\n\n- Add server-side refresh-session families with atomic rotation, replay detection, and logout revocation.\n- Add durable account and source login-attempt limits with uniform credential failures.\n- Coordinate browser refresh rotation across tabs without crossing user identities.\n\n## Linked issue\n\nNone. Implements findings from Codex Security scan 38b23c4d-51a7-4e1e-b83f-33007bd0f77b.\n\n## Changes\n\n- Store only current refresh-token hashes and revoke sessions on replay, logout, or password change.\n- Validate new access tokens against active server sessions while retaining temporary legacy access-token compatibility.\n- Add shared PostgreSQL-backed login attempt windows and Retry-After responses.\n- Add best-effort server logout and Web Lock based cross-tab refresh coordination.\n- Regenerate OpenAPI and the web API client.\n- Add Prisma migration 20261205120000_auth_sessions_and_login_limits.\n\n## How was this tested?\n\n- Nx typechecks and lint passed for api, api-e2e, and web.\n- Auth and refresh E2E suites passed: 18 tests.\n- Focused web suites passed: 8 tests.\n- All 34 migrations applied to a fresh PostgreSQL database.\n- API and web builds, format check, and git diff check passed.\n\n## Release notes\n\n- Security: Add revocable refresh sessions, replay protection, logout revocation, and login throttling.\n\n## Upgrade impact\n\n- Database migration: 20261205120000_auth_sessions_and_login_limits.\n- Breaking change: Existing pre-deployment refresh tokens cannot rotate; affected users may need to sign in again after their current access token expires.\n- Manual operator action: Apply Prisma migrations during deployment.\n\n## Checklist\n\n- [x] All commits are signed off with git commit -s.\n- [x] Lint, typecheck, and relevant tests pass locally.\n- [x] New behaviour is covered by tests where appropriate.\n- [x] Release notes and upgrade impact are documented above.\n- [x] Existing Prisma migrations were not edited.\n- [x] No domain rules from base-instructions.md were changed.\n- [x] No new third-party dependencies were added.