From e58ead258ffa4616a5ffdddab56c22e0f4733f3c Mon Sep 17 00:00:00 2001 From: H <409H@users.noreply.github.com> Date: Tue, 22 Mar 2022 14:16:58 +0000 Subject: [PATCH] Bugfix/afqdn check (#6891) * Added logic to convert afqdn * Added test case for afqdn * Version bump - convert afqdn to fqdn before testing domain against lists * Correct variable name --- package.json | 2 +- src/detector.js | 6 +++++- test/index.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 61caba64a54..c728b51f8dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eth-phishing-detect", - "version": "1.1.15", + "version": "1.1.16", "description": "Utility for detecting phishing domains targeting Ethereum users", "main": "src/index.js", "scripts": { diff --git a/src/detector.js b/src/detector.js index f3b56380d22..76c1e814f41 100644 --- a/src/detector.js +++ b/src/detector.js @@ -11,7 +11,11 @@ class PhishingDetector { } check (domain) { - const source = domainToParts(domain) + let fqdn = domain.substring(domain.length - 1) === "." + ? domain.slice(0, -1) + : domain; + + const source = domainToParts(fqdn) // if source matches whitelist domain (or subdomain thereof), PASS const whitelistMatch = matchPartsAgainstList(source, this.whitelist) diff --git a/test/index.js b/test/index.js index 56058240838..ff97103aa3a 100644 --- a/test/index.js +++ b/test/index.js @@ -51,6 +51,7 @@ function startTests () { "metamask.com", "wallet-ethereum.net", "etherclassicwallet.com", + "wallet-ethereum.net." //Test for absolute fully-qualified domain name ]) // whitelist