fix(cacao): reject expired and not-before timestamps - #415
Open
SashaMIT wants to merge 1 commit into
Open
Conversation
validateSignedCacao checked the signature only. exp and nbf were written into the CAIP-122 message, so a previously valid CACAO stayed accepted after exp and before nbf. Fail closed on past or unparseable exp and on future or unparseable nbf. Absent timestamps stay optional.
|
All contributors have signed the CTA ✍️ ✅ |
Author
|
I have read the CTA Document and I hereby sign the CTA |
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.
Description
validateSignedCacaochecked the signature only. It formattedexpandnbfinto the CAIP-122 message, then returned true for any valid signature, including afterexp, beforenbf, or when those fields were unparseable.Session authenticate in
ReownSigntreats that boolean as the gate (WalletKitandAppKitforward to the same method). Request-levelexpiryTimestampis a different field.Fail closed when
expis present and past or unparseable, and whennbfis present and future or unparseable. Absent timestamps stay optional, matching CAIP-122 / EIP-4361.Language-split of WalletConnect/walletconnect-monorepo#7312, reown-com/reown-kotlin#427, reown-com/reown-rust#109, and reown-com/reown-dotnet#322. Distinct from reown-swift#345 (CR/LF) and from #413 (EIP-55 checksum in SIWE text).
Threat-model: the attacker already holds a previously valid signed CACAO. They do not control the verifier clock or the key. After
exp(or beforenbf) the signature is still valid, andvalidateSignedCacaostill returned true. That is replay after expiry, not host or agent authority.Resolves # (issue)
How Has This Been Tested?
8/8 new window tests plus existing AuthSignature tests. Clock is injected (
now = 1700000000).flutter analyzeon the touched files is clean.Due Diligence