-
-
Notifications
You must be signed in to change notification settings - Fork 20
149 lines (129 loc) · 5.97 KB
/
scan.yml
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#
# Run a daily scan of Docker images using Trivy, Snyk and Anchore
#
name: Scan
on:
push:
paths:
- .github/workflows/scan.yml
- scripts/PROGRAMS
workflow_dispatch:
schedule:
- cron: "0 18 * * *"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions: read-all
jobs:
prepare:
runs-on: ubuntu-24.04
outputs:
programs: ${{ steps.set-programs.outputs.programs }}
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Read list of programs from file
id: set-programs
run: echo "programs=$(cat scripts/PROGRAMS | jq -R -s -c 'split("\n") | map(select(length > 0))')" >> $GITHUB_OUTPUT
trivy:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
needs: prepare
strategy:
max-parallel: 20
fail-fast: false
matrix:
image: ${{fromJson(needs.prepare.outputs.programs)}}
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-telemetry: false
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Run Trivy to check ${{ matrix.image }} Docker image for vulnerabilities
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # master
with:
#image-ref: 'docker.io/${{ github.actor }}/${{ matrix.image }}:latest'
#image-ref: 'ghcr.io/${{ github.actor }}/${{ matrix.image }}:latest'
image-ref: 'ghcr.io/${{ github.actor }}/${{ matrix.image }}:latest'
format: 'sarif'
output: 'trivy-${{ matrix.image }}.sarif'
severity: 'HIGH,CRITICAL'
hide-progress: false
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae
with:
sarif_file: 'trivy-${{ matrix.image }}.sarif'
anchore:
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
needs: [prepare, trivy]
strategy:
max-parallel: 20
fail-fast: false
matrix:
image: ${{fromJson(needs.prepare.outputs.programs)}}
runs-on: ubuntu-24.04
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
disable-telemetry: false
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Run Anchore to check ${{ matrix.image }} Docker image for vulnerabilities
uses: anchore/scan-action@abae793926ec39a78ab18002bc7fc45bbbd94342 # v6.0.0
id: anchore-scan
with:
#image: 'docker.io/${{ github.actor }}/${{ matrix.image }}:latest'
image: 'ghcr.io/${{ github.actor }}/${{ matrix.image }}:latest'
fail-build: false
severity-cutoff: high
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae
with:
sarif_file: ${{ steps.anchore-scan.outputs.sarif }}
# snyk:
# permissions:
# contents: read # for actions/checkout to fetch code
# security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
# needs: anchore
# strategy:
# max-parallel: 10
# fail-fast: false
# matrix:
# #image: [cloudflared]
# image: [age, ali, amass, ansible, aznamingtool, bl3auto, black, catprinter, cf-warp, cloudflared, coredns, ddosify, dhcp-helper, dive, dkimpy, dnscontrol, dnscrypt-proxy, dnsx, docker-autocompose, docker-bench-security, driftctl, dry, dsq, excalidraw, fq, gobgp, gocannon, goplay2, goreplay, gotip, gron, hakrawler, headscale, httpie-go, httprobe, httpx, imapsync, lego, log4j-scan, logmepwn, lpar2rrd, miller, nebula, netmaker, nginx, ntfy, octosql, onetun, opentofu, prettier, pwru, rclone, rdap, ruff, rustybgp, sftpd, snowball, spicedb, ssh-audit, sslyze, stor2rrd, subfinder, tailscale, terraform, testssl.sh, textql, tftpd, toxiproxy, trufflehog, unbound, vegeta, visidata, watchtower, whois, wuzz, yggdrasil-go, yt-dlp, zola]
# runs-on: ubuntu-24.04
# steps:
# - name: Harden Runner
# uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
# with:
# egress-policy: audit
# disable-telemetry: false
# - name: Checkout code
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.4.2
# - name: Run Snyk to check ${{ matrix.image }} Docker image for vulnerabilities
# # Snyk can be used to break the build when it detects vulnerabilities.
# # In this case we want to upload the issues to GitHub Code Scanning
# continue-on-error: true
# uses: snyk/actions/docker@7fad562681122205233d1242c3bb39598c5393da # master
# env:
# # In order to use the Snyk Action you will need to have a Snyk API token.
# # More details in https://github.com/snyk/actions#getting-your-snyk-token
# # or you can signup for free at https://snyk.io/login
# SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
# with:
# #image: 'docker.io/${{ github.actor }}/${{ matrix.image }}:latest'
# image: 'ghcr.io/${{ github.actor }}/${{ matrix.image }}:latest'
# args: --file=${{ matrix.image }}/Dockerfile --severity-threshold=high
# - name: Upload result to GitHub Code Scanning
# uses: github/codeql-action/upload-sarif@df409f7d9260372bd5f19e5b04e83cb3c43714ae
# with:
# sarif_file: snyk.sarif