Skip to content

[Security] Add revocable sessions and login throttling - #71

Draft
patrickschiller wants to merge 1 commit into
mainfrom
codex/security-auth-hardening
Draft

patrickschiller wants to merge 1 commit into
mainfrom
codex/security-auth-hardening

Conversation

@patrickschiller

Copy link
Copy Markdown
Owner

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.

Signed-off-by: Patrick Schiller <p@trickschiller.de>

This branch has not been deployed

No deployments
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