-
Notifications
You must be signed in to change notification settings - Fork 25
47 lines (45 loc) · 1.39 KB
/
security.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
name: security
on:
workflow_dispatch:
inputs:
IMAGE_TAG:
description: Tag of the image to scan
required: false
default: "latest"
type: string
schedule:
- cron: "0 21 * * FRI"
jobs:
scan:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner
id: trivy
continue-on-error: true
run: |
mkdir -p build/trivy/cache
mkdir -p build/trivy/output
docker run --rm \
--mount "type=bind,src=$(pwd)/build/trivy/cache,dst=/root/.cache" \
--mount "type=bind,src=$(pwd)/build/trivy/output,dst=/trivy/output" \
ghcr.io/aquasecurity/trivy:latest \
image \
--vuln-type="os" \
--severity="MEDIUM,HIGH,CRITICAL" \
--ignore-unfixed \
--exit-code=5 \
--format=sarif \
--output=/trivy/output/trivy.sarif \
ghcr.io/tprasadtp/protonwire:${IMAGE_TAG:-latest}
env:
IMAGE_TAG: ${{ inputs.IMAGE_TAG }}
- name: Upload Trivy scan results to GitHub Security
if: github.ref == 'refs/heads/master'
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'build/trivy/output/trivy.sarif'