Move allow list in all.json (#1872)

* Move allow list in all.json

* Correct error message
This commit is contained in:
Jaco
2022-07-21 09:05:10 +02:00
committed by GitHub
parent 2afe94c28f
commit 118fbc3bfc
2 changed files with 26 additions and 30 deletions
+24 -1
View File
@@ -1,5 +1,28 @@
{
"allow": [],
"allow": [
"*.fleek.co",
"ddns.net",
"ddns.us",
"github.io",
"herokuapp.com",
"hopto.org",
"js.org",
"netlify.app",
"on.fleek.co",
"pagekite.me",
"pages.dev",
"plesk.page",
"servehttp.com",
"square.site",
"sytes.net",
"timeweb.ru",
"vercel.app",
"web.app",
"webflow.io",
"weebly.com",
"wixsite.com",
"zapto.org"
],
"deny": [
"07e96d43-381a-46a3-9c16-6daf97213efc.co",
"0vvwvuniswap.top",
+2 -29
View File
@@ -9,33 +9,6 @@ const addresses = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record
const allowed = JSON.parse(fs.readFileSync('known.json', 'utf-8')) as Record<string, string[]>;
const all = JSON.parse(fs.readFileSync('all.json', 'utf8')) as { allow: string[]; deny: string[] };
const TOP_LEVEL = [
// wildcards
'*.fleek.co', // storageapi.fleek.co, storageapi2.fleek.co
'on.fleek.co',
// root domains
'ddns.net',
'ddns.us',
'github.io',
'herokuapp.com',
'hopto.org',
'js.org',
'netlify.app',
'pagekite.me',
'pages.dev',
'plesk.page',
'servehttp.com',
'sytes.net',
'timeweb.ru',
'vercel.app',
'web.app',
'webflow.io',
'weebly.com',
'wixsite.com',
'zapto.org'
];
describe('added addresses', (): void => {
it('has no malformed addresses', (): void => {
const invalids = Object
@@ -72,9 +45,9 @@ describe('added addresses', (): void => {
});
describe('added urls', (): void => {
it('has no entries for allowed top-level domains', (): void => {
it('has no entries matching top-level domains in allow', (): void => {
const invalids = all.deny.filter((u) =>
TOP_LEVEL.some((t) =>
all.allow.some((t) =>
// for *. count the parts before the check
(t.startsWith('*.') && (u.split('.').length === t.split('.').length))
? (u.endsWith(t.substring(1)) || u === t.substring(2))