fix(e2ee): skip signcrypt timestamp check for archived messages#429
Merged
Conversation
The XEP-0373 signcrypt envelope carries a <time/> element checked against a ±7-day skew window to prevent replay attacks. This check compared against Date.now() even for MAM-replayed and retried messages, causing permanent decryption failure for any message older than 7 days. On a second device that restores the key after the messages were received, retryPendingDecrypts would re-attempt decryption but always fail the timestamp check — the messages were authentically old. Add fromArchive to InboundDecryptContext, set it for archive-sourced stanzas and retry paths, and skip the skew check when set. The check remains active for live messages where replay defence matters.
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
<time/>skew check compared againstDate.now()even for MAM-replayed and retried messages, causing permanent decryption failure for any message older than 7 days.retryPendingDecryptswould always fail because the messages are authentically old.fromArchivetoInboundDecryptContext, propagated fromstanzaDecryptwhensource === 'archive'. The OpenPGP plugin skips the ±7-day skew check when this flag is set. Live messages still enforce the anti-replay window.