Skip to content

fix(e2ee): skip signcrypt timestamp check for archived messages#429

Merged
mremond merged 1 commit into
mainfrom
fix/e2ee-archive-timestamp-skew
Jun 1, 2026
Merged

fix(e2ee): skip signcrypt timestamp check for archived messages#429
mremond merged 1 commit into
mainfrom
fix/e2ee-archive-timestamp-skew

Conversation

@mremond
Copy link
Copy Markdown
Member

@mremond mremond commented Jun 1, 2026

Summary

  • The XEP-0373 signcrypt <time/> skew 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 original messages were received, retryPendingDecrypts would always fail because the messages are authentically old.
  • Adds fromArchive to InboundDecryptContext, propagated from stanzaDecrypt when source === 'archive'. The OpenPGP plugin skips the ±7-day skew check when this flag is set. Live messages still enforce the anti-replay window.

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.
@mremond mremond merged commit cca3269 into main Jun 1, 2026
2 checks passed
@mremond mremond deleted the fix/e2ee-archive-timestamp-skew branch June 1, 2026 13:51
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