1 Commits
Author SHA1 Message Date
Renovate 96a762ef9d chore(deps): update dependency aquasecurity/trivy to v0.76.0
CI Tests / JS Unit Tests (push) Skipped
CI Tests / cross-check-mixed-sbom (sbom=false) (push) Skipped
CI Tests / cross-check-mixed-sbom (sbom=true) (push) Skipped
CI Tests / without-inbuild-sbom (sbom=false) (push) Skipped
CI Tests / without-inbuild-sbom (sbom=true) (push) Skipped
CI Tests / with-inbuild-sbom (sbom=false) (push) Skipped
CI Tests / with-inbuild-sbom (sbom=true) (push) Skipped
renovate/artifacts Artifact file update failure
CI Tests / JS Unit Tests (pull_request) Successful in 1m11s
Philipp/Global-Workflows: Pre-commit Lint (Scoped) / pre-commit (pull_request) Successful in 5m47s
CI Tests / cross-check-mixed-sbom (sbom=true) (pull_request) Failing after 2m24s
CI Tests / cross-check-mixed-sbom (sbom=false) (pull_request) Failing after 2m30s
CI Tests / without-inbuild-sbom (sbom=true) (pull_request) Failing after 6m14s
CI Tests / without-inbuild-sbom (sbom=false) (pull_request) Failing after 6m19s
CI Tests / with-inbuild-sbom (sbom=false) (pull_request) Failing after 1m28s
CI Tests / with-inbuild-sbom (sbom=true) (pull_request) Failing after 1m26s
2026-10-14 14:31:11 +00:00
3 changed files with 22 additions and 72 deletions

No files matched your search

+18 -42
View File
@@ -7,8 +7,7 @@ inputs:
required: true
target-image:
description: Target baseline container image reference (e.g. host/server/gitea:latest)
required: false
default: ''
required: true
target-branch:
description: Target branch name for delta heading (e.g. main)
required: false
@@ -49,7 +48,7 @@ runs:
id: vars
shell: bash
env:
TRIVY_VERSION: 0.75.0 # trivy-version
TRIVY_VERSION: 0.76.0 # trivy-version
run: |
echo "date=$(date -u +%Y-%m-%d)" >> "$GITHUB_OUTPUT"
echo "version=${TRIVY_VERSION}" >> "$GITHUB_OUTPUT"
@@ -166,14 +165,6 @@ runs:
echo "ℹ️ Strategy: Direct Trivy image scanning enabled (default). Inspects full container rootfs and package databases for maximum fidelity."
fi
target_available=true
if [ -z "${{ inputs.target-image }}" ] || [ "${{ inputs.target-image }}" = "none" ] || [ "${{ inputs.target-image }}" = "null" ]; then
target_available=false
elif ! docker manifest inspect "${{ inputs.target-image }}" >/dev/null 2>&1; then
echo "::warning::Target baseline image '${{ inputs.target-image }}' not found in registry (MANIFEST_UNKNOWN or inaccessible). Falling back to standalone head scan."
target_available=false
fi
for platform in "${PLATFORMS[@]}"; do
arch_tag=$(echo "$platform" | sed -e 's#^[a-zA-Z0-9_-]*/##' -e 's#/#-#g')
@@ -195,7 +186,6 @@ runs:
fi
# Target image extraction & fallback
if [ "$target_available" = "true" ]; then
if [ "$use_inbuild" = "true" ]; then
echo "Attempting extraction of built-in SBOM for target image ($platform)..."
docker buildx imagetools inspect "${{ inputs.target-image }}" \
@@ -211,7 +201,6 @@ runs:
fi
cleanup_file "sboms/target/sbom-${arch_tag}.spdx.json"
fi
fi
done
# Fallbacks if no platform-specific SBOMs were extracted (e.g. single-arch image without index)
@@ -232,7 +221,7 @@ runs:
fi
fi
if [ "$target_available" = "true" ] && [ -z "$(find sboms/target -type f -name 'sbom-*.spdx.json' 2>/dev/null)" ]; then
if [ -z "$(find sboms/target -type f -name 'sbom-*.spdx.json' 2>/dev/null)" ]; then
if [ "$use_inbuild" = "true" ]; then
docker buildx imagetools inspect "${{ inputs.target-image }}" \
--format '{{ json .SBOM.SPDX }}' > sboms/target/sbom-default.spdx.json 2>/dev/null || true
@@ -257,7 +246,7 @@ runs:
head_sbom_err="No SBOM generated and head image could not be inspected"
fi
if [ "$target_available" = "true" ] && [ ${#target_files[@]} -eq 0 ] && [ -z "$target_sbom_err" ]; then
if [ ${#target_files[@]} -eq 0 ] && [ -z "$target_sbom_err" ]; then
target_sbom_err="No SBOM generated and target baseline image could not be inspected"
fi
@@ -275,9 +264,7 @@ runs:
done
fi
if [ "$target_available" != "true" ]; then
echo "TARGET Baseline Image (${{ inputs.target-image }}): ⚠️ NOT AVAILABLE (Registry manifest missing or target empty)"
elif [ -n "$target_sbom_err" ]; then
if [ -n "$target_sbom_err" ]; then
echo "TARGET Baseline Image (${{ inputs.target-image }}): ❌ FAILED - $target_sbom_err"
else
echo "TARGET Baseline Image (${{ inputs.target-image }}): ✅ SUCCESS"
@@ -293,7 +280,7 @@ runs:
echo "::error::Head SBOM extraction failed: $head_sbom_err"
has_sbom_err=true
fi
if [ "$target_available" = "true" ] && [ -n "$target_sbom_err" ]; then
if [ -n "$target_sbom_err" ]; then
echo "::error::Target baseline SBOM extraction failed: $target_sbom_err"
has_sbom_err=true
fi
@@ -429,18 +416,9 @@ runs:
fi
# 2. Scan Target SBOMs
target_available=true
if [ -z "${{ inputs.target-image }}" ] || [ "${{ inputs.target-image }}" = "none" ] || [ "${{ inputs.target-image }}" = "null" ]; then
target_available=false
fi
if [ "$target_available" = "false" ] || [ ${#target_sboms[@]} -eq 0 ]; then
if [ "$target_available" = "true" ]; then
if [ ${#target_sboms[@]} -eq 0 ]; then
target_ok=false
target_summary+=(" - ⚠️ No baseline SBOM files found (target image manifest unavailable)")
else
target_summary+=(" - ℹ️ Target baseline not specified")
fi
target_summary+=(" - ❌ No SBOM files found in sboms/target/")
else
for f in "${target_sboms[@]}"; do
arch=$(basename "$f" .spdx.json | sed 's/sbom-//')
@@ -534,33 +512,31 @@ runs:
echo "================================================================================"
echo ""
# 4. Enforce Gating
# 4. Enforce Gating: Both must have succeeded with valid reports
has_error=false
if [ "$head_ok" != "true" ] || [ "$head_report_count" -eq 0 ]; then
echo "::error::Head image CVE analysis failed or produced no reports."
has_error=true
fi
if [ "$target_ok" != "true" ] || [ "$target_report_count" -eq 0 ]; then
echo "::error::Target baseline CVE analysis failed or produced no reports."
has_error=true
fi
if [ "$has_error" = "true" ]; then
echo "::error::Aborting analysis: head scan must succeed."
echo "::error::Aborting differential analysis: both head and target scans must succeed before diffing."
exit 1
fi
# 5. Run report generation (differential if target available, otherwise standalone summary)
if [ "$target_ok" = "true" ] && [ "$target_report_count" -gt 0 ]; then
# 5. Run multi-arch set-based diff and generate consolidated full summary report
echo "Both head and target scans succeeded. Computing set-based vulnerability delta..."
target_path="cve-reports/target"
else
echo "Target baseline report unavailable. Generating standalone full vulnerability report..."
target_path="--none"
fi
if ! node "${{ github.action_path }}/cve-diff.js" \
"$target_path" \
"cve-reports/target" \
"cve-reports/head" \
"${{ inputs.target-branch }}" \
"${{ inputs.output-summary }}" > "${{ inputs.output-delta }}"; then
echo "::error::Failed to generate CVE report"
echo "::error::Failed to generate CVE differential report"
exit 1
fi
+4 -18
View File
@@ -344,30 +344,16 @@ function main() {
const baseName = args[2] || 'main';
const summaryOutputPath = args[3];
const baseCves = loadReportsForArg(baseArg);
const branchCves = loadReportsForArg(branchArg);
const output = renderMarkdownDiff(baseCves, branchCves, baseName);
console.log(output);
if (summaryOutputPath) {
const summaryOutput = renderFullSummary(branchCves);
fs.writeFileSync(summaryOutputPath, summaryOutput, 'utf8');
}
if (baseArg === '--none' || baseArg === 'none' || baseArg === '') {
// No baseline provided: output full summary as diff report
const lines = [
`### 🛡️ Vulnerability Report (\`${baseName}\` baseline unavailable)`,
'',
`> [!NOTE]`,
`> Baseline target image for \`${baseName}\` was not found in the registry. Showing all detected vulnerabilities.`,
'',
];
lines.push(renderFullSummary(branchCves).replace(/^### 🛡️ Security Scan Report\n*/, ''));
console.log(lines.join('\n'));
return;
}
const baseCves = loadReportsForArg(baseArg);
const output = renderMarkdownDiff(baseCves, branchCves, baseName);
console.log(output);
}
if (require.main === module) {
-12
View File
@@ -109,15 +109,3 @@ test('formatVulnRow properly formats badge, architecture tag, and escape pipes',
const rowWithoutArch = formatVulnRow(vuln, allArchs, false);
assert.ok(!rowWithoutArch.includes('`amd64`'));
});
test('cve-diff CLI handles --none baseline gracefully and prints full summary', () => {
const { execFileSync } = require('node:child_process');
const headDir = path.join(FIXTURES_DIR, 'head');
const scriptPath = path.join(__dirname, '..', 'cve-diff.js');
const stdout = execFileSync('node', [scriptPath, '--none', headDir, 'main'], { encoding: 'utf8' });
assert.ok(stdout.includes('baseline unavailable'));
assert.ok(stdout.includes('Total Vulnerabilities'));
assert.ok(stdout.includes('CVE-2023-0002'));
assert.ok(stdout.includes('CVE-2023-0003'));
});