mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 01:39:44 +01:00
Fix EIP-712 input validation order (#17156)
This commit is contained in:
parent
00aee11c2a
commit
7b852c3ff2
@ -197,10 +197,6 @@ export default class TypedMessageManager extends EventEmitter {
|
||||
data = JSON.parse(params.data);
|
||||
}, '"data" must be a valid JSON string.');
|
||||
const validation = jsonschema.validate(data, TYPED_MESSAGE_SCHEMA);
|
||||
assert.ok(
|
||||
data.primaryType in data.types,
|
||||
`Primary type of "${data.primaryType}" has no type definition.`,
|
||||
);
|
||||
if (validation.errors.length !== 0) {
|
||||
throw ethErrors.rpc.invalidParams({
|
||||
message:
|
||||
@ -208,6 +204,10 @@ export default class TypedMessageManager extends EventEmitter {
|
||||
data: validation.errors.map((v) => v.message.toString()),
|
||||
});
|
||||
}
|
||||
assert.ok(
|
||||
data.primaryType in data.types,
|
||||
`Primary type of "${data.primaryType}" has no type definition.`,
|
||||
);
|
||||
let { chainId } = data.domain;
|
||||
if (chainId) {
|
||||
const activeChainId = parseInt(this._getCurrentChainId(), 16);
|
||||
|
Loading…
Reference in New Issue
Block a user