diff --git a/app/manifest.json b/app/manifest.json index f3a1ebeff..ac6364059 100644 --- a/app/manifest.json +++ b/app/manifest.json @@ -52,6 +52,12 @@ ], "run_at": "document_start", "all_frames": true + }, + { + "run_at": "document_end", + "matches": ["http://*/*", "https://*/*"], + "js": ["scripts/blacklister.js"], + "css": ["css/blacklister.css"] } ], "permissions": [ diff --git a/app/scripts/blacklister.js b/app/scripts/blacklister.js new file mode 100644 index 000000000..a45265a75 --- /dev/null +++ b/app/scripts/blacklister.js @@ -0,0 +1,13 @@ +const blacklistedDomains = require('etheraddresslookup/blacklists/domains.json') + +function detectBlacklistedDomain() { + var strCurrentTab = window.location.hostname + if (blacklistedDomains && blacklistedDomains.includes(strCurrentTab)) { + window.location.href = 'https://metamask.io/phishing.html' + } +} + +window.addEventListener('load', function() { + detectBlacklistedDomain() +}) + diff --git a/gulpfile.js b/gulpfile.js index cc723704a..53de7a7d9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -172,6 +172,7 @@ gulp.task('default', ['lint'], function () { const jsFiles = [ 'inpage', 'contentscript', + 'blacklister', 'background', 'popup', ] diff --git a/package.json b/package.json index 10b175975..87312b8d1 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "eth-sig-util": "^1.1.1", "eth-simple-keyring": "^1.1.1", "eth-token-tracker": "^1.1.2", + "etheraddresslookup": "github:flyswatter/EtherAddressLookup#AddPackageJson", "ethereumjs-tx": "^1.3.0", "ethereumjs-util": "ethereumjs/ethereumjs-util#ac5d0908536b447083ea422b435da27f26615de9", "ethereumjs-wallet": "^0.6.0",