@@ -131,7 +131,7 @@ jobs:
131131 mkdir -p docker/modified
132132 sed "s|^FROM biogears-external.*|FROM ghcr.io/${{ github.repository_owner }}/biogears-hari-external:latest|g" \
133133 docker/modified/Dockerfile.release > docker/modified/Dockerfile.builder
134-
134+
135135 echo "Modified Dockerfile contents:"
136136 cat docker/modified/Dockerfile.builder
137137
@@ -435,7 +435,7 @@ jobs:
435435 echo ' "build_platform": "linux"' >> build-output/build-metadata.json
436436 echo '}' >> build-output/build-metadata.json
437437 fi
438-
438+
439439 # Copy build artifacts to the Docker build context directories
440440 # Using -r (recursive) with cp to ensure all directory contents are copied
441441 # Using || to allow the build to continue even if some files are missing
@@ -624,7 +624,7 @@ jobs:
624624
625625 echo "IMAGE_DIGEST=$DIGEST" > image-digest.txt
626626 echo "image_digest=$DIGEST" >> $GITHUB_OUTPUT
627-
627+
628628 # Reset errors
629629 set +x # Disable command echo
630630
@@ -700,7 +700,7 @@ jobs:
700700 # ######################################
701701 # STAGE 2: SECURITY METADATA
702702 # ######################################
703-
703+
704704 # Generate SBOM and scan for vulnerabilities
705705 security-scan :
706706 name : Generate SBOM and Scan
@@ -1061,7 +1061,7 @@ jobs:
10611061 EOF
10621062
10631063 echo "Vulnerability comparison report generated successfully."
1064-
1064+
10651065 - name : Upload SBOM and scan results
10661066 uses : actions/upload-artifact@v4
10671067 with :
@@ -1766,7 +1766,7 @@ jobs:
17661766 tar -czvf all-signatures.tar.gz all-signatures/ || {
17671767 echo "Failed to create all-signatures.tar.gz, creating minimal archive"
17681768 echo "dummy-signature" > all-signatures/dummy.sig
1769- tar -czvf all-signatures.tar.gz all-signatures/
1769+ tar -czvf all-signatures.tar.gz all-signatures/
17701770 }
17711771
17721772 # Reset errors
@@ -1801,7 +1801,10 @@ jobs:
18011801 sudo apt-get install -y jq curl wget python3-pip clamav clamdscan
18021802
18031803 # Install security testing tools
1804- pip3 install bandit safety docker-bench-security
1804+ pip3 install bandit safety
1805+
1806+ # Clone docker-bench-security instead of pip installing it
1807+ git clone https://github.com/docker/docker-bench-security.git
18051808
18061809 # Install Trivy
18071810 wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
@@ -1821,22 +1824,10 @@ jobs:
18211824 echo "=== TESTING: CIS Docker Benchmark ==="
18221825 echo "Running Docker Bench Security..."
18231826
1824- # Create a temporary script to run docker-bench-security
1825- cat > run-docker-bench.sh << 'EOF'
1826- #!/bin/bash
1827- docker run --rm --net host --pid host --userns host --cap-add audit_control \
1828- -e DOCKER_CONTENT_TRUST=$DOCKER_CONTENT_TRUST \
1829- -v /etc:/etc:ro \
1830- -v /usr/bin/containerd:/usr/bin/containerd:ro \
1831- -v /usr/bin/runc:/usr/bin/runc:ro \
1832- -v /usr/lib/systemd:/usr/lib/systemd:ro \
1833- -v /var/lib:/var/lib:ro \
1834- -v /var/run/docker.sock:/var/run/docker.sock:ro \
1835- docker/docker-bench-security > docker-bench-results.txt || echo "Docker bench failed but continuing"
1836- EOF
1837-
1838- chmod +x run-docker-bench.sh
1839- ./run-docker-bench.sh || echo "Docker bench could not run, continuing with tests"
1827+ # Use the cloned docker-bench-security repository
1828+ cd docker-bench-security
1829+ sudo sh docker-bench-security.sh -c container_images > ../docker-bench-results.txt || echo "Docker bench failed but continuing"
1830+ cd ..
18401831
18411832 # Generate report (whether the benchmark ran or not)
18421833 cat > security-tests/reports/docker-benchmark-report.md << EOF
@@ -2315,7 +2306,7 @@ jobs:
23152306 # Copy SBOM with error handling
23162307 if [ -d "security-artifacts" ] && [ -f "security-artifacts/sbom-with-vulns.cyclonedx.json" ]; then
23172308 echo "Copying SBOM from security-artifacts"
2318- cp security-artifacts/sbom-with-vulns.cyclonedx.json artifacts/sboms/
2309+ cp security-artifacts/sbom-with-vulns.cyclonedx.json artifacts/sboms/
23192310 else
23202311 echo "Creating minimal SBOM for publishing"
23212312 cat > artifacts/sboms/sbom-with-vulns.cyclonedx.json << EOF
@@ -2370,7 +2361,7 @@ jobs:
23702361 # Extract and copy signatures with error handling
23712362 if [ -d "attestation-artifacts" ] && [ -f "attestation-artifacts/all-signatures.tar.gz" ]; then
23722363 echo "Extracting signatures from attestation-artifacts"
2373- mkdir -p temp-sigs
2364+ mkdir -p temp-sigs
23742365 tar -xzf attestation-artifacts/all-signatures.tar.gz -C temp-sigs || {
23752366 echo "Failed to extract signatures, creating minimal signature"
23762367 mkdir -p temp-sigs/all-signatures
@@ -2385,7 +2376,7 @@ jobs:
23852376 # Extract and copy policies with error handling
23862377 if [ -d "policy-artifacts" ] && [ -f "policy-artifacts/signed-policies.tar.gz" ]; then
23872378 echo "Extracting policies from policy-artifacts"
2388- mkdir -p temp-policies
2379+ mkdir -p temp-policies
23892380 tar -xzf policy-artifacts/signed-policies.tar.gz -C temp-policies || {
23902381 echo "Failed to extract policies, creating minimal policy"
23912382 mkdir -p temp-policies/policies/rego
@@ -2850,8 +2841,8 @@ jobs:
28502841 cat vulnerability-summary.md
28512842
28522843 - name : Upload vulnerability summary
2853- uses : actions/upload-artifact@v4
2854- with :
2844+ uses : actions/upload-artifact@v4
2845+ with :
28552846 name : vulnerability-summary
28562847 path : vulnerability-summary.md
28572848
0 commit comments