Repository navigation
fix(auth): add missing colon to Resources line in SIWS message - #2790
NgoQuocViet2001 wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review.
|
cmelchior
left a comment
There was a problem hiding this comment.
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.
@supabase/auth-js
@supabase/functions-js
@supabase/postgrest-js
@supabase/realtime-js
@supabase/storage-js
@supabase/supabase-js
commit: |
🔍 Description
What changed?
signInWithWeb3({ chain: 'solana' })builds the Sign-In-With-Solana message itself when the wallet hassignMessage()but nosignIn(). Whenoptions.signInWithSolana.resourcesis set, the list header was written asResourceswithout a colon. This writesResources: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 askey: value. The bareResourcesline makessiws.ParseMessagefail withsiws: encountered unparsable line at index 6, which the web3 grant returns as 400validation_failed, so these sign-ins cannot succeed. The SIWS format and the Ethereum builder in this package already useResources:.📸 Screenshots/Examples
🔄 Breaking changes
📋 Checklist
<type>(<scope>): <description>pnpm nx formatto ensure consistent code formatting📝 Additional notes
npx jest --config jest.config.cli.js test/GoTrueClient.web3.test.tsasserts the whole generated message; it fails on master (- Resources:/+ Resources) and passes with the fix.tsc --noEmitwith tsconfig.json, tsconfig.module.json and tsconfig.test.json is clean;prettier --checkis clean on both changed files.siws.ParseMessagefrom supabase/auth master as above; the fixed message parses with both resources.