Skip to content

Commit 0a97ee8

Browse files
Rename workflow to include 'Js' in title
1 parent 934dd39 commit 0a97ee8

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Security Blocklist Scan Js
2+
3+
on:
4+
push:
5+
pull_request:
6+
schedule:
7+
- cron: '0 5 * * *' # Every day at 05:00 UTC
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
scan:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Standard Node.js project steps — add/modify as needed for your project!
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Node.js 22
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: 22
24+
25+
- name: Install npm dependencies
26+
run: npm ci
27+
28+
# Optionally: Build your project if you have a build step
29+
# - name: Build
30+
# run: npm run build
31+
32+
# Optionally: Run tests
33+
# - name: Test
34+
# run: npm test
35+
36+
# Security blocklist scan steps (your script, unchanged except for artifact name fix!)
37+
- name: Download JSON destroylist
38+
run: |
39+
curl -sSLo list.json https://raw.githubusercontent.com/phishdestroy/destroylist/main/list.json
40+
41+
- name: Extract blocklisted domains from JSON
42+
run: |
43+
jq -r '.domains[]' list.json | sort | uniq > destroylist_domains.txt
44+
45+
- name: Download deployed homepage and extract referenced domains
46+
run: |
47+
curl -sS https://universalbit-dev.github.io/CityGenerator/ > deployed_site.html
48+
grep -oE "https?://[a-zA-Z0-9._~:/?#@!$&'()*,;=%-]+" deployed_site.html \
49+
| sed 's|https\?://||' | cut -d'/' -f1 | sort | uniq > referenced_domains.txt
50+
51+
- name: Whitelist only your own domain and trusted CDNs
52+
run: |
53+
cat > whitelist.txt <<EOF
54+
universalbit-dev.github.io
55+
cdn.jsdelivr.net
56+
github.com
57+
# Add more trusted domains if needed
58+
EOF
59+
grep -vxFf whitelist.txt referenced_domains.txt > domains_to_check.txt
60+
61+
- name: Scan for blocklisted domains
62+
run: |
63+
if grep -Ff destroylist_domains.txt domains_to_check.txt > destroylist_matches.txt; then
64+
echo "::error ::Blocked phishing domains found in deployed site! Review below:"
65+
cat destroylist_matches.txt
66+
exit 1
67+
else
68+
echo "No blocked phishing domains found in deployed site."
69+
fi
70+
71+
- name: Upload log artifacts (optional)
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: phishdestroy-scan-logs
76+
path: |
77+
list.json
78+
destroylist_domains.txt
79+
referenced_domains.txt
80+
domains_to_check.txt
81+
destroylist_matches.txt

0 commit comments

Comments
 (0)