-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1521 from susanshi/dev
feat: setup scanners for ratify releases
- Loading branch information
Showing
2 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: scan_vulns | ||
on: | ||
push: | ||
paths-ignore: | ||
- "docs/**" | ||
- "library/**" | ||
- "**.md" | ||
pull_request: | ||
paths-ignore: | ||
- "docs/**" | ||
- "library/**" | ||
- "**.md" | ||
workflow_dispatch: | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
govulncheck: | ||
name: "Run govulncheck" | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: "1.22" | ||
check-latest: true | ||
- uses: golang/govulncheck-action@3a32958c2706f7048305d5a2e53633d7e37e97d0 # v1.0.2 | ||
|
||
scan_vulnerabilities: | ||
name: "[Trivy] Scan for vulnerabilities" | ||
runs-on: ubuntu-22.04 | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 | ||
|
||
- name: Download trivy | ||
run: | | ||
pushd $(mktemp -d) | ||
wget https://github.com/aquasecurity/trivy/releases/download/v${{ env.TRIVY_VERSION }}/trivy_${{ env.TRIVY_VERSION }}_Linux-64bit.tar.gz | ||
tar zxvf trivy_${{ env.TRIVY_VERSION }}_Linux-64bit.tar.gz | ||
echo "$(pwd)" >> $GITHUB_PATH | ||
env: | ||
TRIVY_VERSION: "0.46.0" | ||
|
||
- name: Run trivy on git repository | ||
run: | | ||
trivy fs --format table --ignore-unfixed --scanners vuln . | ||
- name: Build docker images | ||
run: | | ||
make e2e-build-local-ratify-image | ||
make e2e-build-crd-image | ||
- name: Run trivy on images for all severity | ||
run: | | ||
for img in "localbuild:test" "localbuildcrd:test"; do | ||
trivy image --ignore-unfixed --vuln-type="os,library" "${img}" | ||
done | ||
- name: Run trivy on images and exit on HIGH severity | ||
run: | | ||
for img in "localbuild:test" "localbuildcrd:test"; do | ||
trivy image --ignore-unfixed --exit-code 1 --severity HIGH --vuln-type="os,library" "${img}" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters