Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Require successful npm audit completion before a clean verdict
pulse-triage[bot]056ada528228
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 1cb24b2952..6a47430081 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -5033,8 +5033,13 @@ must never be introduced; only an unreachable endpoint isretried. A nonempty package-finding map or any positive integersummary count must fail immediately, even when the total is missing orcontradicts that evidence; a later response must not replace a known finding.-A clean verdict requires all six known summary counts to be integer zero,-no endpoint error and an absent or empty package-finding map. Booleans,+A clean verdict requires the same audit command to exit zero, all six known+summary counts to be integer zero, no endpoint error and an absent or empty+package-finding map. A zero summary written before a nonzero exit or signal+is unavailable evidence, not a clean audit. Positive findings still take+precedence even when the command exits zero or is stopped; they must not be+retried in search of a different verdict. Diagnostics retain the observed+command status without attributing an unknown signal initiator. Booleans,strings, nulls, negative counts and partial summaries are not zero-findingevidence. Without positive evidence, malformed reports retain the existingbounded outage policy, never a clean verdict. Summary diagnostics may print@@ -5050,8 +5055,11 @@ it must not trigger another request. `scripts/tests/test_npm_audit_retry.py`executes changed-second-response, missing-detail, escaping and single-requestfixtures, including production argument forwarding and findings accompanied bytransport errors, positive package/severity evidence with missing or zero-totals, malformed zero summaries under both outage modes, and metadata-annotation injection. Retrying is bounded by wall clock and not by attempt count alone,+totals, malformed zero summaries under both outage modes, failed/signalled+zero summaries, zero and positive reports written before a real watchdog stop,+and metadata annotation injection. The shell smoke provider models a clean+report with exit zero and findings with exit one, like npm's terminal contract.+Retrying is bounded by wall clock and not by attempt count alone,because npm's own `fetch-timeout` defaults to five minutes and it retriesinternally: on 2026-09-04 three attempts against a hanging endpoint ran for10m56s and cancelled the Frontend job at its own timeout with every testdiff --git a/scripts/npm-audit-retry.sh b/scripts/npm-audit-retry.shindex c80d6529f8..1a8e15bec8 100755--- a/scripts/npm-audit-retry.sh+++ b/scripts/npm-audit-retry.sh@@ -122,17 +122,15 @@ run_audit() {kill -TERM "${killer_pid}" 2>/dev/nullwait "${killer_pid}" 2>/dev/null- # 143 = SIGTERM, 137 = SIGKILL: the watchdog fired. The report is then- # empty or truncated, which classify_report already reads as unreachable.- if [ "${status}" -eq 143 ] || [ "${status}" -eq 137 ]; then- return 124- fi- return 0+ # Keep the observed command status. Even a complete-looking zero summary+ # cannot establish a clean audit when npm failed or was stopped afterwards.+ # Positive findings in that same response still take precedence.+ return "${status}"}# Classify one audit run. Prints a verdict word, summary and (for a finding)# allowlisted, JSON-escaped package/advisory details from that same response:-# clean — audit completed, no vulnerabilities+# clean — audit exited zero, complete report, no vulnerabilities# vulnerable — audit completed, vulnerabilities present# unreachable — npm could not get an answer from the advisory endpointclassify_report() {@@ -210,18 +208,20 @@ if has_findings or any(count > 0 for count in counts.values()):sys.exit(0)if (- isinstance(report, dict) and not report.get("error")+ sys.argv[1] == "0"+ and isinstance(report, dict) and not report.get("error")and len(counts) == len(count_names) and all(count == 0 for count in counts.values())and ("vulnerabilities" not in report or isinstance(findings, dict))):print("clean")print(" ".join(f"{name}=0" for name in count_names))else:- # A malformed/partial zero summary or endpoint error is not a clean verdict.+ # A failed/stopped command, partial zero summary or endpoint error is not+ # a clean verdict, even if npm wrote zero counts before it ended.# With no positive finding, retain the existing bounded outage policy.print("unreachable")-'+' "$1"}report_file="$(mktemp)"@@ -245,10 +245,18 @@ while [ "${attempt}" -le "${ATTEMPTS}" ]; dofiecho "npm audit (${SCOPE}) attempt ${attempt}/${ATTEMPTS} (limit ${attempt_limit}s, ${remaining}s of budget left)"- if ! run_audit "${attempt_limit}" "${report_file}"; then- echo "npm audit (${SCOPE}): attempt ${attempt} exceeded ${attempt_limit}s and was stopped"- fi- verdict_output="$(classify_report <"${report_file}")"+ audit_status=0+ run_audit "${attempt_limit}" "${report_file}" || audit_status=$?+ case "${audit_status}" in+ 0) ;;+ 143|137)+ echo "npm audit (${SCOPE}): command was stopped (status ${audit_status}, attempt limit ${attempt_limit}s)"+ ;;+ *)+ echo "npm audit (${SCOPE}): command exited with status ${audit_status}"+ ;;+ esac+ verdict_output="$(classify_report "${audit_status}" <"${report_file}")"verdict="$(printf '%s\n' "${verdict_output}" | head -1)"summary="$(printf '%s\n' "${verdict_output}" | sed -n '2p')"diff --git a/scripts/tests/test-npm-audit-retry.sh b/scripts/tests/test-npm-audit-retry.shindex dc8706ed0e..860ab1d784 100755--- a/scripts/tests/test-npm-audit-retry.sh+++ b/scripts/tests/test-npm-audit-retry.sh@@ -36,11 +36,16 @@ make_fake_npm() {printf 'printf "%%s" "$n" > "$count_file"\n'printf 'case "$n" in\n'local i=1+ local statusfor payload in "$@"; do- printf ' %d) cat <<'"'"'JSON'"'"'\n%s\nJSON\n ;;\n' "${i}" "${payload}"+ status=1+ if [ "${payload}" = "${CLEAN}" ]; then status=0; fi+ printf ' %d) cat <<'"'"'JSON'"'"'\n%s\nJSON\n exit %d\n ;;\n' "${i}" "${payload}" "${status}"i=$((i + 1))done- printf ' *) cat <<'"'"'JSON'"'"'\n%s\nJSON\n ;;\n' "${!#}"+ status=1+ if [ "${!#}" = "${CLEAN}" ]; then status=0; fi+ printf ' *) cat <<'"'"'JSON'"'"'\n%s\nJSON\n exit %d\n ;;\n' "${!#}" "${status}"printf 'esac\n'printf 'exit 1\n'} > "${path}"diff --git a/scripts/tests/test_npm_audit_retry.py b/scripts/tests/test_npm_audit_retry.pyindex 5f96e9699f..5b05d16f13 100755--- a/scripts/tests/test_npm_audit_retry.py+++ b/scripts/tests/test_npm_audit_retry.py@@ -20,7 +20,8 @@ SCRIPT = ROOT / "scripts" / "npm-audit-retry.sh"class NpmAuditRetryTest(unittest.TestCase):def run_check(- self, mode: str, *arguments: str, require: str = "true", report=None+ self, mode: str, *arguments: str, require: str = "true", report=None,+ attempts: int = 3, attempt_timeout: int = 60, max_seconds: int = 240,):with tempfile.TemporaryDirectory() as directory:fake_bin = Path(directory)@@ -47,6 +48,26 @@ class NpmAuditRetryTest(unittest.TestCase):printf '%s\n' "$clean"exit 0;;+ clean-failure)+ printf '%s\n' "$clean"+ exit 42+ ;;+ clean-signal)+ printf '%s\n' "$clean"+ kill -TERM "$$"+ ;;+ clean-hang)+ printf '%s\n' "$clean"+ exec sleep 300+ ;;+ vulnerability-hang)+ printf '%s\n' "$vulnerable"+ exec sleep 300+ ;;+ vulnerability-success)+ printf '%s\n' "$vulnerable"+ exit 0+ ;;transient-success)if [ "$count" -eq 1 ]; thenprintf '%s\n' "$unavailable"@@ -81,6 +102,10 @@ class NpmAuditRetryTest(unittest.TestCase):cat "$FAKE_NPM_REPORT"exit 1;;+ captured-clean)+ cat "$FAKE_NPM_REPORT"+ exit 0+ ;;garbage)echo 'not json'exit 1@@ -99,9 +124,9 @@ class NpmAuditRetryTest(unittest.TestCase):"FAKE_NPM_COUNT": str(count),"FAKE_NPM_MODE": mode,"FAKE_NPM_REPORT": str(report_path),- "NPM_AUDIT_ATTEMPTS": "3",- "NPM_AUDIT_ATTEMPT_TIMEOUT": "60",- "NPM_AUDIT_MAX_SECONDS": "240",+ "NPM_AUDIT_ATTEMPTS": str(attempts),+ "NPM_AUDIT_ATTEMPT_TIMEOUT": str(attempt_timeout),+ "NPM_AUDIT_MAX_SECONDS": str(max_seconds),"NPM_AUDIT_CMD": str(fake_npm),"NPM_AUDIT_REQUIRE_RESULT": require,"NPM_AUDIT_RETRY_DELAY": "0",@@ -114,6 +139,7 @@ class NpmAuditRetryTest(unittest.TestCase):text=True,capture_output=True,check=False,+ timeout=30,)recorded_calls = (calls.read_text(encoding="utf-8").splitlines()@@ -179,6 +205,56 @@ class NpmAuditRetryTest(unittest.TestCase):)self.assertIn("retrying", result.stdout)+ def test_zero_summary_from_a_failed_or_signalled_audit_is_not_clean(self) -> None:+ for mode in ["clean-failure", "clean-signal"]:+ for require in ["true", "false"]:+ with self.subTest(mode=mode, require=require):+ result, calls = self.run_check(mode, "all", require=require)+ self.assertEqual(result.returncode, 1 if require == "true" else 0,+ result.stdout)+ self.assertEqual(calls, ["audit --json"] * 3, result.stdout)+ self.assertIn("could not reach the advisory endpoint", result.stdout)+ self.assertNotIn("no vulnerabilities", result.stdout)+ self.assertNotIn("vulnerabilities present", result.stdout)+ self.assertIn("::error::" if require == "true" else "::warning::",+ result.stdout)+ self.assertIn("status 42" if mode == "clean-failure" else "status 143",+ result.stdout)++ def test_zero_summary_written_before_timeout_is_not_clean(self) -> None:+ for require in ["true", "false"]:+ with self.subTest(require=require):+ result, calls = self.run_check(+ "clean-hang", "production", require=require,+ attempts=1, attempt_timeout=1, max_seconds=5,+ )+ self.assertEqual(result.returncode, 1 if require == "true" else 0,+ result.stdout)+ self.assertEqual(calls, ["audit --json --omit=dev"], result.stdout)+ self.assertIn("was stopped", result.stdout)+ self.assertIn("could not reach the advisory endpoint", result.stdout)+ self.assertNotIn("no vulnerabilities", result.stdout)+ self.assertIn("::error::" if require == "true" else "::warning::",+ result.stdout)++ def test_positive_findings_survive_zero_exit_or_timeout_without_requery(self) -> None:+ for mode in ["vulnerability-success", "vulnerability-hang"]:+ for require in ["true", "false"]:+ with self.subTest(mode=mode, require=require):+ result, calls = self.run_check(+ mode, "all", require=require,+ attempts=3, attempt_timeout=1, max_seconds=5,+ )+ self.assertEqual(result.returncode, 1 if require == "true" else 0,+ result.stdout)+ self.assertEqual(calls, ["audit --json"], result.stdout)+ self.assertIn("vulnerabilities present", result.stdout)+ self.assertNotIn("no vulnerabilities", result.stdout)+ self.assertNotIn("retrying", result.stdout)+ self.assertNotIn("could not reach the advisory endpoint", result.stdout)+ self.assertIn("::error::" if require == "true" else "::warning::",+ result.stdout)+def test_does_not_retry_a_vulnerability_report(self) -> None:result, calls = self.run_check("vulnerability", "all")self.assertEqual(result.returncode, 1)@@ -404,7 +480,7 @@ class NpmAuditRetryTest(unittest.TestCase):},"vulnerabilities": {},}- result, calls = self.run_check("captured-report", "all", report=report)+ result, calls = self.run_check("captured-clean", "all", report=report)self.assertEqual(result.returncode, 0, result.stdout)self.assertEqual(calls, ["audit --json"])self.assertIn("no vulnerabilities", result.stdout)