Skip to content

fix(auth): add missing colon to Resources line in SIWS message - #2790

Open
NgoQuocViet2001 wants to merge 2 commits into
supabase:masterfrom
NgoQuocViet2001:fix-siws-resources-colon
Open

NgoQuocViet2001 wants to merge 2 commits into
supabase:masterfrom
NgoQuocViet2001:fix-siws-resources-colon

Conversation

@NgoQuocViet2001

@NgoQuocViet2001 NgoQuocViet2001 commented Oct 24, 2026 •

Copy link
Copy Markdown

🔍 Description

What changed?

signInWithWeb3({ chain: 'solana' }) builds the Sign-In-With-Solana message itself when the wallet has signMessage() but no signIn(). When options.signInWithSolana.resources is set, the list header was written as Resources without a colon. This writes Resources: and adds a regression test for the generated message.

Why was this change needed?

The Auth server's SIWS parser only starts the resource list on a line that is exactly Resources: and reads every other line as key: value. The bare Resources line makes siws.ParseMessage fail with siws: encountered unparsable line at index 6, which the web3 grant returns as 400 validation_failed, so these sign-ins cannot succeed. The SIWS format and the Ethereum builder in this package already use Resources:.

📸 Screenshots/Examples

 Issued At: 2026-10-24T16:35:08.407Z
-Resources
+Resources:
 - https://example.com/tos

🔄 Breaking changes

  • This PR contains no breaking changes

📋 Checklist

  • I have read the Contributing Guidelines
  • My PR title follows the conventional commit format: <type>(<scope>): <description>
  • I have run pnpm nx format to ensure consistent code formatting
  • I have added tests for new functionality (if applicable)
  • I have updated documentation (if applicable)

📝 Additional notes

  • Ran: npx jest --config jest.config.cli.js test/GoTrueClient.web3.test.ts asserts the whole generated message; it fails on master (- Resources: / + Resources) and passes with the fix.
  • Ran: the auth-js jest suites that do not need the local Supabase stack pass (19 suites, 274 tests).
  • Ran: tsc --noEmit with tsconfig.json, tsconfig.module.json and tsconfig.test.json is clean; prettier --check is clean on both changed files.
  • Checked: the message generated on master fails siws.ParseMessage from supabase/auth master as above; the fixed message parses with both resources.

@NgoQuocViet2001
NgoQuocViet2001 requested review from a team as code owners October 24, 2026 16:46
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c57cf6e9-a3c9-418a-a841-c0bde8d52aee
Commits

Reviewing files that changed from the base of the PR and between 5b19372 and 4d3774f.

Files selected for processing: 1
  • packages/core/auth-js/test/GoTrueClient.web3.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Solana sign-in messages now label the resource list with Resources: before listing the configured terms-of-service and privacy links.

The Solana sign-in message now uses Resources: as the resource-list label. A test checks that the generated message includes this label and the configured terms-of-service and privacy URLs as list items.

Priority: Normal

Change: Bug fix

Merge Risk: Minimal · up to 4d377

The SIWS resource-label fix is covered by the regression test and has no remaining actionable merge risk.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cmelchior cmelchior self-assigned this Oct 26, 2026

@cmelchior cmelchior left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @NgoQuocViet2001, thank you for the PR 💚

This does look like a real bug. I only a small comment about the way the test is written. Once addressed, this PR can be merged.

@pkg-pr-new

pkg-pr-new Bot commented Oct 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@supabase/auth-js

npm i https://pkg.pr.new/@supabase/auth-js@2790

@supabase/functions-js

npm i https://pkg.pr.new/@supabase/functions-js@2790

@supabase/postgrest-js

npm i https://pkg.pr.new/@supabase/postgrest-js@2790

@supabase/realtime-js

npm i https://pkg.pr.new/@supabase/realtime-js@2790

@supabase/storage-js

npm i https://pkg.pr.new/@supabase/storage-js@2790

@supabase/supabase-js

npm i https://pkg.pr.new/@supabase/supabase-js@2790

commit: 5b19372

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 75.008% (-7.3%) from 82.263% — NgoQuocViet2001:fix-siws-resources-colon into supabase:master

This branch has not been deployed

No deployments
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