mirror of
https://github.com/pezkuwichain/phishing.git
synced 2026-04-30 06:08:06 +00:00
Add test for allowed top-level domains (#1120)
* Add test for allowed top-level domains * Update packages/phishing/src/additions.spec.ts Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
@@ -7,7 +7,20 @@ import { decodeAddress } from '@polkadot/util-crypto';
|
||||
|
||||
const addresses = JSON.parse(fs.readFileSync('address.json', 'utf-8')) as Record<string, string[]>;
|
||||
const allowed = JSON.parse(fs.readFileSync('known.json', 'utf-8')) as Record<string, string[]>;
|
||||
const all = JSON.parse(fs.readFileSync('all.json', 'utf8')) as { deny: string[] };
|
||||
const all = JSON.parse(fs.readFileSync('all.json', 'utf8')) as { allow: string[]; deny: string[] };
|
||||
|
||||
const TOP_LEVEL = [
|
||||
'pages.dev',
|
||||
'servehttp.com',
|
||||
'vercel.app',
|
||||
'web.app',
|
||||
'hopto.org',
|
||||
'zapto.org',
|
||||
'sytes.net',
|
||||
'ddns.net',
|
||||
'webflow.io',
|
||||
'plesk.page'
|
||||
];
|
||||
|
||||
describe('added addresses', (): void => {
|
||||
it('has no malformed addresses', (): void => {
|
||||
@@ -45,6 +58,12 @@ describe('added addresses', (): void => {
|
||||
});
|
||||
|
||||
describe('added urls', (): void => {
|
||||
it('has no entries for allowed top-level domains', (): void => {
|
||||
const invalids = all.deny.filter((u) => TOP_LEVEL.includes(u));
|
||||
|
||||
expect(invalids).toEqual([]);
|
||||
});
|
||||
|
||||
it('has no malformed domain-only entries', (): void => {
|
||||
const invalids = all.deny.filter((u) =>
|
||||
u.includes('/') || // don't allow paths
|
||||
|
||||
Reference in New Issue
Block a user