Public Access
generated from Philipp/template-git
feat: add dual-side diagnostic overview and fail-safe gating #10
No files matched your search
+12
-2
@@ -235,7 +235,12 @@ runs:
|
|||||||
if trivy sbom --skip-version-check --format json --output "$out_json" "$f" 2>"$err_log"; then
|
if trivy sbom --skip-version-check --format json --output "$out_json" "$f" 2>"$err_log"; then
|
||||||
if [ -s "$out_json" ]; then
|
if [ -s "$out_json" ]; then
|
||||||
vuln_cnt=$(grep -o '"VulnerabilityID"' "$out_json" 2>/dev/null | wc -l || echo 0)
|
vuln_cnt=$(grep -o '"VulnerabilityID"' "$out_json" 2>/dev/null | wc -l || echo 0)
|
||||||
head_summary+=(" - ${arch}: ✅ OK (${vuln_cnt} vulnerability findings)")
|
if [ "$vuln_cnt" -eq 0 ]; then
|
||||||
|
echo "::warning::Head image architecture '${arch}' has 0 CVE findings. Verify that OS/packages were recognized."
|
||||||
|
head_summary+=(" - ${arch}: ⚠️ WARNING (0 vulnerability findings detected)")
|
||||||
|
else
|
||||||
|
head_summary+=(" - ${arch}: ✅ OK (${vuln_cnt} vulnerability findings)")
|
||||||
|
fi
|
||||||
head_report_count=$((head_report_count + 1))
|
head_report_count=$((head_report_count + 1))
|
||||||
else
|
else
|
||||||
head_ok=false
|
head_ok=false
|
||||||
@@ -264,7 +269,12 @@ runs:
|
|||||||
if trivy sbom --skip-version-check --format json --output "$out_json" "$f" 2>"$err_log"; then
|
if trivy sbom --skip-version-check --format json --output "$out_json" "$f" 2>"$err_log"; then
|
||||||
if [ -s "$out_json" ]; then
|
if [ -s "$out_json" ]; then
|
||||||
vuln_cnt=$(grep -o '"VulnerabilityID"' "$out_json" 2>/dev/null | wc -l || echo 0)
|
vuln_cnt=$(grep -o '"VulnerabilityID"' "$out_json" 2>/dev/null | wc -l || echo 0)
|
||||||
target_summary+=(" - ${arch}: ✅ OK (${vuln_cnt} vulnerability findings)")
|
if [ "$vuln_cnt" -eq 0 ]; then
|
||||||
|
echo "::warning::Target baseline image architecture '${arch}' has 0 CVE findings. Verify that OS/packages were recognized."
|
||||||
|
target_summary+=(" - ${arch}: ⚠️ WARNING (0 vulnerability findings detected)")
|
||||||
|
else
|
||||||
|
target_summary+=(" - ${arch}: ✅ OK (${vuln_cnt} vulnerability findings)")
|
||||||
|
fi
|
||||||
target_report_count=$((target_report_count + 1))
|
target_report_count=$((target_report_count + 1))
|
||||||
else
|
else
|
||||||
target_ok=false
|
target_ok=false
|
||||||
|
|||||||
+30
-17
@@ -149,19 +149,17 @@ function formatVulnRow(v) {
|
|||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
function renderMarkdownDiff(baseCves, branchCves, baseName = 'main') {
|
function renderMarkdownDiff(baseCves, branchCves, baseName = 'main') {
|
||||||
if (baseCves.size === 0) {
|
|
||||||
return [
|
|
||||||
`### 🔄 Vulnerability Delta (vs \`${baseName}\`)`,
|
|
||||||
'',
|
|
||||||
'> [!NOTE]',
|
|
||||||
`> No baseline scan from \`${baseName}\` was available to compare against.`,
|
|
||||||
'',
|
|
||||||
].join('\n');
|
|
||||||
}
|
|
||||||
|
|
||||||
const baseKeys = new Set(baseCves.keys());
|
const baseKeys = new Set(baseCves.keys());
|
||||||
const branchKeys = new Set(branchCves.keys());
|
const branchKeys = new Set(branchCves.keys());
|
||||||
|
|
||||||
|
if (branchCves.size === 0) {
|
||||||
|
console.error('::warning::Head image contains 0 reported vulnerabilities. Verify that packages and dependencies were recognized.');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (baseCves.size === 0) {
|
||||||
|
console.error(`::warning::Baseline target (${baseName}) contains 0 reported vulnerabilities.`);
|
||||||
|
}
|
||||||
|
|
||||||
const newKeys = [];
|
const newKeys = [];
|
||||||
let unchangedCount = 0;
|
let unchangedCount = 0;
|
||||||
for (const key of branchKeys) {
|
for (const key of branchKeys) {
|
||||||
@@ -196,15 +194,30 @@ function renderMarkdownDiff(baseCves, branchCves, baseName = 'main') {
|
|||||||
const lines = [
|
const lines = [
|
||||||
`### 🔄 Vulnerability Delta (vs \`${baseName}\`)`,
|
`### 🔄 Vulnerability Delta (vs \`${baseName}\`)`,
|
||||||
'',
|
'',
|
||||||
'| Metric | Count |',
|
|
||||||
'| :--- | :--- |',
|
|
||||||
`| 🚨 **New Vulnerabilities** | ${newVulns.length > 0 ? `🚨 **${newVulns.length}**` : '0'} |`,
|
|
||||||
`| ✅ **Resolved Vulnerabilities** | ${resolvedVulns.length > 0 ? `✅ **${resolvedVulns.length}**` : '0'} |`,
|
|
||||||
`| ⚪ **Unchanged Vulnerabilities** | ${unchangedCount} |`,
|
|
||||||
'',
|
|
||||||
`#### 🚨 New Vulnerabilities Introduced (${newVulns.length})`,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (branchCves.size === 0 && baseCves.size === 0) {
|
||||||
|
lines.push('> [!WARNING]');
|
||||||
|
lines.push('> Both the head image and baseline target have **0 reported vulnerabilities**.');
|
||||||
|
lines.push('');
|
||||||
|
} else if (branchCves.size === 0) {
|
||||||
|
lines.push('> [!WARNING]');
|
||||||
|
lines.push('> The head image has **0 reported vulnerabilities**. Verify that OS packages and language dependencies were properly indexed in the SBOM.');
|
||||||
|
lines.push('');
|
||||||
|
} else if (baseCves.size === 0) {
|
||||||
|
lines.push('> [!WARNING]');
|
||||||
|
lines.push(`> The baseline image (\`${baseName}\`) has **0 reported vulnerabilities**.`);
|
||||||
|
lines.push('');
|
||||||
|
}
|
||||||
|
|
||||||
|
lines.push('| Metric | Count |');
|
||||||
|
lines.push('| :--- | :--- |');
|
||||||
|
lines.push(`| 🚨 **New Vulnerabilities** | ${newVulns.length > 0 ? `🚨 **${newVulns.length}**` : '0'} |`);
|
||||||
|
lines.push(`| ✅ **Resolved Vulnerabilities** | ${resolvedVulns.length > 0 ? `✅ **${resolvedVulns.length}**` : '0'} |`);
|
||||||
|
lines.push(`| ⚪ **Unchanged Vulnerabilities** | ${unchangedCount} |`);
|
||||||
|
lines.push('');
|
||||||
|
lines.push(`#### 🚨 New Vulnerabilities Introduced (${newVulns.length})`);
|
||||||
|
|
||||||
if (newVulns.length > 0) {
|
if (newVulns.length > 0) {
|
||||||
lines.push('| Severity | CVE | Package | Arch | Installed | Fixed In | Title |');
|
lines.push('| Severity | CVE | Package | Arch | Installed | Fixed In | Title |');
|
||||||
lines.push('| :--- | :--- | :--- | :--- | :--- | :--- | :--- |');
|
lines.push('| :--- | :--- | :--- | :--- | :--- | :--- | :--- |');
|
||||||
|
|||||||
Reference in new issue
Block a user