fix: typed data for another chain cannot be signed (closes #519)
EIP-712 has a wallet refuse typed data whose domain chainId is not the active chain, because the signature is valid on the chain it names. The sign screen now shows such a request with the reason on its error line and Sign disabled, the same way it refuses a mismatched primary type. The background checks again when the signature comes back, against the network active then, and answers the site with that refusal instead of the signature. A chain id is read as ethers signs it, so 1, "1" and "0x1" are one chain. Typed data with no chainId signs as before. Model: opus-5-5
This commit was merged in pull request #544.
This commit is contained in:
@@ -2160,6 +2160,13 @@ view would leave a wallet one click from deletion.
|
||||
- Typed data that states no primary type, or one other than the type it
|
||||
would be signed as, or that cannot be read → shown with the error line
|
||||
saying so and "Sign" disabled; only "Reject" remains
|
||||
- Typed data whose domain `chainId` names a chain other than the active
|
||||
network's → shown with the error line naming both chain ids and "Sign"
|
||||
disabled; only "Reject" remains. EIP-712 asks for this, because the
|
||||
signature is valid on the chain the domain names. Typed data with no
|
||||
`chainId` is not refused. The background refuses such a signature too,
|
||||
against the network active when the signature reaches it, and answers the
|
||||
site with the same sentence
|
||||
- A `personal_sign` or `eth_sign` message that is not hex (`0x` or `0X` and
|
||||
an even number of hex digits, the form ethers' `getBytes` reads when
|
||||
signing) → shown as plain text, with the error line "This message is plain
|
||||
|
||||
Reference in New Issue
Block a user