Adjust wildcard check & add problematic <url>.on.fleek.co (#1871)

* Adjust wildcard check & add problematic <url>.on.fleek.co

* Adjust
This commit is contained in:
Jaco
2022-07-21 08:17:57 +02:00
committed by GitHub
parent df5d53f9cf
commit 95488f0959
2 changed files with 4 additions and 1 deletions
+1
View File
@@ -22,6 +22,7 @@
"1token-im.com",
"1v4t96knneojmqrl1rblweebvongdgjsd657zqwqzs6jmdspolkadot.js.org",
"1vsoumsoosby8aazwusucqrysh7lakimcneijp8shsj8x6bpolkadot.js.org",
"interfacevalidation.on.fleek.co",
"2022-gift.com",
"23.254.132.67",
"247metamaskrapidresponse.com",
+3 -1
View File
@@ -12,6 +12,7 @@ const all = JSON.parse(fs.readFileSync('all.json', 'utf8')) as { allow: string[]
const TOP_LEVEL = [
// wildcards
'*.fleek.co', // storageapi.fleek.co, storageapi2.fleek.co
'on.fleek.co',
// root domains
'ddns.net',
@@ -74,7 +75,8 @@ describe('added urls', (): void => {
it('has no entries for allowed top-level domains', (): void => {
const invalids = all.deny.filter((u) =>
TOP_LEVEL.some((t) =>
t.startsWith('*.')
// for *. count the parts before the check
(t.startsWith('*.') && (u.split('.').length === t.split('.').length))
? (u.endsWith(t.substring(1)) || u === t.substring(2))
: u === t
)