Skip to content

Commit e70e560

Browse files
authored
Merge pull request #75 from mgarciaLKS/trivy-update
update: add frontend to trivy
2 parents 8b5e904 + 562c9af commit e70e560

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/trivy.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ on:
2929
env:
3030
IMAGE_NAMESPACE: 'tractusx'
3131
ICHUB_BACKEND_IMAGE_NAME: "ichub-backend"
32-
DATASPACE_SDK_IMAGE_NAME: "dataspace-sdk"
33-
INDUSTRY_SDK_IMAGE_NAME: "industry-sdk"
32+
ICHUB_FRONTEND_IMAGE_NAME: "ichub-frontend"
3433

3534
jobs:
3635
analyze-ichub-backend:
@@ -67,3 +66,38 @@ jobs:
6766
if: always()
6867
with:
6968
sarif_file: "trivy-results-ichub-backend.sarif"
69+
70+
analyze-ichub-frontend:
71+
name: Analyze ICHub Frontend
72+
runs-on: ubuntu-latest
73+
permissions:
74+
actions: read
75+
contents: read
76+
security-events: write
77+
78+
steps:
79+
- name: Checkout repository
80+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
81+
82+
- name: Build ichub-frontend Docker image
83+
id: build-docker-ichub-frontend
84+
run: |
85+
cd ichub-frontend
86+
docker build -t ${{ env.IMAGE_NAMESPACE }}/${{ env.ICHUB_FRONTEND_IMAGE_NAME }}:latest .
87+
88+
- name: Run Trivy vulnerability scanner
89+
uses: aquasecurity/trivy-action@18f2510ee396bbf400402947b394f2dd8c87dbb0 # 0.29.0
90+
with:
91+
image-ref: "${{ env.IMAGE_NAMESPACE }}/${{ env.ICHUB_FRONTEND_IMAGE_NAME }}:latest" # Pull image from Docker Hub and run Trivy vulnerability scanner
92+
format: "sarif"
93+
output: "trivy-results-ichub-frontend.sarif"
94+
severity: "CRITICAL,HIGH" # While vulnerabilities of all severities are reported in the SARIF output, the exit code and workflow failure are triggered only by these specified severities (CRITICAL or HIGH).
95+
hide-progress: false
96+
exit-code: "1" # Trivy exits with code 1 if vulnerabilities are found, causing the workflow step to fail.
97+
limit-severities-for-sarif: true
98+
99+
- name: Upload Trivy scan results to GitHub Security tab
100+
uses: github/codeql-action/upload-sarif@9e8d0789d4a0fa9ceb6b1738f7e269594bdd67f0 # v3.28.9
101+
if: always()
102+
with:
103+
sarif_file: "trivy-results-ichub-frontend.sarif"

0 commit comments

Comments
 (0)