Repository navigation
[Security] Make realtime invalidations opaque and session-bound - #72
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- 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.