Skip to content

Commit e58ead2

Browse files
authored
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
1 parent 3568777 commit e58ead2

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "eth-phishing-detect",
3-
"version": "1.1.15",
3+
"version": "1.1.16",
44
"description": "Utility for detecting phishing domains targeting Ethereum users",
55
"main": "src/index.js",
66
"scripts": {

src/detector.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ class PhishingDetector {
1111
}
1212

1313
check (domain) {
14-
const source = domainToParts(domain)
14+
let fqdn = domain.substring(domain.length - 1) === "."
15+
? domain.slice(0, -1)
16+
: domain;
17+
18+
const source = domainToParts(fqdn)
1519

1620
// if source matches whitelist domain (or subdomain thereof), PASS
1721
const whitelistMatch = matchPartsAgainstList(source, this.whitelist)

test/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ function startTests () {
5151
"metamask.com",
5252
"wallet-ethereum.net",
5353
"etherclassicwallet.com",
54+
"wallet-ethereum.net." //Test for absolute fully-qualified domain name
5455
])
5556

5657
// whitelist

0 commit comments

Comments
 (0)