Conversation
|
@osr21 is attempting to deploy a commit to the Coinbase Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In
pages/api/verify-token.ts, derive the airdrop wallet address from the parsed SIWEaddressfield instead of a loose regex over the raw message.Why
The previous code extracted the recipient with
message.match(/0x[a-fA-F0-9]{40}/), which returns the first 0x-prefixed 40-hex string anywhere in the message. The record written to the database should be the account the signature is cryptographically bound to — i.e. the SIWEaddressfield — not whatever hex string happens to appear first in the text.In a well-formed EIP-4361 message the
addressis line 2, so today the two usually coincide, but relying on positional regex is brittle: any future change to the statement/resources ordering, or a non-standard message shape, could bind the airdrop record to an unintended address. Parsing the field the signature actually attests to removes that ambiguity.Notes
siweis already a dependency; no new packages.SiweMessage(...).addressis EIP-55 checksummed, matching what the frontend generates, so existing records/flows are unaffected.400 Could not parse SIWE message) and anisAddress()sanity check.