This repository was archived by the owner on Sep 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (96 loc) 路 2.98 KB
/
Copy pathsecurity-scan.yml
File metadata and controls
108 lines (96 loc) 路 2.98 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Security Scan
on:
workflow_call:
inputs:
name:
description: "Name of the image to scan"
required: true
type: string
isotopes:
description: "JSON array of isotopes to scan"
required: true
type: string
upstream_version:
description: "Upstream version to scan"
required: true
type: string
upstream_image:
description: "Upstream image to scan for comparison"
required: false
type: string
default: ""
env:
REGISTRY: ghcr.io
jobs:
isotope:
runs-on: ubuntu-latest
permissions:
packages: read
strategy:
fail-fast: false
matrix:
isotope: ${{ fromJson(inputs.isotopes) }}
steps:
- name: Log into GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Scan isotope with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ env.REGISTRY }}/${{ github.repository }}/${{ inputs.name }}:${{ inputs.upstream_version }}-${{ matrix.isotope }}-${{ github.run_id }}
format: json
output: ${{ inputs.name }}-${{ matrix.isotope }}.json
- name: Store scan result
uses: actions/upload-artifact@v4
with:
name: scan-result-${{ matrix.isotope }}
path: ${{ inputs.name }}-${{ matrix.isotope }}.json
retention-days: 1
upstream:
if: inputs.upstream_image != ''
runs-on: ubuntu-latest
steps:
- name: Scan upstream with Trivy
uses: aquasecurity/trivy-action@master
with:
image-ref: ${{ inputs.upstream_image }}:${{ inputs.upstream_version }}
format: json
output: ${{ inputs.name }}-upstream.json
- name: Store scan result
uses: actions/upload-artifact@v4
with:
name: scan-result-upstream
path: ${{ inputs.name }}-upstream.json
retention-days: 1
report:
needs: [isotope, upstream]
if: always() && needs.isotope.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout isotope repository
uses: actions/checkout@v4
- name: Retrieve scan results
uses: actions/download-artifact@v4
with:
pattern: scan-result-*
path: security-scan
merge-multiple: true
- name: Generate security report
env:
NAME: ${{ inputs.name }}
ISOTOPES: ${{ inputs.isotopes }}
VERSION: ${{ inputs.upstream_version }}
UPSTREAM_IMAGE: ${{ inputs.upstream_image }}
SCAN_DIR: security-scan
OUTPUT_FILE: SECURITY.md
run: ./.github/scripts/generate-security-report.sh
- name: Store security report
uses: actions/upload-artifact@v4
with:
name: security-report
path: SECURITY.md
retention-days: 7