-
Notifications
You must be signed in to change notification settings - Fork 515
Description
Bug report
- I confirm this is a bug with Supabase, not with my own application.
- I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Preface: I am writing as representative of Star Atlas (where I'm currently employed). We are the top gaming project of Solana ecosystem and have millions of transactions across tens of thousands of players. This fix is a critical feature for us.
Supabase implements the SIWS process in a slightly deprecated and incorrect way. This is a perfect storm of procrastination on behalf of some of the maintainers of Ledger, Solana Validator and others. Let me explain.
It looks like supabase/auth
went with the Phantom spec for SIWS. This was the de-facto standard for months or maybe a few years, but it had one flaw. It did not work with Ledger devices. This is because Ledger did not implement any form of arbitrary offchain message signing up until a few weeks ago. They implemented it correctly according to a 2023 Solana accepted and merged proposal. The lack of this functionality on Ledger is probably what caused the de-facto Phantom implementation to drift away from the actual spec.
The "proper" implementation of off-chain signing includes some extra header fields like a version, a mandatory preamble, and a few other details. It is physically impossible to sign a message without including those. And when the signature is generated it is generated for the entirety of the payload, including the header with the version, preamble e.t.c
supabase/auth
is currently only verifying the signature on the message itself, not implementing anything for the above spec, which makes any attempt to use Ledger to sign in with Solana fail.
The suggested correct behavior (keeping in mind that we don't want to break current usage) would be to try to verify BOTH the incorrect version without the header as well as the correct version with the header, version, preamble e.t.c (which are easily derivable from the message).
To Reproduce
Try to sign the message that needs to be sent to supabase/auth
with a Ledger device.
Expected behavior
supabase/auth
should be able to verify such a message.
System information
- OS: All
- Browser: All
- Version of supabase-js: latest
- Version of Node.js: All