1111 docker_security_scan :
1212 name : 🔍 Container Security Scan
1313 runs-on : ubuntu-latest
14-
14+
1515 permissions :
1616 contents : read
1717 security-events : write
@@ -53,23 +53,23 @@ jobs:
5353 echo "# 🐳 Container Security Report" > security-report.md
5454 echo "Generated on: $(date)" >> security-report.md
5555 echo "" >> security-report.md
56-
56+
5757 # Trivy Results Summary
5858 echo "## 🛡️ Trivy Scan Results" >> security-report.md
5959 if [ -f "trivy-results.json" ]; then
6060 CRITICAL=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' trivy-results.json 2>/dev/null || echo "0")
6161 HIGH=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "HIGH")] | length' trivy-results.json 2>/dev/null || echo "0")
6262 MEDIUM=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "MEDIUM")] | length' trivy-results.json 2>/dev/null || echo "0")
6363 LOW=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "LOW")] | length' trivy-results.json 2>/dev/null || echo "0")
64-
64+
6565 echo "- 🔴 Critical: $CRITICAL" >> security-report.md
6666 echo "- 🟠 High: $HIGH" >> security-report.md
6767 echo "- 🟡 Medium: $MEDIUM" >> security-report.md
6868 echo "- 🟢 Low: $LOW" >> security-report.md
6969 else
7070 echo "- No Trivy results found" >> security-report.md
7171 fi
72-
72+
7373 echo "" >> security-report.md
7474 echo "## 📋 Recommendations" >> security-report.md
7575 echo "1. Review critical and high severity vulnerabilities" >> security-report.md
9393 if [ -f "trivy-results.json" ]; then
9494 CRITICAL=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' trivy-results.json 2>/dev/null || echo "0")
9595 echo "Critical vulnerabilities found: $CRITICAL"
96-
96+
9797 if [ "$CRITICAL" -gt 0 ]; then
9898 echo "::error::Found $CRITICAL critical vulnerabilities in the container image"
9999 echo "::error::Please review and fix critical vulnerabilities before deploying"
@@ -110,7 +110,7 @@ jobs:
110110
111111 name : 🐋 Dockerfile Security Scan
112112 runs-on : ubuntu-latest
113-
113+
114114 steps :
115115 - name : 🧾 Checkout
116116 uses : actions/checkout@v5
@@ -164,7 +164,7 @@ jobs:
164164 name : 📋 Generate Container SBOM
165165 runs-on : ubuntu-latest
166166 needs : docker_security_scan
167-
167+
168168 steps :
169169 - name : 🧾 Checkout
170170 uses : actions/checkout@v5
@@ -184,7 +184,7 @@ jobs:
184184 run : |
185185 # Install Docker Scout CLI
186186 curl -sSfL https://raw.githubusercontent.com/docker/scout-cli/main/install.sh | sh -s --
187-
187+
188188 # Generate SBOM
189189 docker scout sbom clickbom:latest --format spdx --output container-sbom-scout.spdx.json || echo "Docker Scout SBOM generation failed"
190190
@@ -202,7 +202,7 @@ jobs:
202202 runs-on : ubuntu-latest
203203 needs : [docker_security_scan, dockerfile_security_scan, container_sbom]
204204 if : always()
205-
205+
206206 steps :
207207 - name : 📥 Download Security Artifacts
208208 uses : actions/download-artifact@v5
@@ -221,29 +221,29 @@ jobs:
221221 echo "# 🔒 ClickBOM Container Security Summary" >> $GITHUB_STEP_SUMMARY
222222 echo "**Scan Date:** $(date)" >> $GITHUB_STEP_SUMMARY
223223 echo "" >> $GITHUB_STEP_SUMMARY
224-
224+
225225 if [ -f "security-results/trivy-results.json" ]; then
226226 echo "## 🛡️ Vulnerability Scan Results" >> $GITHUB_STEP_SUMMARY
227227 CRITICAL=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "CRITICAL")] | length' security-results/trivy-results.json 2>/dev/null || echo "0")
228228 HIGH=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "HIGH")] | length' security-results/trivy-results.json 2>/dev/null || echo "0")
229229 MEDIUM=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "MEDIUM")] | length' security-results/trivy-results.json 2>/dev/null || echo "0")
230230 LOW=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity == "LOW")] | length' security-results/trivy-results.json 2>/dev/null || echo "0")
231-
231+
232232 echo "| Severity | Count |" >> $GITHUB_STEP_SUMMARY
233233 echo "|----------|-------|" >> $GITHUB_STEP_SUMMARY
234234 echo "| 🔴 Critical | $CRITICAL |" >> $GITHUB_STEP_SUMMARY
235235 echo "| 🟠 High | $HIGH |" >> $GITHUB_STEP_SUMMARY
236236 echo "| 🟡 Medium | $MEDIUM |" >> $GITHUB_STEP_SUMMARY
237237 echo "| 🟢 Low | $LOW |" >> $GITHUB_STEP_SUMMARY
238238 echo "" >> $GITHUB_STEP_SUMMARY
239-
239+
240240 if [ "$CRITICAL" -gt 0 ] || [ "$HIGH" -gt 0 ]; then
241241 echo "⚠️ **Action Required:** Critical or High severity vulnerabilities found!" >> $GITHUB_STEP_SUMMARY
242242 else
243243 echo "✅ **Good News:** No critical or high severity vulnerabilities found!" >> $GITHUB_STEP_SUMMARY
244244 fi
245245 fi
246-
246+
247247 echo "" >> $GITHUB_STEP_SUMMARY
248248 echo "## 📋 Artifacts Generated" >> $GITHUB_STEP_SUMMARY
249249 echo "- Container vulnerability scan results (SARIF format)" >> $GITHUB_STEP_SUMMARY
0 commit comments