use sigstore only when publishing via github actions #698
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
name: trivy | |
permissions: read-all | |
on: [ push, pull_request ] | |
jobs: | |
trivy: | |
runs-on: ubuntu-20.04 | |
permissions: | |
checks: write | |
actions: read | |
contents: read | |
security-events: write | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
api.github.com:443 | |
ghcr.io:443 | |
github.com:443 | |
mirror.gcr.io:443 | |
objects.githubusercontent.com:443 | |
pkg-containers.githubusercontent.com:443 | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # v0.29.0 | |
continue-on-error: true | |
with: | |
scan-type: fs | |
format: sarif | |
output: results.sarif | |
- name: Check file existence | |
id: check_files | |
uses: andstor/file-existence-action@076e0072799f4942c8bc574a82233e1e4d13e9d6 # v3.0.0 | |
with: | |
files: results.sarif | |
- name: Upload result to GitHub Code Scanning | |
uses: github/codeql-action/upload-sarif@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0 | |
if: steps.check_files.outputs.files_exists == 'true' | |
with: | |
sarif_file: results.sarif |