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.

Refuse incomplete SCALE task activation targets before removal

pulse-triage[bot]3f63e2021638
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index d71de6fb80..ddbbb9348e 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -30,7 +30,9 @@ SCRIPT/POSTINIT task, including duplicates. Unknown ownership, indirect command
activation or another-install bootstrap refuses without deleting unrelated
tasks. The JSON reader rejects duplicate keys/IDs, invalid types, failed/empty/
diagnostic/incomplete reads, over 512 tasks or over 1 MiB; it returns only owned
-numeric IDs and enablement, never task commands, names or credentials. All owned
+numeric IDs and enablement, never task commands, names or credentials. A
+missing/empty SCRIPT path or COMMAND target is unknown activation, not an
+unrelated task or evidence that the owned task is absent. All owned
tasks are disabled with checked calls and independent exact-set readback before
systemd stop. A partial stop/disable stays stopped/disabled: do not re-enable or
automatically restart after a refusal.
@@ -47,7 +49,7 @@ succeeded. No favourable replacement observation, task recreation or credential
churn is performed. Unrelated tasks survive unchanged.
`TestInstallSHTrueNASScaleBootTasksRetireBeforeRecoveryErasure` requires all
-fifteen `agent_truenas_teardown.py` actual-function/full-caller controls,
+sixteen `agent_truenas_teardown.py` actual-function/full-caller controls,
including multiple tasks, partial/refused/unknown operations, post-remote
changes, ignored/recreated deletion, process privacy and a real timeout child.
These run against closed middleware/systemd/process models and private ordinary-
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index b6d4667eec..1f61cabe18 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -31,7 +31,9 @@ SCRIPT/POSTINIT task, including duplicates. Unknown ownership, indirect command
activation or another-install bootstrap refuses without deleting unrelated
tasks. The JSON reader rejects duplicate keys/IDs, invalid types, failed/empty/
diagnostic/incomplete reads, over 512 tasks or over 1 MiB; it returns only owned
-numeric IDs and enablement, never task commands, names or credentials. All owned
+numeric IDs and enablement, never task commands, names or credentials. A
+missing/empty SCRIPT path or COMMAND target is unknown activation, not an
+unrelated task or evidence that the owned task is absent. All owned
tasks are disabled with checked calls and independent exact-set readback before
systemd stop. A partial stop/disable stays stopped/disabled: do not re-enable or
automatically restart after a refusal.
@@ -48,7 +50,7 @@ succeeded. No favourable replacement observation, task recreation or credential
churn is performed. Unrelated tasks survive unchanged.
`TestInstallSHTrueNASScaleBootTasksRetireBeforeRecoveryErasure` requires all
-fifteen `agent_truenas_teardown.py` actual-function/full-caller controls,
+sixteen `agent_truenas_teardown.py` actual-function/full-caller controls,
including multiple tasks, partial/refused/unknown operations, post-remote
changes, ignored/recreated deletion, process privacy and a real timeout child.
These run against closed middleware/systemd/process models and private ordinary-
diff --git a/scripts/install.sh b/scripts/install.sh
index 82134ddf26..91bf5cb06e 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1754,6 +1754,8 @@ try:
if script is None: script = ""
if command is None: command = ""
if not isinstance(script, str) or not isinstance(command, str): raise ValueError("invalid activation")
+ if (kind == "SCRIPT" and not script) or (kind == "COMMAND" and not command):
+ raise ValueError("missing activation target")
if script == expected:
if (kind != "SCRIPT" or command or task.get("when") != "POSTINIT" or
task.get("comment") != "Pulse Agent Bootstrap" or type(task.get("timeout")) is not int or
diff --git a/scripts/installtests/agent_truenas_teardown.py b/scripts/installtests/agent_truenas_teardown.py
index b5542df5b8..624ed9293a 100644
--- a/scripts/installtests/agent_truenas_teardown.py
+++ b/scripts/installtests/agent_truenas_teardown.py
@@ -116,6 +116,9 @@ if verb == 'initshutdownscript.query':
if fault == 'string-enabled': tasks[0]['enabled'] = 'false'
if fault == 'foreign-owner': tasks[0]['comment'] = 'not owned by Pulse'
if fault == 'wrong-kind': tasks[0]['type'] = 'UNKNOWN'
+ if fault == 'missing-script': tasks[0].pop('script')
+ if fault == 'null-script': tasks[0]['script'] = None
+ if fault == 'empty-command': tasks[0].update(type='COMMAND', script='', command='')
if fault == 'command-bootstrap': tasks[0].update(type='COMMAND', script='', command='/bin/bash ' + str(root / 'state/bootstrap-pulse-agent.sh'))
if fault == 'other-bootstrap': tasks[0]['script'] = '/other-install/bootstrap-pulse-agent.sh'
if fault == 'diagnostic-query': print('read unavailable', file=sys.stderr)
@@ -280,6 +283,13 @@ remove_safe_profile_state_dir() { rm -rf -- "$SAFE_PROFILE_STATE_DIR"; }
self.assertNotIn('remote:remove', events)
self.assertFalse(any(e.startswith('task:disable:') or e.startswith('task:delete:') for e in events))
+ def test_missing_activation_target_cannot_hide_an_owned_task(self):
+ for fault in ('missing-script', 'null-script', 'empty-command'):
+ with self.subTest(fault=fault):
+ events = self.retained(self.exercise(fault))
+ self.assertNotIn('remote:remove', events)
+ self.assertFalse(any(e.startswith('task:disable:') or e.startswith('task:delete:') for e in events))
+
def test_bootstrap_symlink_directory_or_writable_file_refuses_before_mutation(self):
for bootstrap in ('linked', 'directory', 'writable'):
with self.subTest(bootstrap=bootstrap):
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 928e005506..635f494f41 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -8516,6 +8516,7 @@ func TestInstallSHTrueNASScaleBootTasksRetireBeforeRecoveryErasure(t *testing.T)
for _, name := range []string{
"test_unavailable_or_untrusted_task_inventory_cannot_remove_recovery",
"test_foreign_or_indirect_bootstrap_is_not_mutated",
+ "test_missing_activation_target_cannot_hide_an_owned_task",
"test_bootstrap_symlink_directory_or_writable_file_refuses_before_mutation",
"test_missing_tools_are_not_local_only_removal_permission",
"test_every_matching_task_is_disabled_and_independently_observed_before_stop",
@@ -8534,7 +8535,7 @@ func TestInstallSHTrueNASScaleBootTasksRetireBeforeRecoveryErasure(t *testing.T)
t.Fatalf("TrueNAS SCALE control %s did not pass:\n%s", name, output)
}
}
- if !strings.Contains(string(output), "\nRan 15 tests in ") || !strings.Contains(string(output), "\nOK\n") {
+ if !strings.Contains(string(output), "\nRan 16 tests in ") || !strings.Contains(string(output), "\nOK\n") {
t.Fatalf("incomplete TrueNAS SCALE verdict:\n%s", output)
}
t.Logf("%s", output)