Skip to content

fix(siwe): assume https when the message omits scheme - #5621

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

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

Conversation

@HereForTheTechNFT

Copy link
Copy Markdown
Contributor

EIP-4361 says: "If scheme is not specified, HTTPS is assumed by default." validateSiweMessage compared message.scheme directly, so a message without a scheme failed validation against { scheme: 'https' }. verifySiweMessage passes scheme through, so it had the same issue.

The check now treats a missing scheme as https:

if (scheme && (message.scheme ?? 'https') !== scheme) return false

A message without a scheme still fails against { scheme: 'http' }, and nothing changes when no scheme is passed.

  • Test: behavior: scheme defaults to https when omitted in validateSiweMessage.test.ts. It fails without the fix.
  • Docs: one sentence on the scheme parameter.
  • Changeset: patch.

vitest run src/utils/siwe: 93 tests pass. biome check is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_014cRzwuyJe8BGwXowsQ3kpw

HereForTheTechNFT and others added 4 commits November 20, 2026 05:21
EIP-4361: if `scheme` is not specified, HTTPS is assumed by default.

Co-authored-by: Claude <[email protected]>
@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24960f5

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

@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.

@erkancamli

Copy link
Copy Markdown
Contributor

Checked this against parseSiweMessage output on 24960f5: a message without a scheme prefix now validates against scheme: 'https' and not against 'http'; on main it failed both.

Two things outside the diff:

  • ox has the identical line in Siwe.validateMessage (src/core/Siwe.ts:535 on 2d43a3a), and Siwe.parseMessage also returns scheme: undefined for the same message, so validateMessage({ message, scheme: 'https' }) still returns false there. Since the viem siwe utilities mirror ox's, it may be worth porting.
  • The comparison is still case-sensitive: HTTPS://example.com wants you to sign in … parses to scheme: 'HTTPS' and fails scheme: 'https', although RFC 3986 §3.1 treats schemes as case-insensitive. That is not introduced here, so only if you want it in the same change.

@HereForTheTechNFT

Copy link
Copy Markdown
Contributor Author

Thanks for checking it against the parser output, @erkancamli.

  • ox: good catch, same line and same result. I ported the fix, test and changeset in fix(Siwe): assume https in validateMessage when the message omits scheme ox#712.
  • Case sensitivity: agreed that RFC 3986 makes schemes case-insensitive. It isn't introduced here and changes behaviour for existing callers, so I'd rather keep this PR to the EIP-4361 default. I'm happy to follow up with a separate change (comparing lowercased schemes in both viem and ox) if the maintainers want it.

🤖 Generated with Claude Code

@jxom
jxom merged commit 8a96a99 into wevm:main Nov 20, 2026
28 of 35 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
jxom added a commit to wevm/ox 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 pushed a commit to wevm/ox that referenced this pull request Nov 20, 2026
…eme (#712)

* 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]>

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

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

* chore: add changeset for the Siwe default scheme fix

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

---------

Co-authored-by: Claude <[email protected]>
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.

3 participants