Skip to content

scan release images with trivy #4829

scan release images with trivy

scan release images with trivy #4829

Workflow file for this run

---
name: "Lint"
on: # yamllint disable-line rule:truthy
push:
branches:
- "!dependabot/*"
- "main"
pull_request:
branches: ["*"]
merge_group:
types:
- "checks_requested"
env:
GO_VERSION: "~1.20.6"
jobs:
go-lint:
name: "Lint Go"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- name: "Lint Go"
run: "go run mage.go lint:go"
- uses: "chainguard-dev/actions/nodiff@main"
with:
path: ""
fixup-command: "go run mage.go lint:go"
extra-lint:
name: "Lint YAML & Markdown"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- name: "Lint Everything Else"
run: "go run mage.go lint:extra"
- uses: "chainguard-dev/actions/nodiff@main"
with:
path: ""
fixup-command: "go run mage.go lint:extra"
codeql:
name: "Analyze with CodeQL"
runs-on: "ubuntu-latest-8-cores"
permissions:
actions: "read"
contents: "read"
security-events: "write"
strategy:
fail-fast: false
matrix:
language: ["go"]
steps:
- uses: "actions/checkout@v3"
- uses: "authzed/actions/codeql@main"
trivy-fs:
name: "Analyze FS with Trivy"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: "aquasecurity/trivy-action@master"
with:
scan-type: "fs"
ignore-unfixed: true
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH,MEDIUM"
- name: "Upload Trivy scan results to GitHub Security tab"
uses: "github/codeql-action/upload-sarif@v2"
with:
sarif_file: "trivy-results.sarif"
trivy-image:
name: "Analyze Nightly Image with Trivy"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
with:
fetch-depth: 0
- uses: "authzed/actions/setup-go@main"
with:
go-version: "${{ env.GO_VERSION }}"
- uses: "docker/setup-qemu-action@v1"
- uses: "docker/setup-buildx-action@v1"
- uses: "goreleaser/goreleaser-action@v4"
with:
distribution: "goreleaser-pro"
version: "latest"
args: "build -f nightly.goreleaser.yml --single-target --clean --nightly"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GORELEASER_KEY: "${{ secrets.GORELEASER_KEY }}"
- uses: "aquasecurity/trivy-action@master"
with:
scan-type: "image"
image-ref: 'authzed/spicedb-git:${{ github.sha }}'
ignore-unfixed: true
format: "sarif"
output: "trivy-results.sarif"
severity: "CRITICAL,HIGH,MEDIUM"
- name: "Upload Trivy scan results to GitHub Security tab"
uses: "github/codeql-action/upload-sarif@v2"
with:
sarif_file: "trivy-results.sarif"