-
-
Notifications
You must be signed in to change notification settings - Fork 2
89 lines (79 loc) · 2.23 KB
/
Copy pathsecurity-scan.yml
File metadata and controls
89 lines (79 loc) · 2.23 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
82
83
84
85
86
87
88
89
name: Security Scan
on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop
permissions:
contents: read
security-events: write
jobs:
trivy-sca:
name: Trivy SCA (root)
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- name: Run Trivy filesystem scan (root)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: 'fs'
scan-ref: '.'
trivy-config: '.trivy.yaml'
skip-dirs: '.github/actions'
exit-code: '1'
format: 'table'
cache: true
- name: Run Trivy filesystem scan (dashboard)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: 'fs'
scan-ref: 'dashboard'
trivy-config: '.trivy.yaml'
exit-code: '1'
format: 'table'
cache: true
# GitHub Actions use their own lockfiles — scan as advisory only
# since these are CI-only deps, not shipped in production artifacts.
# Track fixes in #2771.
- name: Run Trivy scan (GitHub Actions — advisory only)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: 'fs'
scan-ref: '.github/actions'
exit-code: '0'
format: 'table'
cache: true
- name: Generate SBOM (SPDX)
uses: aquasecurity/trivy-action@v0.36.0
with:
scan-type: 'fs'
scan-ref: '.'
format: 'spdx-json'
output: 'trivy-sbom.spdx.json'
continue-on-error: true
- name: Upload SBOM artifact
uses: actions/upload-artifact@v4
with:
name: trivy-sbom
path: trivy-sbom.spdx.json
retention-days: 30
if-no-files-found: warn
gitleaks:
name: Gitleaks Secret Scan
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
# gitleaks-action v2 auto-detects .gitleaks.toml config
# and runs: gitleaks detect --source . [--config .gitleaks.toml]
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}