diff --git a/src/background/index.js b/src/background/index.js index 1060fcf..7b4ea8a 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -12,6 +12,10 @@ const { refreshBalances, getProvider } = require("../shared/balances"); const { debugFetch } = require("../shared/log"); const { decryptWithPassword } = require("../shared/vault"); const { getSignerForAddress } = require("../shared/wallet"); +const { + isPhishingDomain, + updatePhishingList, +} = require("../shared/phishingDomains"); const storageApi = typeof browser !== "undefined" @@ -571,6 +575,10 @@ async function backgroundRefresh() { setInterval(backgroundRefresh, BACKGROUND_REFRESH_INTERVAL); +// Fetch the MetaMask eth-phishing-detect domain blocklist on startup. +// Refreshes every 24 hours automatically. +updatePhishingList(); + // When approval window is closed without a response, treat as rejection if (windowsApi && windowsApi.onRemoved) { windowsApi.onRemoved.addListener((windowId) => { @@ -643,6 +651,8 @@ runtime.onMessage.addListener((msg, sender, sendResponse) => { resp.type = "sign"; resp.signParams = approval.signParams; } + // Flag if the requesting domain is on the phishing blocklist. + resp.isPhishingDomain = isPhishingDomain(approval.hostname); sendResponse(resp); } else { sendResponse(null); diff --git a/src/popup/index.html b/src/popup/index.html index d7faa54..81e008d 100644 --- a/src/popup/index.html +++ b/src/popup/index.html @@ -1149,6 +1149,20 @@