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.

Preserve literal Bash audit invocation inside the owned group

pulse-triage[bot]b74b4f126a95
diff --git a/scripts/npm-audit-retry.sh b/scripts/npm-audit-retry.sh
index 355a420fe4..d7ea2bc0fe 100755
--- a/scripts/npm-audit-retry.sh
+++ b/scripts/npm-audit-retry.sh
@@ -110,8 +110,12 @@ DEADLINE=$(( $(date +%s) + MAX_SECONDS ))
audit_runner_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
run_audit() {
local limit="$1" out="$2"
+ # Keep Bash's existing executable-script fallback (ENOEXEC), including on
+ # macOS. The fixed exec program forwards argv literally; no npm argument or
+ # executable path is interpolated into shell code.
python3 "${audit_runner_dir}/npm_audit_process.py" \
- "${limit}" "${out}" "${NPM_BIN}" "${AUDIT_ARGS[@]}"
+ "${limit}" "${out}" "${BASH}" -c 'exec "$@"' npm-audit \
+ "${NPM_BIN}" "${AUDIT_ARGS[@]}"
}
# Classify one audit run. Prints a verdict word, summary and (for a finding)
diff --git a/scripts/tests/test_dev_prepush_frontend.py b/scripts/tests/test_dev_prepush_frontend.py
index 04938f902c..2fd6f132dc 100644
--- a/scripts/tests/test_dev_prepush_frontend.py
+++ b/scripts/tests/test_dev_prepush_frontend.py
@@ -264,13 +264,18 @@ class DevPrepushFrontendTest(DevPrepushFixture):
self.assertEqual(guards, [])
def test_audit_path_lookalike_does_not_query(self):
- for path in ("scripts/npm-audit-retry.sh.extra", "scripts/npm_audit_process.py.extra"):
- with self.subTest(path=path):
- self.change(path)
- result, calls, guards = self.run_gate(dependencies=False)
- self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
- self.assertEqual(calls, [])
- self.assertEqual(len(guards), 1 if path.endswith(".sh.extra") else 2)
+ self.change("scripts/npm-audit-retry.sh.extra")
+ result, calls, guards = self.run_gate(dependencies=False)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertEqual(calls, [])
+ self.assertEqual(len(guards), 1)
+
+ def test_audit_process_path_lookalike_does_not_query(self):
+ self.change("scripts/npm_audit_process.py.extra")
+ result, calls, guards = self.run_gate(dependencies=False)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertEqual(calls, [])
+ self.assertEqual(len(guards), 1)
def test_local_strict_paths_match_ci(self):
workflow = yaml.safe_load((ROOT / ".github/workflows/build-and-test.yml").read_text())
diff --git a/scripts/tests/test_npm_audit_retry.py b/scripts/tests/test_npm_audit_retry.py
index 518ddaca55..1d3a76b554 100755
--- a/scripts/tests/test_npm_audit_retry.py
+++ b/scripts/tests/test_npm_audit_retry.py
@@ -34,7 +34,7 @@ class NpmAuditProcessCleanupTest(unittest.TestCase):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
pidfile = root / "child.pid"
- npm = root / "npm"
+ npm = root / "npm fixture;not-code"
counts = dict.fromkeys(("info", "low", "moderate", "high", "critical", "total"), 0)
if finding:
counts.update(high=1, total=1)