Skip to content

Commit ee8a549

Browse files
CI: Add Trivy GitHub Action (grafana#88987)
* CI: Add Trivy GitHub Action Signed-off-by: Dave Henderson <[email protected]> * Remove obsolete Snyk workflow Signed-off-by: Dave Henderson <[email protected]> --------- Signed-off-by: Dave Henderson <[email protected]>
1 parent c98b7a7 commit ee8a549

File tree

4 files changed

+50
-15
lines changed

4 files changed

+50
-15
lines changed

.github/CODEOWNERS

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@
241241
/Makefile @grafana/grafana-release-guild
242242
/scripts/build/ @grafana/grafana-release-guild
243243
/scripts/list-release-artifacts.sh @grafana/grafana-release-guild
244+
/.trivyignore @grafana/grafana-backend-services-squad
244245

245246
# OSS Plugin Partnerships backend code
246247
/pkg/tsdb/cloudwatch/ @grafana/aws-datasources
@@ -686,7 +687,6 @@ embed.go @grafana/grafana-as-code
686687
/.github/workflows/stale.yml @grafana/grafana-release-guild
687688
/.github/workflows/update-changelog.yml @grafana/grafana-release-guild
688689
/.github/workflows/update-make-docs.yml @grafana/docs-tooling
689-
/.github/workflows/snyk.yml @grafana/security-team
690690
/.github/workflows/scripts/kinds/verify-kinds.go @grafana/platform-cat
691691
/.github/workflows/publish-kinds-next.yml @grafana/platform-cat
692692
/.github/workflows/publish-kinds-release.yml @grafana/platform-cat
@@ -701,6 +701,7 @@ embed.go @grafana/grafana-as-code
701701
/.github/workflows/pr-go-workspace-check.yml @grafana/grafana-app-platform-squad
702702
/.github/workflows/run-scenes-e2e.yml @grafana/dashboards-squad
703703
/.github/workflows/go_lint.yml @grafana/grafana-backend-services-squad
704+
/.github/workflows/trivy-scan.yml @grafana/grafana-backend-services-squad
704705

705706
# Generated files not requiring owner approval
706707
/packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot

.github/workflows/snyk.yml

-14
This file was deleted.

.github/workflows/trivy-scan.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Trivy Scan
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
trivy-scan:
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Run Trivy vulnerability scanner (table output)
14+
uses: aquasecurity/[email protected]
15+
with:
16+
# scan the filesystem, rather than building a Docker image prior - the
17+
# downside is we won't catch dependencies that are only installed in the
18+
# image, but the upside is we'll only catch vulnerabilities that are
19+
# explicitly in the our dependencies
20+
scan-type: 'fs'
21+
scanners: 'vuln'
22+
format: 'table'
23+
exit-code: 1
24+
ignore-unfixed: true
25+
vuln-type: 'os,library'
26+
severity: 'CRITICAL,HIGH'
27+
trivyignores: .trivyignore
28+
- name: Run Trivy vulnerability scanner (SARIF)
29+
uses: aquasecurity/[email protected]
30+
with:
31+
scan-type: 'fs'
32+
scanners: 'vuln'
33+
# Note: The SARIF format ignores severity and uploads all vulns for
34+
# later triage. The table-format step above is used to fail the build
35+
# if there are any critical or high vulnerabilities.
36+
# See https://github.com/aquasecurity/trivy-action/issues/95
37+
format: 'sarif'
38+
output: 'trivy-results.sarif'
39+
ignore-unfixed: true
40+
vuln-type: 'os,library'
41+
trivyignores: .trivyignore
42+
if: always() && github.repository == 'grafana/grafana'
43+
- name: Upload Trivy scan results to GitHub Security tab
44+
uses: github/codeql-action/upload-sarif@v3
45+
with:
46+
sarif_file: 'trivy-results.sarif'
47+
if: always() && github.repository == 'grafana/grafana'

.trivyignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# See https://aquasecurity.github.io/trivy/v0.48/docs/configuration/filtering/#trivyignore

0 commit comments

Comments
 (0)