-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (55 loc) · 1.81 KB
/
Copy pathsecurity.yml
File metadata and controls
65 lines (55 loc) · 1.81 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
# Phase 5.5: filesystem vulnerability scan with Trivy.
#
# Scans the repository for HIGH and CRITICAL vulnerabilities
# (OS packages, language-specific deps, and misconfigurations)
# on every pull request. Results appear inline in the PR check UI.
# Fails the workflow if any HIGH/CRITICAL issue is found.
#
# Does NOT run on push to main (those commits were already scanned
# at PR time). Trivy's local DB cache is saved as a GitHub Actions
# cache keyed on the OS image version so subsequent runs download
# only incremental updates (~2-3 s instead of ~30 s).
name: Security scan
on:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
trivy-fs:
name: Trivy filesystem scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Cache Trivy vulnerability DB
uses: actions/cache@v4
with:
path: .cache/trivy
key: trivy-${{ runner.os }}-${{ hashFiles('**/uv.lock', '**/pnpm-lock.yaml') }}
- name: Run Trivy (fs, HIGH+CRITICAL)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: fs
scan-ref: .
format: table
severity: HIGH,CRITICAL
vuln-type: os,library
cache-dir: .cache/trivy
exit-code: 1
env:
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:latest
- name: Security scan summary
if: success()
run: |
cat <<'EOF' >> $GITHUB_STEP_SUMMARY
## 🔒 Security scan results
| Check | Status |
|-------|--------|
| Trivy filesystem scan | ✅ (0 HIGH/CRITICAL) |
EOF