Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: configure trivy scans #83

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 34 additions & 26 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,56 @@
# SPDX-License-Identifier: Apache-2.0
#

name: "Trivy"
name: "Run Trivy scan and upload SARIF"

on:
push:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**/*.md'
- '**/*.txt'
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
# Trigger manually
schedule:
- cron: "0 0 * * *" # Once a day

jobs:
analyze:
analyze-frontend:
name: Analyze frontend
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v3
# Pull image from Docker Hub and run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
Dismissed Show dismissed Hide dismissed
with:
image-ref: "tractusx/app-puris-frontend:main"
format: "sarif"
output: "trivy-results-1.sarif"
vuln-type: "os,library"

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
Dismissed Show dismissed Hide dismissed
with:
sarif_file: "trivy-results-1.sarif"

- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
analyze-backend:
name: Analyze backend
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

steps:
# Pull image from Docker Hub and run Trivy vulnerability scanner
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
Dismissed Show dismissed Hide dismissed
with:
scan-type: "config"
exit-code: "1"
hide-progress: false
image-ref: "tractusx/app-puris-backend:main"
format: "sarif"
output: "trivy-results1.sarif"
severity: "CRITICAL,HIGH"
output: "trivy-results-2.sarif"
vuln-type: "os,library"

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: always()
with:
sarif_file: "trivy-results1.sarif"
sarif_file: "trivy-results-2.sarif"
Loading