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.

Keep containing recovery proof faithful to current helpers

pulse-triage[bot]fd0754d7c3c5
diff --git a/scripts/installtests/agent_nas_teardown.py b/scripts/installtests/agent_nas_teardown.py
index e5213826f1..7f7ffcc7ae 100644
--- a/scripts/installtests/agent_nas_teardown.py
+++ b/scripts/installtests/agent_nas_teardown.py
@@ -60,14 +60,22 @@ def generated_collector_is_running(listing, runtime):
def write_wide_ps_adapter(tools, executable):
- """Observe real fixture processes without Darwin's display-width truncation.
+ """Observe real fixture processes with a native basename and full argv.
These Linux NAS wrappers run in a long private Darwin temporary path during
- CI. Both comm and args contain that path. Widen only the fixture transport;
- the production parser, exact ownership checks and deadlines are unchanged.
+ CI. Darwin truncates a middle comm path even with -ww. Its native ucomm
+ field supplies the basename Linux's comm uses; args still supplies the
+ exact executable path. Change only this fixture transport, not the
+ production parser, ownership checks or deadlines.
"""
target = tools / "ps"
- target.write_text("#!/bin/sh\nexec " + shlex.quote(str(executable)) + ' -ww "$@"\n')
+ target.write_text("#!/bin/sh\n" + r'''
+for arg do
+ case "$arg" in comm=) arg=ucomm= ;; esac
+ set -- "$@" "$arg"
+ shift
+done
+exec ''' + shlex.quote(str(executable)) + ' -ww "$@"\n')
target.chmod(0o700)
return target
@@ -508,7 +516,7 @@ remove_safe_profile_state_dir() { rm -rf -- "$SAFE_PROFILE_STATE_DIR"; }
except ProcessLookupError: pass
process.wait(timeout=3)
- def test_private_process_reader_requests_full_width_without_changing_fields(self):
+ def test_private_process_reader_requests_native_basename_and_full_argv(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)
native = root / 'native ps'
@@ -523,7 +531,8 @@ remove_safe_profile_state_dir() { rm -rf -- "$SAFE_PROFILE_STATE_DIR"; }
):
with self.subTest(fields=fields):
result = subprocess.run([str(adapter), *fields], capture_output=True, text=True, check=True)
- self.assertEqual(result.stdout.splitlines(), ['-ww', *fields])
+ self.assertEqual(result.stdout.splitlines(),
+ ['-ww', *(field if field != 'comm=' else 'ucomm=' for field in fields)])
def test_generated_collector_observation_keeps_exact_identity_on_both_unix_formats(self):
runtime = Path('/synthetic/owned/bin/pulse-agent')
@@ -535,6 +544,7 @@ remove_safe_profile_state_dir() { rm -rf -- "$SAFE_PROFILE_STATE_DIR"; }
'pulse-agent /synthetic/foreign/bin/pulse-agent 30\n',
f'pulse-agent {runtime}-prod 30\n',
f'pulse-agent /bin/sh echo {runtime} 30\n',
+ f'/synthetic/owne {runtime} 30\n', # Original Darwin middle-column truncation.
f'pulse-agent {runtime}\n',
'pulse-agent\n',
'',
diff --git a/scripts/installtests/auto_update_systemd.py b/scripts/installtests/auto_update_systemd.py
index 00b4762547..51e853eb1c 100644
--- a/scripts/installtests/auto_update_systemd.py
+++ b/scripts/installtests/auto_update_systemd.py
@@ -61,18 +61,22 @@ if pathlib.Path(sys.argv[0]).name == "mktemp":
if args and args[-1].startswith("/tmp/pulse-"):
args[-1] = str(root / "tmp" / pathlib.Path(args[-1]).name)
os.execv("/usr/bin/mktemp", ["mktemp", *args])
-out = None
-url = None
-while args:
- arg = args.pop(0)
- if arg == "-o" and args:
- out = pathlib.Path(args.pop(0))
- elif arg == "-fsSL":
- pass
- elif arg.startswith("https://") and url is None:
- url = arg
- else:
- sys.exit(97)
+# Admit the production downloader's exact bounded HTTPS envelope, not an
+# arbitrary curl option parser. The short form is used by isolated controls.
+flags = ["--disable", "-fsSL", "--connect-timeout", "5", "--max-time", "60",
+ "--proto", "=https", "--proto-redir", "=https"]
+if args[:len(flags)] == flags:
+ args = args[len(flags):]
+elif args[:1] == ["-fsSL"]:
+ args = args[1:]
+else:
+ sys.exit(97)
+if len(args) == 1:
+ url, out = args[0], None
+elif len(args) == 3 and args[1] == "-o":
+ url, out = args[0], pathlib.Path(args[2])
+else:
+ sys.exit(97)
allowed = {"https://github.com/rcourtman/Pulse/releases/latest/download/install.sh": "installer"}
for tag in ("v0.0.1", "v0.0.2"):
allowed["https://github.com/rcourtman/Pulse/releases/download/" + tag + "/install.sh"] = "installer"
diff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.go
index 94630f185a..ce1647cc83 100644
--- a/scripts/installtests/build_release_assets_test.go
+++ b/scripts/installtests/build_release_assets_test.go
@@ -4906,8 +4906,6 @@ func TestReleaseRollbackGuidanceUsesServerUpdateHelper(t *testing.T) {
repoFile("scripts", "trigger-release.sh"),
repoFile("scripts", "release_control", "resolve_release_promotion.py"),
repoFile("scripts", "release_control", "render_release_body.py"),
- repoFile("docs", "UPGRADE_v6.md"),
- repoFile("frontend-modern", "public", "docs", "UPGRADE_v6.md"),
repoFile("docs", "releases", "RELEASE_NOTES_v6.4.0.md"),
repoFile("docs", "releases", "V6_CHANGELOG_v6.4.0.md"),
} {
@@ -4924,6 +4922,29 @@ func TestReleaseRollbackGuidanceUsesServerUpdateHelper(t *testing.T) {
}
}
+ // The current migration guide deliberately does not offer a generic
+ // exact-version command for an unverified helper or migrated data. Keep
+ // its deployment-owned update/recovery routes, not the historical shortcut.
+ for _, path := range []string{
+ repoFile("docs", "UPGRADE_v6.md"),
+ repoFile("frontend-modern", "public", "docs", "UPGRADE_v6.md"),
+ } {
+ assertFileContainsAll(t, path,
+ "INSTALL.md#manual-update", "helper's ownership",
+ "Do not execute an absent or unknown helper",
+ "AUTO_UPDATE.md#manual-rollback", "not a generic `/bin/update` downgrade",
+ )
+ content, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("read %s: %v", path, err)
+ }
+ for _, shortcut := range []string{"/bin/update --version", "./scripts/install.sh --version"} {
+ if strings.Contains(string(content), shortcut) {
+ t.Fatalf("%s must not restore an unqualified migration shortcut %q", path, shortcut)
+ }
+ }
+ }
+
renderer, err := os.ReadFile(repoFile("scripts", "release_control", "render_release_body.py"))
if err != nil {
t.Fatalf("read release body renderer: %v", err)
diff --git a/scripts/installtests/pulse_auto_update_test.go b/scripts/installtests/pulse_auto_update_test.go
index 7249d67708..c9bc2ff6e3 100644
--- a/scripts/installtests/pulse_auto_update_test.go
+++ b/scripts/installtests/pulse_auto_update_test.go
@@ -720,6 +720,7 @@ systemctl() {
` + extractAutoUpdateFunction(t, "is_prerelease_tag") + `
` + extractAutoUpdateFunction(t, "resolve_install_script_url") + `
` + extractAutoUpdateServiceFunctions(t) + `
+` + extractAutoUpdateFunction(t, "download_update_asset") + `
` + extractAutoUpdateFunction(t, "perform_update") + `
if perform_update v5.1.25; then
echo "RESULT:succeeded"
@@ -854,6 +855,7 @@ systemctl() {
` + extractAutoUpdateFunction(t, "is_prerelease_tag") + `
` + extractAutoUpdateFunction(t, "resolve_install_script_url") + `
` + extractAutoUpdateServiceFunctions(t) + `
+` + extractAutoUpdateFunction(t, "download_update_asset") + `
` + extractAutoUpdateFunction(t, "perform_update") + `
if perform_update v5.1.25; then echo "RESULT:succeeded"; else echo "RESULT:failed"; fi
echo "LEAKED:$(trap -p RETURN)"
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index 2cbe5187a3..2594589f7a 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -4288,7 +4288,12 @@ class SubsystemLookupTest(unittest.TestCase):
)
self.assertEqual(
match["verification_requirement"]["exact_files"],
- ["pkg/pbs/client_http_test.go", "pkg/pbs/client_test.go"],
+ [
+ "pkg/pbs/auth_session_concurrency_test.go",
+ "pkg/pbs/client_http_test.go",
+ "pkg/pbs/client_test.go",
+ "pkg/pbs/host_diagnostics_regression_test.go",
+ ],
)
def test_lookup_paths_assigns_monitoring_metrics_history_runtime(self) -> None:
diff --git a/scripts/tests/test_auto_update_systemd.py b/scripts/tests/test_auto_update_systemd.py
index 25dbf8718e..7dc8754030 100644
--- a/scripts/tests/test_auto_update_systemd.py
+++ b/scripts/tests/test_auto_update_systemd.py
@@ -112,6 +112,38 @@ class NativeContracts(unittest.TestCase):
result = subprocess.run([str(allocator), "-d", "/tmp/pulse-backup.XXXXXX"], env=env, capture_output=True, check=True)
self.assertEqual(Path(result.stdout.decode().strip()).parent, root / "tmp")
+ def test_transport_accepts_actual_bounded_downloader_and_rejects_option_drift(self):
+ with tempfile.TemporaryDirectory() as directory:
+ root = Path(directory)
+ script = root / "curl"; script.write_text(native.TRANSPORT); script.chmod(0o755)
+ payload = b"private signed fixture bytes\n"
+ (root / "installer").write_bytes(payload)
+ (root / "installer.sshsig").write_bytes(b"private signature sidecar\n")
+ env = {**os.environ, "PULSE_NATIVE_ROOT": str(root),
+ "PATH": str(root) + os.pathsep + os.environ["PATH"]}
+ url = "https://github.com/rcourtman/Pulse/releases/download/v0.0.2/install.sh"
+ shell = ('source "$1"; download_update_asset "$2" "$3"')
+ for suffix in ("", ".sshsig"):
+ target = root / "downloaded"
+ result = subprocess.run(["bash", "-c", shell, "fixture",
+ str(ROOT / "scripts/pulse-auto-update.sh"), url + suffix, str(target)],
+ env=env, capture_output=True)
+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
+ self.assertEqual(target.read_bytes(), (root / ("installer" + suffix)).read_bytes())
+ target.unlink()
+ flags = ["--disable", "-fsSL", "--connect-timeout", "5", "--max-time", "60",
+ "--proto", "=https", "--proto-redir", "=https"]
+ for changed in (flags[1:], [*flags, "--insecure"],
+ [arg if arg != "60" else "61" for arg in flags],
+ [arg if arg != "=https" else "=all" for arg in flags],
+ [*flags, "https://example.com/install.sh"],
+ [*flags, "--max-time", "60"]):
+ with self.subTest(flags=changed):
+ result = subprocess.run([str(script), *changed, url, "-o", str(root / "refused")],
+ env=env, capture_output=True)
+ self.assertEqual(result.returncode, 97)
+ self.assertFalse((root / "refused").exists())
+
def test_real_verifier_accepts_fixture_and_refuses_tampering(self):
with tempfile.TemporaryDirectory() as directory:
root = Path(directory)