Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Repair the native Unix installer check failures

pulse-triage[bot]c486a2aefb01
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 9e120752f7..769abf7e28 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -4206,7 +4206,8 @@ func TestFrontendDependencySecurityAuditsAreRequired(t *testing.T) {
}
assertFileContainsAll(t, runnerPath,
`NPM_AUDIT_REQUIRE_RESULT:-true`,
- `AUDIT_ARGS=("$@")`,
+ `AUDIT_ARGS=(audit --json "$@")`,
+ `AUDIT_ARGS+=(--omit=dev)`,
`if type(value) is int and value >= 0:`,
`has_findings = isinstance(findings, dict) and bool(findings)`,
`if has_findings or any(count > 0 for count in counts.values()):`,
@@ -5066,8 +5067,67 @@ func TestFrontendChangeClassificationPreservesStrictAudit(t *testing.T) {
t.Errorf("downstream critical-audit status=%d; want %d: %s", auditStatus, tc.auditStatus, auditResult)
}
if !strings.Contains(string(auditResult), `"severity": "critical"`) {
- t.Fatal("the observed finding disappeared")
+ t.Fatalf("the observed finding disappeared: %s", auditResult)
}
})
}
}
+
+// Run through the native Bash, including macOS's Bash 3.2. An empty optional
+// argument list must still invoke npm once, preserve its finding and obey the
+// existing strict/inherited verdict split. Quoting and production scope must
+// survive combining the formerly empty arrays into one nonempty argv vector.
+func TestNpmAuditNativeScopeArgumentsPreserveFindings(t *testing.T) {
+ const finding = `{"metadata":{"vulnerabilities":{"critical":1,"total":1}},"vulnerabilities":{"fixture":{"name":"fixture","severity":"critical"}}}`
+ for _, scope := range []string{"all", "production"} {
+ for _, extra := range [][]string{nil, {"--package-lock-only", "--fixture=two words", ""}} {
+ for _, require := range []string{"true", "false"} {
+ t.Run(scope+"/args="+strconv.Itoa(len(extra))+"/strict="+require, func(t *testing.T) {
+ directory := t.TempDir()
+ argvPath := filepath.Join(directory, "argv")
+ npmPath := filepath.Join(directory, "npm")
+ stub := "#!/bin/sh\nprintf '%s\\0' \"$@\" >> \"$AUDIT_ARGV\"\nprintf '%s\\n' '" + finding + "'\nexit 1\n"
+ if err := os.WriteFile(npmPath, []byte(stub), 0700); err != nil {
+ t.Fatal(err)
+ }
+ args := append([]string{repoFile("scripts", "npm-audit-retry.sh"), scope}, extra...)
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(ctx, "bash", args...)
+ cmd.Env = append(os.Environ(), "AUDIT_ARGV="+argvPath, "NPM_AUDIT_CMD="+npmPath,
+ "NPM_AUDIT_REQUIRE_RESULT="+require, "NPM_AUDIT_ATTEMPTS=1",
+ "NPM_AUDIT_RETRY_DELAY=0", "NPM_AUDIT_ATTEMPT_TIMEOUT=5", "NPM_AUDIT_MAX_SECONDS=10")
+ output, err := cmd.CombinedOutput()
+ status := 0
+ if err != nil {
+ exit, ok := err.(*exec.ExitError)
+ if !ok {
+ t.Fatal(err)
+ }
+ status = exit.ExitCode()
+ }
+ wantStatus, annotation := 1, "::error::"
+ if require == "false" {
+ wantStatus, annotation = 0, "::warning::"
+ }
+ if status != wantStatus || !strings.Contains(string(output), annotation) ||
+ !strings.Contains(string(output), `"severity": "critical"`) ||
+ strings.Contains(string(output), "advisory endpoint did not return") {
+ t.Fatalf("native audit lost its finding/verdict: exit=%d want=%d\n%s", status, wantStatus, output)
+ }
+ recorded, err := os.ReadFile(argvPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ want := append([]string{"audit", "--json"}, extra...)
+ if scope == "production" {
+ want = append(want, "--omit=dev")
+ }
+ if string(recorded) != strings.Join(want, "\x00")+"\x00" {
+ t.Fatalf("npm must run once with exact arguments: got %q want %q", recorded, want)
+ }
+ })
+ }
+ }
+ }
+}
diff --git a/scripts/installtests/secure_runtime_platform_matrix_test.go b/scripts/installtests/secure_runtime_platform_matrix_test.go
index 0911d133e0..6d60236265 100644
--- a/scripts/installtests/secure_runtime_platform_matrix_test.go
+++ b/scripts/installtests/secure_runtime_platform_matrix_test.go
@@ -39,7 +39,15 @@ func TestSecureRuntimePlatformMatrixRemainsExplicitAndShipped(t *testing.T) {
"Do not\nremove `PrivateNetwork` to work around a telemetry failure.",
"helper's private network namespace",
"operation v2 preserves the collected",
- "Unavailable on hosts where pmxcfs abstract IPC is hidden",
+ // The helper now avoids abstract IPC rather than relaxing its private
+ // network. Check the replacement route and its remaining limits, not
+ // the retired matrix wording that called every such host unavailable.
+ "Configs are read through the pmxcfs mount",
+ "cgroup v2 and `/proc`",
+ "pins the guest's init, re-checks its identity",
+ "the caller selects no VMID, path, or command",
+ "whenever discovery cannot establish a guest's state",
+ "Does not yet justify Proxmox host-agent parity or a default change",
}
for _, marker := range required {
if !strings.Contains(content, marker) {
diff --git a/scripts/npm-audit-retry.sh b/scripts/npm-audit-retry.sh
index 1a8e15bec8..737f3ed250 100755
--- a/scripts/npm-audit-retry.sh
+++ b/scripts/npm-audit-retry.sh
@@ -65,15 +65,20 @@ set -uo pipefail
SCOPE="${1:-}"
case "${SCOPE}" in
- all) SCOPE_ARGS=() ;;
- production) SCOPE_ARGS=(--omit=dev) ;;
+ all|production) ;;
*)
echo "Usage: $0 <all|production> [npm-audit-args...]" >&2
exit 2
;;
esac
shift
-AUDIT_ARGS=("$@")
+# Bash 3.2 (the native macOS shell) treats even a declared empty array as
+# unbound under nounset. Keep one nonempty argv vector, including npm's fixed
+# arguments, so an argument-free audit still runs and retains its findings.
+AUDIT_ARGS=(audit --json "$@")
+if [ "${SCOPE}" = production ]; then
+ AUDIT_ARGS+=(--omit=dev)
+fi
ATTEMPTS="${NPM_AUDIT_ATTEMPTS:-3}"
DELAY="${NPM_AUDIT_RETRY_DELAY:-15}"
@@ -105,7 +110,7 @@ run_audit() {
local limit="$1" out="$2"
: >"${out}"
- "${NPM_BIN}" audit --json "${AUDIT_ARGS[@]}" "${SCOPE_ARGS[@]}" >"${out}" 2>/dev/null &
+ "${NPM_BIN}" "${AUDIT_ARGS[@]}" >"${out}" 2>/dev/null &
local npm_pid=$!
(