Skip to content

fix(Siwe): assume https in validateMessage when the message omits scheme - #712

Merged
jxom merged 3 commits into
wevm:mainfrom
HereForTheTechNFT:fix/siwe-default-scheme
Nov 20, 2026
Merged

jxom merged 3 commits into
wevm:mainfrom
HereForTheTechNFT:fix/siwe-default-scheme

Conversation

@HereForTheTechNFT

Copy link
Copy Markdown
Contributor

Port of wevm/viem#5621, as suggested by @erkancamli in that PR.

EIP-4361 says that when scheme is not specified, HTTPS is assumed. Siwe.parseMessage returns scheme: undefined for a message without a scheme prefix, so Siwe.validateMessage({ message, scheme: 'https' }) returned false for it (message.scheme !== scheme). The check now uses message.scheme ?? 'https'. The JSDoc of the scheme option mentions the default, and a patch changeset is included.

Test
New case in src/core/_test/Siwe.test.ts: a message without scheme validates against 'https' and not against 'http'. It fails on main 2d43a3a and passes with the fix. All 140 tests in Siwe.test.ts pass. I ran that file with a minimal vitest config (the core project's global setup starts an anvil instance, which my sandbox can't bind). vp lint is clean. vp fmt --check only flags lines that are already unformatted on main in Siwe.test.ts, not the new ones.

If you want it on 0.x as well, I can open the backport.

🤖 Generated with Claude Code

https://claude.ai/code/session_014cRzwuyJe8BGwXowsQ3kpw

@vercel

vercel Bot commented Nov 20, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

jxom added a commit that referenced this pull request Nov 20, 2026
#713)

* fix(Siwe): assume https in validateMessage when the message omits scheme

Same fix as wevm/viem#5621 for validateSiweMessage.

Co-authored-by: Claude <[email protected]>
Co-authored-by: jxom <[email protected]>

* test(Siwe): cover the default https scheme in validateMessage

Co-authored-by: Claude <[email protected]>
Co-authored-by: jxom <[email protected]>

* chore: add changeset for the Siwe default scheme fix

Co-authored-by: Claude <[email protected]>
Co-authored-by: jxom <[email protected]>

---------

Co-authored-by: forthetech.eth <[email protected]>
Co-authored-by: Claude <[email protected]>
Co-authored-by: jxom <[email protected]>
@jxom
jxom merged commit a1641a2 into wevm:main Nov 20, 2026
10 of 11 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 20, 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