Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

fix(DockerFile): Fix trivy scan #49

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
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
55 changes: 55 additions & 0 deletions .github/workflows/trivy-test-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Trivy Docker Image Analysis

on:
push:
branches:
- main
# Trigger manually
workflow_dispatch:

permissions:
security-events: write # To upload sarif files

jobs:
build-and-scan:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: '3.6.3'

- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.7'

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
file: ./Dockerfile
push: false
tags: backend:latest
load: true # Load the image into Docker's local image store


- name: Run Trivy Table
uses: aquasecurity/[email protected]
with:
scan-type: 'image'
image-ref: 'backend:latest'
severity: 'MEDIUM,HIGH,CRITICAL'
format: 'table'

9 changes: 5 additions & 4 deletions .github/workflows/trivy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,16 @@ jobs:
# For public images, no ENV vars must be set.
- name: Run Trivy vulnerability scanner
if: always()
uses: aquasecurity/trivy-action@master
uses: aquasecurity/trivy-action@0.14.0
with:
# Path to Docker image
image-ref: "ghcr.io/catenax-ng/tx-vas-country-risk-backend:latest"
format: "sarif"
output: "trivy-results3.sarif"
exit-code: "1"
severity: "CRITICAL,HIGH"
timeout: "60m"
# exit-code: "1"
# severity: "CRITICAL,HIGH"
# timeout: "60m"
vuln-type: "os,library"

- name: Upload Trivy scan results to GitHub Security tab
if: always()
Expand Down