Skip to content

Commit d45fc54

Browse files
fix: pre-commit
1 parent 3eea6c8 commit d45fc54

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.github/workflows/snyk-container-scan.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ jobs:
151151
run: |
152152
# Run Snyk scan and save results
153153
snyk container test $DOCKER_IMAGE --json > snyk_results_${{ matrix.dockerfile_name }}.json || true
154-
154+
155155
# Check if scan failed
156156
if jq -e .error snyk_results_${{ matrix.dockerfile_name }}.json > /dev/null 2>&1; then
157157
echo "scan_failed=true" >> $GITHUB_OUTPUT
@@ -164,7 +164,7 @@ jobs:
164164
id: check_results
165165
run: |
166166
result_file="snyk_results_${{ matrix.dockerfile_name }}.json"
167-
167+
168168
if [ ! -f "$result_file" ]; then
169169
echo "vulnerabilities_found=false" >> $GITHUB_OUTPUT
170170
echo "No scan results file found"
@@ -193,7 +193,7 @@ jobs:
193193
id: snyk_report
194194
run: |
195195
result_file="snyk_results_${{ matrix.dockerfile_name }}.json"
196-
196+
197197
# Handle cases where the scan itself failed
198198
if jq -e .error "$result_file" > /dev/null 2>&1; then
199199
ERROR_MESSAGE=$(jq -r '.error' "$result_file")
@@ -335,43 +335,43 @@ jobs:
335335
total_vulnerabilities=0
336336
failed_scans=0
337337
all_reports=""
338-
338+
339339
for result_file in snyk-results-*/snyk_results_*.json; do
340340
if [ ! -f "$result_file" ]; then
341341
continue
342342
fi
343-
343+
344344
dockerfile_name=$(basename "$result_file" | sed 's/snyk_results_\(.*\)\.json/\1/')
345-
345+
346346
# Check for errors
347347
if jq -e .error "$result_file" > /dev/null 2>&1; then
348348
failed_scans=$((failed_scans + 1))
349349
continue
350350
fi
351-
351+
352352
# Count vulnerabilities
353353
OS_HIGH_CRITICAL=$(jq '[.vulnerabilities[]? | select(.severity == "high" or .severity == "critical")] | length' "$result_file" 2>/dev/null || echo "0")
354354
APP_HIGH_CRITICAL=0
355355
if jq -e '.applications' "$result_file" > /dev/null 2>&1; then
356356
APP_HIGH_CRITICAL=$(jq '[.applications[]?.vulnerabilities[]? | select(.severity == "high" or .severity == "critical")] | length' "$result_file" 2>/dev/null || echo "0")
357357
fi
358358
VULN_COUNT=$((OS_HIGH_CRITICAL + APP_HIGH_CRITICAL))
359-
359+
360360
if [ "$VULN_COUNT" -gt 0 ]; then
361361
total_vulnerabilities=$((total_vulnerabilities + VULN_COUNT))
362362
all_reports+="\n📦 **$dockerfile_name**: $VULN_COUNT high/critical vulnerabilities\n"
363363
fi
364364
done
365-
365+
366366
echo "total_vulnerabilities=$total_vulnerabilities" >> $GITHUB_OUTPUT
367367
echo "failed_scans=$failed_scans" >> $GITHUB_OUTPUT
368-
368+
369369
if [ "$total_vulnerabilities" -gt 0 ] || [ "$failed_scans" -gt 0 ]; then
370370
echo "has_issues=true" >> $GITHUB_OUTPUT
371371
else
372372
echo "has_issues=false" >> $GITHUB_OUTPUT
373373
fi
374-
374+
375375
{
376376
echo "aggregated_report<<EOF"
377377
echo "$all_reports"
@@ -386,13 +386,13 @@ jobs:
386386
SLACK_COLOR: 'danger'
387387
SLACK_MESSAGE: |
388388
🚨 **Snyk Security Scan Alert**
389-
389+
390390
**Summary:**
391391
• Total high/critical vulnerabilities found: ${{ steps.aggregate.outputs.total_vulnerabilities }}
392392
• Failed scans: ${{ steps.aggregate.outputs.failed_scans }}
393-
393+
394394
${{ steps.aggregate.outputs.aggregated_report }}
395-
395+
396396
**🔗 Workflow:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
397397
SLACK_TITLE: 'Snyk Security Scan Alert - Multiple Images'
398398
SLACK_USERNAME: 'Snyk Security Scanner'

0 commit comments

Comments
 (0)