Skip to content

[Security] Make realtime invalidations opaque and session-bound - #72

Draft
patrickschiller wants to merge 1 commit into
codex/security-auth-hardeningfrom
codex/security-realtime-boundary
Draft

patrickschiller wants to merge 1 commit into
codex/security-auth-hardeningfrom
codex/security-realtime-boundary

Conversation

@patrickschiller

Copy link
Copy Markdown
Owner

Summary\n\n- Emit realtime messages as opaque cache invalidations with no business payload.\n- Revalidate server-side login sessions before every broadcast.\n- Disconnect sockets whose employee, installation, token, or session state is no longer valid.\n\n## Linked issue\n\nDepends on #71. Implements the realtime metadata finding from Codex Security scan 38b23c4d-51a7-4e1e-b83f-33007bd0f77b.\n\n## Changes\n\n- Keep event payloads server-side only for Solo recipient filtering.\n- Track the JWT session family on each authorized socket.\n- Recheck active AuthSession records during broadcasts.\n- Add regression coverage for payload opacity and revoked-session disconnects.\n\n## How was this tested?\n\n- Nx API and api-e2e typechecks passed.\n- Nx API and api-e2e lint passed with only existing warnings.\n- Focused realtime E2E suite passed: 7 tests.\n- All 34 migrations applied to a fresh PostgreSQL 16 database.\n- Nx format check and git diff check passed.\n\n## Release notes\n\n- Security: Realtime events no longer expose entity metadata and revoked sessions are disconnected.\n\n## Upgrade impact\n\n- Database migration: Provided by dependency #71.\n- Breaking change: Event payloads are intentionally removed; the supported web client already treats events as cache invalidations.\n- Manual operator action: Merge #71 before this PR.\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.

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