Skip to content

fix(cacao): reject CR/LF in all SIWE single-line fields - #280

Open
SashaMIT wants to merge 2 commits into
WalletConnect:masterfrom
SashaMIT:fix/cacao-reject-statement-linebreaks
Open

fix(cacao): reject CR/LF in all SIWE single-line fields#280
SashaMIT wants to merge 2 commits into
WalletConnect:masterfrom
SashaMIT:fix/cacao-reject-statement-linebreaks

Conversation

@SashaMIT

@SashaMIT SashaMIT commented Aug 9, 2026

Copy link
Copy Markdown

Summary

formatMessage previously only rejected line breaks in statement. Caller-supplied domain, aud, version, nonce, iat (and optional exp / nbf / requestId) could still embed \r/\n and forge later EIP-4361 fields (for example a smuggled URI: line).

This extends the same single-line reject to those fields. Parity with @walletconnect/utils formatMessage in walletconnect-monorepo (#7311).

Test plan

  • formatMessage.test.ts covers statement, domain, aud, nonce (6/6 with TEST_PROJECT_ID stub for suite load)

Parity with @walletconnect/utils: embedded CR/LF in statement can forge
later EIP-4361 fields (URI, Nonce) in the reconstructed signed message.
@github-actions

github-actions Bot commented Aug 9, 2026

Copy link
Copy Markdown

All contributors have signed the CTA ✍️ ✅
Posted by the CLA Assistant Lite bot.

Extend formatMessage beyond statement so domain, aud, version, nonce,
iat (and optional exp/nbf/requestId) cannot smuggle EIP-4361 lines.
Parity with walletconnect-monorepo formatMessage.
@SashaMIT SashaMIT changed the title fix(cacao): reject SIWE statement line breaks in formatMessage fix(cacao): reject CR/LF in all SIWE single-line fields Aug 11, 2026
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