Skip to content

Commit f2c34d7

Browse files
authored
feat: daily vuln scanner (#221)
1 parent 3b9946b commit f2c34d7

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

.github/workflows/vuln-scan.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: Daily Vulnerability Scan
16+
17+
on:
18+
schedule:
19+
- cron: '30 7 * * *'
20+
workflow_dispatch: {} # allow manual runs for testing
21+
pull_request: # add itself for testing changes to this workflow
22+
paths:
23+
- '.github/workflows/vuln-scan.yml'
24+
25+
permissions:
26+
contents: read
27+
actions: read
28+
security-events: write # required to upload SARIF
29+
30+
concurrency:
31+
group: scheduled-trivy-scan
32+
cancel-in-progress: false
33+
34+
env:
35+
SARIF_OUTPUT: 'vulnerability-scan-results.sarif'
36+
SEVERITY_LEVELS: 'HIGH,CRITICAL'
37+
38+
jobs:
39+
trivy-repo-scan:
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 30
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
45+
46+
- name: Scan Repo
47+
continue-on-error: true
48+
uses: aquasecurity/trivy-action@b6643a29fecd7f34b3597bc6acb0a98b03d33ff8 # v0.33.1
49+
with:
50+
scan-type: 'fs'
51+
scan-ref: '.'
52+
vuln-type: 'os,library'
53+
scanners: 'vuln,secret,misconfig'
54+
ignore-unfixed: true
55+
format: 'sarif'
56+
output: ${{ env.SARIF_OUTPUT }}
57+
severity: ${{ env.SEVERITY_LEVELS }}
58+
skip-dirs: 'vendor,node_modules,distros/kubernetes'
59+
limit-severities-for-sarif: true
60+
61+
- name: Check SARIF file exists
62+
id: check_sarif
63+
run: |
64+
if [ -f "${{ env.SARIF_OUTPUT }}" ]; then
65+
echo "exists=true" >> $GITHUB_OUTPUT
66+
else
67+
echo "exists=false" >> $GITHUB_OUTPUT
68+
fi
69+
70+
- name: Upload Report
71+
if: steps.check_sarif.outputs.exists == 'true'
72+
uses: github/codeql-action/upload-sarif@17783bfb99b07f70fae080b654aed0c514057477 # v2.23.3
73+
with:
74+
sarif_file: ${{ env.SARIF_OUTPUT }}

0 commit comments

Comments
 (0)