Open
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
…ryption (WAPI-1121) Nonces are no longer persisted immediately on message receipt. Instead, a confirmNonce callback is emitted with each message and called by BaseClient only after successful decryption. This prevents attackers from poisoning the nonce tracker with high-nonce messages that fail decryption, which would permanently block legitimate messages. Also adds MAX_NONCE_JUMP (100) to reject suspiciously large nonce jumps, NaN recovery in nonce storage, and a mutex around confirmNonce to prevent race conditions.
0137247 to
6b2d671
Compare
Tests now call confirmNonce() after receiving messages so nonces are persisted to storage, matching the new two-phase nonce confirmation flow introduced by the nonce poisoning fix.
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
Prevents nonce poisoning attacks by deferring nonce persistence until after successful decryption. Previously, nonces were saved immediately on message receipt, allowing an attacker to send high-nonce messages that fail decryption but permanently block legitimate messages.
BaseClientMAX_NONCE_JUMP(100) to reject suspiciously large nonce jumps from known sendersNaNrecovery in nonce storageconfirmNonceto prevent concurrent race conditionsJira
Test plan
confirmNonce, NaN recovery, nonce regression preventionNote
Medium Risk
Touches transport-level deduplication and message acceptance rules; incorrect confirmation usage or overly strict nonce-jump thresholds could cause dropped or stuck messages in edge cases.
Overview
Prevents nonce poisoning by changing WebSocket incoming-message handling to defer nonce persistence until after a message is successfully decrypted:
WebSocketTransportnow emitsmessageevents with an optionalconfirmNonce()callback, andBaseClientcalls it only on successful decrypt.Adds additional nonce safety: rejects suspiciously large nonce jumps from known senders (
MAX_NONCE_JUMP), tracks in-memorypendingNoncesto avoid double-processing before confirmation (e.g., live + history), clears pending state onclear(), and hardens outbound nonce storage againstNaN. Includes newWebSocketTransportStorage.confirmNonce()(mutex-protected) plus updated/added unit + integration tests and a newasync-mutexdependency.Written by Cursor Bugbot for commit 1b67420. This will update automatically on new commits. Configure here.