Skip to content

Commit 97bb3bb

Browse files
feat: add trivy vulnerability check
Trivy vulnerability check is added the GitHub Actions workflows. ING-4183
1 parent 2a6b7cd commit 97bb3bb

File tree

6 files changed

+5771
-0
lines changed

6 files changed

+5771
-0
lines changed

.github/workflows/trivy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Trivy vulnerability scanner
7+
8+
on:
9+
push:
10+
branches:
11+
- '*'
12+
pull_request:
13+
branches:
14+
- '*'
15+
#schedule:
16+
# - cron: '39 17 * * 3'
17+
18+
permissions:
19+
contents: read
20+
21+
jobs:
22+
build:
23+
permissions:
24+
contents: read # for actions/checkout to fetch code
25+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
26+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
27+
name: Build
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
#- name: Build an image from Dockerfile
34+
# run: |
35+
# docker build -t docker.io/my-organization/my-app:${{ github.sha }} .
36+
37+
- name: Run Trivy vulnerability scanner in fs mode
38+
uses: aquasecurity/trivy-action@master
39+
with:
40+
# image-ref: 'docker.io/my-organization/my-app:${{ github.sha }}'
41+
scan-type: 'fs'
42+
scan-ref: '.'
43+
#exit-code: '0'
44+
#ignore-unfixed: true
45+
#format: 'table'
46+
#vuln-type: 'os,library'
47+
severity: 'CRITICAL,HIGH,MEDIUM'
48+
#template: '/sarif.tpl'
49+
output: 'trivy-results.sarif'
50+
#skip-dirs: "ignored-dir"
51+
trivy-config: trivy.yaml
52+
53+
- name: Upload Trivy scan results to GitHub Security tab
54+
uses: github/codeql-action/upload-sarif@v2
55+
with:
56+
sarif_file: 'trivy-results.sarif'
57+
58+
#- name: DEBUG Upload Trivy scan results to GitHub Security tab
59+
# uses: github/codeql-action/upload-sarif@v3
60+
# with:
61+
# sarif_file: 'debug-trivy-results.sarif'
62+
63+
#- name: Create Pull Request
64+
# uses: peter-evans/create-pull-request@v5
65+
# with:
66+
# commit-message: update vulnerability list
67+
# title: Update vulnerability list
68+
# body: Update the vulnerability list
69+
# branch: update-vulnerabilities

0 commit comments

Comments
 (0)