-
Notifications
You must be signed in to change notification settings - Fork 2
83 lines (74 loc) · 2.7 KB
/
sbom.yml
File metadata and controls
83 lines (74 loc) · 2.7 KB
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
name: Create SBOM files
on:
workflow_call:
inputs:
upload_url:
description: "Release assets upload URL"
required: true
type: string
tag:
description: "The git tag to generate SBOM for - used in scheduled runs"
required: false
type: string
jobs:
create-sbom:
runs-on: [self-hosted, Linux, X64]
steps:
- name: Determine release tag and version
id: vars
# Uses inputs.tag for scheduled runs, otherwise github.ref_name.
run: |
TAG_NAME=${{ inputs.tag || github.ref_name }}
VERSION=${TAG_NAME#v}
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.vars.outputs.TAG_NAME }}
submodules: recursive
- name: Create SBOM with Trivy
uses: aquasecurity/trivy-action@0.33.1
with:
scan-type: 'fs'
format: 'spdx-json'
output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}.sbom.json"
scan-ref: '.'
severity: "CRITICAL,HIGH,MEDIUM,LOW"
scanners: "vuln"
- name: Create docker image SBOM with Trivy
uses: aquasecurity/trivy-action@0.33.1
with:
image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}"
scan-type: 'image'
format: 'spdx-json'
output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}-docker.sbom.json"
severity: "CRITICAL,HIGH,MEDIUM,LOW"
scanners: "vuln"
- name: Create security advisory file with Trivy
uses: aquasecurity/trivy-action@0.33.1
with:
scan-type: 'fs'
format: 'json'
output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}.advisories.json"
scan-ref: '.'
severity: "CRITICAL,HIGH,MEDIUM,LOW"
scanners: "vuln"
- name: Create docker image security advisory file with Trivy
uses: aquasecurity/trivy-action@0.33.1
with:
image-ref: "ghcr.io/defguard/defguard-proxy:${{ steps.vars.outputs.VERSION }}"
scan-type: 'image'
format: 'json'
output: "defguard-proxy-${{ steps.vars.outputs.VERSION }}-docker.advisories.json"
severity: "CRITICAL,HIGH,MEDIUM,LOW"
scanners: "vuln"
- name: Upload SBOMs and advisories
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ inputs.upload_url }}
asset_path: "defguard-*.json"
asset_content_type: application/octet-stream
overwrite: true