Verify the quoted lifecycle child without weakening identity assertions

The focused executable probes passed, but four legacy wording/outer-quoting assertions failed. Decode the exact POSIX-quoted Bash child before asserting the existing full identity literals, and pin the truthful token-entry ordering text. Runtime source and its parent-bound browser receipt are unchanged.

Change-source: pulse-maintainer
This commit is contained in:
pulse-triage[bot]
2026-10-01 14:13:21 +01:00
parent b21f086e85
commit b66e774ff8
4 changed files with 17 additions and 9 deletions
@@ -277,9 +277,7 @@ describe('infrastructure operations model', () => {
'Use Availability checks for ping-only or agentless device monitoring.',
);
expect(infrastructureInstallerSectionSource).toContain('checks this Pulse URL and');
expect(infrastructureInstallerSectionSource).toContain(
'before asking for administrator privileges',
);
expect(infrastructureInstallerSectionSource).toContain('before reading a Unix token');
expect(infrastructureInstallerSectionSource).toContain(
'For Proxmox, start with a dedicated read-only or narrowly scoped API token',
);
@@ -1,3 +1,4 @@
import { unixBootstrapTestSource } from '@/utils/__tests__/unixBootstrapTestSource';
import { execFileSync } from 'node:child_process';
import { useInfrastructureOperationsState } from '../useInfrastructureOperationsState';
import { describe, expect, it, vi } from 'vitest';
@@ -392,8 +393,8 @@ describe('Agent Doctor model', () => {
expect(install).toContain('--enable-privileged-helper');
expect(install).toContain('--enable-action-runner');
expect(install).toContain('--action-token-file');
expect(install).toContain("--agent-id 'host-1'");
expect(install).toContain("--hostname 'host-1.local'");
expect(unixBootstrapTestSource(install)).toContain("--agent-id 'host-1'");
expect(unixBootstrapTestSource(install)).toContain("--hostname 'host-1.local'");
expect(install).toContain("--cacert '/etc/pulse/ca.pem'");
expect(install).not.toContain(secret);
expect(install).not.toContain('--action-token ');
@@ -1,3 +1,4 @@
import { unixBootstrapTestSource } from '@/utils/__tests__/unixBootstrapTestSource';
import { createRoot } from 'solid-js';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { Connection } from '@/api/connections';
@@ -308,8 +309,8 @@ describe('useInfrastructureOperationsState command-building closures', () => {
};
const cmd = state.getUninstallCommand(row);
expect(cmd).toContain("--agent-id 'act-9'");
expect(cmd).toContain("--hostname 'host-9'");
expect(unixBootstrapTestSource(cmd)).toContain("--agent-id 'act-9'");
expect(unixBootstrapTestSource(cmd)).toContain("--hostname 'host-9'");
expect(cmd).not.toContain('agent-9');
dispose();
});
@@ -321,8 +322,8 @@ describe('useInfrastructureOperationsState command-building closures', () => {
const row: AgentUninstallIdentity = { agentId: 'agent-7', hostname: 'host-7' };
const cmd = state.getUninstallCommand(row);
expect(cmd).toContain("--agent-id 'agent-7'");
expect(cmd).toContain("--hostname 'host-7'");
expect(unixBootstrapTestSource(cmd)).toContain("--agent-id 'agent-7'");
expect(unixBootstrapTestSource(cmd)).toContain("--hostname 'host-7'");
dispose();
});
@@ -0,0 +1,8 @@
// Decode exactly the single-quoted Bash -c argument, including POSIX apostrophe
// escapes. Consumers can assert its actual source without depending on the
// extra outer quoting layer. Executable PTY tests separately pin real argv.
export const unixBootstrapTestSource = (command: string): string => {
const child = /bash -c ('(?:[^']|'"'"')*') pulse-bootstrap "\$install_script";/.exec(command);
if (!child) throw new Error('Expected a single-quoted private Unix bootstrap child');
return child[1].slice(1, -1).replaceAll(`'"'"'`, "'");
};