Skip to content

fix: reject line breaks in SIWE statements - #5608

Closed
gomesalexandre wants to merge 2 commits into
wevm:mainfrom
gomesalexandre:fix/parse-siwe-statement-line-breaks
Closed

gomesalexandre wants to merge 2 commits into
wevm:mainfrom
gomesalexandre:fix/parse-siwe-statement-line-breaks

Conversation

@gomesalexandre

Copy link
Copy Markdown
Contributor

parseSiweMessage took the statement with a greedy group that stops at CR, LF, U+2028, and U+2029. A statement of foo, then one of those characters, then URI: https://evil.example still returned the real domain, address, URI, version, chain id, nonce, and issued-at, and omitted the statement. The parsed message no longer matches the signed text. This is the same class as ox #699.

The statement section between the address blank line and the URI blank line is now rejected when it contains one of those characters. An empty statement is unchanged, because that section has length 0.

On main the new test expected {} and got the parsed suffix fields. On this branch that test passes.

gomesalexandre and others added 2 commits November 19, 2026 19:32
Reject CR, LF, U+2028, and U+2029 in the statement so parseSiweMessage
cannot return suffix fields when a line terminator splits the statement.

Co-authored-by: Cursor <[email protected]>
@vercel

vercel Bot commented Nov 19, 2026

Copy link
Copy Markdown

@gomesalexandre is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7ecd7aa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

jxom commented Nov 19, 2026

Copy link
Copy Markdown
Member

Thanks @gomesalexandre! This is continued in #5609, which keeps your commits and also rejects a statement line break followed by a single LF before the suffix, plus the same characters in createSiweMessage.

@jxom jxom closed this Nov 19, 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.

2 participants