diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index dcb3ad52d..ba94f8493 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -493,8 +493,13 @@ export default class MetamaskController extends EventEmitter { }, }); - this.phishingController = new PhishingController(); - this.phishingController.updatePhishingLists(); + this.phishingController = new PhishingController( + {}, + initState.PhishingController, + ); + + this.phishingController.maybeUpdatePhishingLists(); + if (process.env.IN_TEST) { this.phishingController.setRefreshInterval(5 * SECOND); } @@ -1176,6 +1181,7 @@ export default class MetamaskController extends EventEmitter { TokensController: this.tokensController, SmartTransactionsController: this.smartTransactionsController, NftController: this.nftController, + PhishingController: this.phishingController, ///: BEGIN:ONLY_INCLUDE_IN(flask) SnapController: this.snapController, CronjobController: this.cronjobController, @@ -3523,10 +3529,7 @@ export default class MetamaskController extends EventEmitter { if (sender.url) { const { hostname } = new URL(sender.url); - const phishingListsAreOutOfDate = this.phishingController.isOutOfDate(); - if (phishingListsAreOutOfDate) { - this.phishingController.updatePhishingLists(); - } + this.phishingController.maybeUpdatePhishingLists(); // Check if new connection is blocked if phishing detection is on const phishingTestResponse = this.phishingController.test(hostname); if (usePhishDetect && phishingTestResponse?.result) { diff --git a/lavamoat/browserify/beta/policy.json b/lavamoat/browserify/beta/policy.json index 58f0a3f8f..150c7e15f 100644 --- a/lavamoat/browserify/beta/policy.json +++ b/lavamoat/browserify/beta/policy.json @@ -938,18 +938,13 @@ "fetch": true }, "packages": { + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>isomorphic-fetch": true, - "@metamask/phishing-controller>@metamask/base-controller": true, "@metamask/phishing-controller>eth-phishing-detect": true, "punycode": true } }, - "@metamask/phishing-controller>@metamask/base-controller": { - "packages": { - "immer": true - } - }, "@metamask/phishing-controller>eth-phishing-detect": { "packages": { "eslint>optionator>fast-levenshtein": true diff --git a/lavamoat/browserify/flask/policy.json b/lavamoat/browserify/flask/policy.json index 6933207dc..77a79dafa 100644 --- a/lavamoat/browserify/flask/policy.json +++ b/lavamoat/browserify/flask/policy.json @@ -950,18 +950,13 @@ "fetch": true }, "packages": { + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>isomorphic-fetch": true, - "@metamask/phishing-controller>@metamask/base-controller": true, "@metamask/phishing-controller>eth-phishing-detect": true, "punycode": true } }, - "@metamask/phishing-controller>@metamask/base-controller": { - "packages": { - "immer": true - } - }, "@metamask/phishing-controller>eth-phishing-detect": { "packages": { "eslint>optionator>fast-levenshtein": true diff --git a/lavamoat/browserify/main/policy.json b/lavamoat/browserify/main/policy.json index 58f0a3f8f..150c7e15f 100644 --- a/lavamoat/browserify/main/policy.json +++ b/lavamoat/browserify/main/policy.json @@ -938,18 +938,13 @@ "fetch": true }, "packages": { + "@metamask/base-controller": true, "@metamask/controller-utils": true, "@metamask/controller-utils>isomorphic-fetch": true, - "@metamask/phishing-controller>@metamask/base-controller": true, "@metamask/phishing-controller>eth-phishing-detect": true, "punycode": true } }, - "@metamask/phishing-controller>@metamask/base-controller": { - "packages": { - "immer": true - } - }, "@metamask/phishing-controller>eth-phishing-detect": { "packages": { "eslint>optionator>fast-levenshtein": true diff --git a/package.json b/package.json index b3ba01863..fbfe049ad 100644 --- a/package.json +++ b/package.json @@ -228,7 +228,7 @@ "@metamask/notification-controller": "^1.0.0", "@metamask/obs-store": "^5.0.0", "@metamask/permission-controller": "^1.0.0", - "@metamask/phishing-controller": "^1.0.0", + "@metamask/phishing-controller": "^1.1.0", "@metamask/post-message-stream": "^6.0.0", "@metamask/providers": "^10.2.1", "@metamask/rate-limit-controller": "^1.0.0", @@ -572,7 +572,8 @@ "web3>web3-shh": false, "@keystonehq/metamask-airgapped-keyring>@keystonehq/base-eth-keyring>hdkey>secp256k1": false, "@metamask/base-controller>simple-git-hooks": false, - "@storybook/core>@storybook/core-server>webpack>watchpack>watchpack-chokidar2>chokidar>fsevents": false + "@storybook/core>@storybook/core-server>webpack>watchpack>watchpack-chokidar2>chokidar>fsevents": false, + "resolve-url-loader>es6-iterator>es5-ext": false } }, "packageManager": "yarn@3.2.4" diff --git a/yarn.lock b/yarn.lock index fb50021ca..a2c61188d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3714,17 +3714,17 @@ __metadata: languageName: node linkType: hard -"@metamask/phishing-controller@npm:^1.0.0": - version: 1.0.0 - resolution: "@metamask/phishing-controller@npm:1.0.0" +"@metamask/phishing-controller@npm:^1.1.0": + version: 1.1.0 + resolution: "@metamask/phishing-controller@npm:1.1.0" dependencies: - "@metamask/base-controller": ~1.0.0 - "@metamask/controller-utils": ~1.0.0 + "@metamask/base-controller": ^1.1.1 + "@metamask/controller-utils": ^1.0.0 "@types/punycode": ^2.1.0 eth-phishing-detect: ^1.2.0 isomorphic-fetch: ^3.0.0 punycode: ^2.1.1 - checksum: e5e31f68611c14b30cfd639b99a97921cac1d13af534fa1586bce63075895486d89c554aaa5f5201245f51981a0a8a1f9aeeea8652e22c9523b01f8880de4de6 + checksum: bc8c066dd9ed3fff9456ffd2d888c5c78e45a4f4b8e19903caa47b07f42bb298c95956d5df22aef805dbbf2dac6dfb5291f605636fb0725417ae6e0d1c14528a languageName: node linkType: hard @@ -22790,7 +22790,7 @@ __metadata: "@metamask/notification-controller": ^1.0.0 "@metamask/obs-store": ^5.0.0 "@metamask/permission-controller": ^1.0.0 - "@metamask/phishing-controller": ^1.0.0 + "@metamask/phishing-controller": ^1.1.0 "@metamask/phishing-warning": ^1.2.1 "@metamask/post-message-stream": ^6.0.0 "@metamask/providers": ^10.2.1