fix: typed data with a missing field or a bool that is not true or false is refused (closes #552)
ethers signs a bool field by whether its value is truthy, so the string "false" was shown as false and signed as true, and a bool field left out was shown as nothing and signed as false. The sign screen now refuses typed data whose message leaves out a declared field, at any level of nesting, or holds a bool that is not true or false: the error line names the field and Sign is disabled. The background refuses a signature for it too. Presence is an own-key test, so a field named like a built-in property such as constructor is not found by accident. signedPrimaryType() moves to the shared module so the background reads the message as the same type. Model: opus-5-5
This commit is contained in:
@@ -2182,6 +2182,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 message leaves out a field its type declares, at any
|
||||
level of nesting, or gives a `bool` field a value other than `true` or
|
||||
`false` → shown with the error line naming the field and "Sign" disabled;
|
||||
only "Reject" remains. ethers signs a `bool` by whether its value is
|
||||
truthy, so the string `"false"` would be signed as true and a field left
|
||||
out as false. The background refuses such a signature too and answers the
|
||||
site with the same sentence
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user