mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-22 17:33:23 +01:00
Use SIWE origin validation logic from @metamask/controller-utils (#18518)
* feat: use SIWE origin domain validation from @metamask/controller-utils * deps: @metamask/controller-utils@3.2.0->3.3.0
This commit is contained in:
parent
a827c444fb
commit
64d4bfbbe9
@ -750,6 +750,7 @@
|
||||
},
|
||||
"@metamask/controller-utils": {
|
||||
"globals": {
|
||||
"URL": true,
|
||||
"console.error": true,
|
||||
"fetch": true,
|
||||
"setTimeout": true
|
||||
|
@ -750,6 +750,7 @@
|
||||
},
|
||||
"@metamask/controller-utils": {
|
||||
"globals": {
|
||||
"URL": true,
|
||||
"console.error": true,
|
||||
"fetch": true,
|
||||
"setTimeout": true
|
||||
|
@ -750,6 +750,7 @@
|
||||
},
|
||||
"@metamask/controller-utils": {
|
||||
"globals": {
|
||||
"URL": true,
|
||||
"console.error": true,
|
||||
"fetch": true,
|
||||
"setTimeout": true
|
||||
|
@ -750,6 +750,7 @@
|
||||
},
|
||||
"@metamask/controller-utils": {
|
||||
"globals": {
|
||||
"URL": true,
|
||||
"console.error": true,
|
||||
"fetch": true,
|
||||
"setTimeout": true
|
||||
|
@ -232,7 +232,7 @@
|
||||
"@metamask/assets-controllers": "^6.0.0",
|
||||
"@metamask/base-controller": "^2.0.0",
|
||||
"@metamask/contract-metadata": "^2.3.1",
|
||||
"@metamask/controller-utils": "^3.2.0",
|
||||
"@metamask/controller-utils": "^3.3.0",
|
||||
"@metamask/design-tokens": "^1.9.0",
|
||||
"@metamask/desktop": "^0.3.0",
|
||||
"@metamask/eth-json-rpc-infura": "^8.0.0",
|
||||
|
@ -2,6 +2,7 @@ import React, { useCallback, useContext, useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { useSelector } from 'react-redux';
|
||||
import log from 'loglevel';
|
||||
import { isValidSIWEOrigin } from '@metamask/controller-utils';
|
||||
import { BannerAlert, Text } from '../../component-library';
|
||||
import Popover from '../../ui/popover';
|
||||
import Checkbox from '../../ui/check-box';
|
||||
@ -51,17 +52,7 @@ export default function SignatureRequestSIWE({
|
||||
const isMatchingAddress =
|
||||
from.toLowerCase() === parsedMessage.address.toLowerCase();
|
||||
|
||||
const checkSIWEDomain = () => {
|
||||
let isSIWEDomainValid = false;
|
||||
|
||||
if (origin) {
|
||||
const { host } = new URL(origin);
|
||||
isSIWEDomainValid = parsedMessage.domain === host;
|
||||
}
|
||||
return isSIWEDomainValid;
|
||||
};
|
||||
|
||||
const isSIWEDomainValid = checkSIWEDomain();
|
||||
const isSIWEDomainValid = isValidSIWEOrigin(txData.msgParams);
|
||||
|
||||
const [isShowingDomainWarning, setIsShowingDomainWarning] = useState(false);
|
||||
const [hasAgreedToDomainWarning, setHasAgreedToDomainWarning] =
|
||||
|
10
yarn.lock
10
yarn.lock
@ -3725,9 +3725,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@metamask/controller-utils@npm:^3.0.0, @metamask/controller-utils@npm:^3.1.0, @metamask/controller-utils@npm:^3.2.0":
|
||||
version: 3.2.0
|
||||
resolution: "@metamask/controller-utils@npm:3.2.0"
|
||||
"@metamask/controller-utils@npm:^3.0.0, @metamask/controller-utils@npm:^3.1.0, @metamask/controller-utils@npm:^3.2.0, @metamask/controller-utils@npm:^3.3.0":
|
||||
version: 3.3.0
|
||||
resolution: "@metamask/controller-utils@npm:3.3.0"
|
||||
dependencies:
|
||||
"@metamask/utils": ^5.0.1
|
||||
"@spruceid/siwe-parser": 1.1.3
|
||||
@ -3736,7 +3736,7 @@ __metadata:
|
||||
ethereumjs-util: ^7.0.10
|
||||
ethjs-unit: ^0.1.6
|
||||
fast-deep-equal: ^3.1.3
|
||||
checksum: 06b27f9273719ca6eb556c032b77e9066c8d38ad4ff081896a68046e1e4764482f244bf849d51fc622f425e54c9063cc697abdb0cb2f2aaab9a0d8807f2310f3
|
||||
checksum: 54e19f7bfd7b7762913313877484f0cfe9ac3e66cf43eabc6573e22433a7a36154a1f04fa5834807644a780b4b2200e0cafc06a0f0ef9fcead44304d742b2ad3
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -24063,7 +24063,7 @@ __metadata:
|
||||
"@metamask/auto-changelog": ^2.1.0
|
||||
"@metamask/base-controller": ^2.0.0
|
||||
"@metamask/contract-metadata": ^2.3.1
|
||||
"@metamask/controller-utils": ^3.2.0
|
||||
"@metamask/controller-utils": ^3.3.0
|
||||
"@metamask/design-tokens": ^1.9.0
|
||||
"@metamask/desktop": ^0.3.0
|
||||
"@metamask/eslint-config": ^9.0.0
|
||||
|
Loading…
Reference in New Issue
Block a user