From 0965ca9b7b83cb4ad7b63b17cb09d02263ef687e Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 9 Nov 2017 12:01:04 +0000 Subject: [PATCH 1/3] Zero Width Character detection in ENS addresses resolves #136 --- js/DomManipulator.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/js/DomManipulator.js b/js/DomManipulator.js index 8b4033fc..ed82c2a4 100644 --- a/js/DomManipulator.js +++ b/js/DomManipulator.js @@ -64,7 +64,10 @@ class EtherAddressLookup { /(^|\s|:|-)((?:0x)[0-9a-fA-F]{40})(\s|$)/gi, // ENS Address Regex - /([a-z0-9][a-z0-9-\.]+[a-z0-9](?:\.eth))(\s|$)/gi + /(^|\s|:|-)([a-z0-9][a-z0-9-.]+[a-z0-9](?:\.eth))(\s|$)/gi, + + // ENS With ZWCs + /(^|\s|:|-)([a-z0-9][a-z0-9-.]*(\u200B|\u200C|\u200D|\uFEFF|\u2028|\u2029|‌|‌)[a-z0-9]*(?:\.eth))(\s|$)/gi ]; // Register RegEx Matching Patterns @@ -73,7 +76,10 @@ class EtherAddressLookup { /((?:0x)[0-9a-fA-F]{40})/gi, // ENS Match Pattern - this.regExPatterns[1] + this.regExPatterns[1], + + // ENS With ZWCs + this.regExPatterns[2] ]; // Register Replace Patterns @@ -85,10 +91,14 @@ class EtherAddressLookup { 'target="'+ this.target +'">$2$3', // ENS Address Replace - '$1$2' + 'target="'+ this.target +'">$2$3', + + // ENS With ZWCs Replace + '$1$2$3' ]; } @@ -115,8 +125,8 @@ class EtherAddressLookup { // On failure give the user a warning. if(!this.ENSCompatiable){ - this.replacePatterns[1] = '$1$2'; + this.replacePatterns[1] = '$1$2$3'; } } From f3701ff4ecada3376f701025f9377d5197f51b25 Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 9 Nov 2017 12:54:43 +0000 Subject: [PATCH 2/3] Fix to RegEx replace string --- js/DomManipulator.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/DomManipulator.js b/js/DomManipulator.js index c56e1d52..c17ea96e 100644 --- a/js/DomManipulator.js +++ b/js/DomManipulator.js @@ -94,7 +94,7 @@ class EtherAddressLookup { // ENS Address Replace '$1$2$3', From 0a0634f104e9fa9123ac017be349e3a7e6a8a6ca Mon Sep 17 00:00:00 2001 From: Samuel Hawksby-Robinson Date: Thu, 9 Nov 2017 12:57:21 +0000 Subject: [PATCH 3/3] Updated version to 1.11.0 --- manifest.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index 70f7cf2c..edf061d5 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "EtherAddressLookup", "short_name": "EtherAddressLookup", "description": "Adds links to strings that look like Ethereum addresses to your favorite blockchain explorer.", - "version": "1.10.0", + "version": "1.11.0", "browser_action": { "default_icon": "images/icon.png", diff --git a/package.json b/package.json index c87138cb..1e0e4a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "etheraddresslookup", - "version": "1.10.0", + "version": "1.11.0", "description": "A web extension for blocking ethereum phishing websites.", "main": "blacklists/domains.json", "scripts": {