Update trivy.yml #6
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" | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
jobs: | |
trivy: | |
runs-on: ubuntu-latest | |
permissions: | |
# required for all workflows | |
security-events: write | |
# required to fetch internal or private CodeQL packs | |
packages: read | |
# only required for workflows in private repositories | |
actions: read | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 23 | |
architecture: x64 | |
- name: Cache Maven packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2- | |
- name: Build with Maven | |
run: mvn -B verify --file pom.xml | |
- name: "Set up QEMU" | |
if: runner.os == 'Linux' | |
uses: docker/[email protected] | |
- name: "Set up Docker Buildx" | |
if: runner.os == 'Linux' | |
uses: docker/setup-buildx-action@v2 | |
- name: "Verify Docker WebGoat build" | |
if: runner.os == 'Linux' | |
uses: docker/[email protected] | |
with: | |
tags: localbuild/testimage:latest | |
push: false | |
load: true | |
context: ./ | |
file: ./Dockerfile | |
build-args: | | |
webgoat_version=${{ env.WEBGOAT_MAVEN_VERSION }} | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@master | |
with: | |
image-ref: 'localbuild/testimage:latest' | |
format: 'sarif' | |
output: 'trivy-results.sarif' | |
timeout: 20m0s | |
- name: Upload Trivy scan results to GitHub Security tab | |
uses: github/codeql-action/upload-sarif@v3 | |
if: always() | |
with: | |
sarif_file: 'trivy-results.sarif' |