Repository navigation
81 lines (68 loc) · 2.52 KB
/
Copy pathsecurity.yml
File metadata and controls
81 lines (68 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Security
on:
pull_request:
push:
branches: [master]
workflow_dispatch:
# Least-privilege default. The DAST job runs PR-controlled code (checkout,
# npm scripts, the built test-app) and must never hold a write credential.
permissions:
contents: read
concurrency:
group: security-${{ github.ref }}
cancel-in-progress: true
jobs:
dast:
name: DAST (medium/high gate)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .nvmrc
cache: npm
cache-dependency-path: |
package-lock.json
test-app/package-lock.json
# test-app compiles the library straight from the root `src/` tree, so
# root dependencies (Angular peers, rxjs, zone.js, etc.) must be
# present too -- same reasoning as e2e.yml.
- name: Install root dependencies
run: npm ci
- name: Install test-app dependencies
run: npm ci --prefix test-app
# test-app doubles as the DAST target: it renders library components
# via the routed gallery shell (AGENTS.md), the same real-browser
# surface the Playwright smoke suite exercises.
- name: Build test-app (production)
run: npm --prefix test-app run build -- --configuration production
- name: Serve test-app with production security headers
run: node scripts/serve-security-scan.mjs &
- name: Wait for test-app
run: |
for attempt in {1..30}; do
curl --fail --silent http://127.0.0.1:4200/ >/dev/null && exit 0
sleep 1
done
echo "test-app did not start within 30 seconds" >&2
exit 1
- name: Scan runtime with OWASP ZAP
uses: zaproxy/action-baseline@de8ad967d3548d44ef623df22cf95c3b0baf8b25 # v0.15.0
with:
target: "http://127.0.0.1:4200"
fail_action: false
allow_issue_writing: false
cmd_options: "-a"
- name: Enforce medium/high severity gate
run: node scripts/check-zap-severity.mjs report_json.json .zap/rules.tsv
- name: Upload ZAP report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: zap-report
path: report_*.html
if-no-files-found: warn