Skip to content

Commit 8821390

Browse files
committed
snyk and trivy report in html
1 parent 4a2e19d commit 8821390

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/devsecops-pipeline.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,24 @@ jobs:
126126
with:
127127
args: --severity-threshold=high --json-file-output=snyk-results.json
128128

129+
- name: Generate Snyk HTML report
130+
if: always()
131+
continue-on-error: true
132+
run: |
133+
npx snyk test --severity-threshold=high > snyk-results.txt 2>&1 || true
134+
npx snyk-to-html -i snyk-results.json -o snyk-results.html || echo "HTML generation skipped"
135+
env:
136+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
137+
129138
- name: Upload Snyk results
130139
if: always()
131140
uses: actions/upload-artifact@v4
132141
with:
133142
name: snyk-results
134-
path: snyk-results.json
143+
path: |
144+
snyk-results.json
145+
snyk-results.html
146+
snyk-results.txt
135147
136148
- name: Run npm audit
137149
run: npm audit --json > npm-audit-results.json
@@ -254,12 +266,22 @@ jobs:
254266
format: 'json'
255267
output: 'trivy-results.json'
256268

269+
- name: Run Trivy for HTML output
270+
uses: aquasecurity/trivy-action@master
271+
with:
272+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
273+
format: 'template'
274+
template: '@/contrib/html.tpl'
275+
output: 'trivy-results.html'
276+
257277
- name: Upload Trivy results
258278
if: always()
259279
uses: actions/upload-artifact@v4
260280
with:
261281
name: trivy-results
262-
path: trivy-results.json
282+
path: |
283+
trivy-results.json
284+
trivy-results.html
263285
264286
# Stage 10: DAST - Dynamic Application Security Testing
265287
dast-zap:
@@ -298,6 +320,7 @@ jobs:
298320
target: 'http://localhost:3000/'
299321
cmd_options: '-a'
300322
allow_issue_writing: false
323+
artifact_name: '' # Disable ZAP's internal artifact upload (we handle it manually)
301324
continue-on-error: true # Don't fail pipeline on warnings
302325

303326
- name: Upload ZAP scan results

0 commit comments

Comments
 (0)