fix: reject inbound messages on expired sessions (WAPI-1130)#72
Open
chakra-guy wants to merge 1 commit intomainfrom
Open
fix: reject inbound messages on expired sessions (WAPI-1130)#72chakra-guy wants to merge 1 commit intomainfrom
chakra-guy wants to merge 1 commit intomainfrom
Conversation
6e3660c to
65d0d35
Compare
a117dc7 to
fd3a662
Compare
Member
|
is the confirmNonce logic meant to be in this PR? |
5c38e3b to
9827ff0
Compare
Collaborator
Author
nope, it was just originally based in top of another pr that got mixed it after a merge conflict |
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
BaseClient, closing a gap where only outbound messages were checked for expiryBackground
The Cyfrin audit identified that while
sendMessage()checks for session expiry before sending, thetransport.on("message", ...)handler did not perform any expiry check. This meant a message arriving on an expired session would still be decrypted and processed.Changes
packages/core/src/base-client.ts: UnifiedcheckSessionExpiry()method (returnsboolean, handles disconnect + error emission). Used in both the inbound message handler (early return) andsendMessage(throws after check).packages/core/src/base-client.integration.test.ts: New test case for expired session message rejectionapps/integration-tests/src/end-to-end.integration.test.ts: New E2E test verifying messages sent to an expired receiver are dropped and trigger SESSION_EXPIREDTest plan
yarn buildpassesyarn test:unitpasses (63/63 tests)yarn lintpasses (no new warnings)Note
Medium Risk
Touches core message-handling and session lifecycle behavior; an incorrect expiry check or disconnect side effect could drop legitimate traffic or cause unexpected disconnects.
Overview
Expired sessions now block inbound traffic.
BaseClientadds a session-expiry gate in the transport message handler so messages arriving afterexpiresAtare rejected, aSESSION_EXPIREDerror is emitted, and cleanup/disconnect is triggered.checkSessionExpiry()is refactored to return a boolean and is reused by both inbound and outbound paths, with new integration/E2E tests asserting that post-expiry messages are not delivered. Dependency housekeeping pinseciesjsto0.4.17across apps/core (and updatesyarn.lock) and records the fix in the core changelog.Written by Cursor Bugbot for commit 9827ff0. This will update automatically on new commits. Configure here.