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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Emit the private reader once and exercise the real caller prompts
pulse-triage[bot]14b9b3fbaca6
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.mdindex 73932f39db..9c83d2411f 100644--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md@@ -9551,6 +9551,12 @@ Sudo validation occurs before download; download and unprivileged preflightstill precede privileged installation. Token-optional and saved-state updatepaths need no terminal or replacement credential.+Root/sudo dispatch emits the quoted private reader only once via an isolated+POSIX positional-argument prefix. Normal quoted URL/profile/identity variants+remain below the common 4096-byte terminal line boundary. Actual interactive+PTY controls wait for the caller prompt before pasting and before exiting, so+startup truncation or a queued exit is not mistaken for a reader failure.+The frontend reader selects standalone `stty`, or `busybox stty` when standalone`stty` is absent, and uses the same selected utility to restore terminal modes.Missing terminal, missing/unsupported utility, unreadable settings, echo-disablediff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 538a6bdcec..627ca0c045 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -12048,6 +12048,12 @@ and ancestor trust. The Linux/NAS and FreeBSD cards explain this existing privatand does not put credentials in GUI command fields. It does not claim a GUI cancreate private files or establish native appliance installation.+Root/sudo dispatch emits the quoted private reader only once via an isolated+POSIX positional-argument prefix. Normal quoted URL/profile/identity variants+remain below the common 4096-byte terminal line boundary. Actual interactive+PTY controls wait for the caller prompt before pasting and before exiting, so+startup truncation or a queued exit is not mistaken for a reader failure.+The frontend terminal reader can select `busybox stty` only when standalone`stty` is absent. It distinguishes missing TTY, absent/unsupported tool andmode-save/echo-disable/restoration failures, refuses unsafe entry/installation,diff --git a/frontend-modern/browser-tests/unix-private-install.cjs b/frontend-modern/browser-tests/unix-private-install.cjsindex 3c8c10a1fb..62f3566191 100644--- a/frontend-modern/browser-tests/unix-private-install.cjs+++ b/frontend-modern/browser-tests/unix-private-install.cjs@@ -211,6 +211,7 @@ const hash = (bytes) => crypto.createHash('sha256').update(bytes).digest('hex');await activate(fileCopy);const linuxCard = page.getByRole('heading', { name: 'Install on Linux', exact: true })+ .locator('..').locator('..');assert.match(await linuxCard.innerText(), /BusyBox/);assert.match(await linuxCard.innerText(), /root-owned/);diff --git a/frontend-modern/src/components/Settings/__tests__/useInfrastructureOperationsState.branchcov0722pm.test.tsx b/frontend-modern/src/components/Settings/__tests__/useInfrastructureOperationsState.branchcov0722pm.test.tsxindex 18254c397a..0a3fe7187c 100644--- a/frontend-modern/src/components/Settings/__tests__/useInfrastructureOperationsState.branchcov0722pm.test.tsx+++ b/frontend-modern/src/components/Settings/__tests__/useInfrastructureOperationsState.branchcov0722pm.test.tsx@@ -167,7 +167,8 @@ describe('useInfrastructureOperationsState command-building closures', () => {state.setCustomAgentUrl(HTTPS_URL);const cmd = state.getUninstallCommand();expect(cmd).toContain('--uninstall');- expect(cmd).toContain('sudo bash -c');+ expect(cmd).toContain('set -- sudo');+ expect(cmd).toContain('\"$@\" bash -c');expect(cmd).not.toContain('--preflight-only');expect(cmd).not.toContain('| bash');expect(cmd).not.toContain("--token '");@@ -634,7 +635,8 @@ describe('useInfrastructureOperationsState command-building closures', () => {const cmd = state.getAgentConnectionUpgradeCommand(baseConnection, [], 'linux');expect(cmd).toContain('--update');- expect(cmd).toContain('sudo bash -c');+ expect(cmd).toContain('set -- sudo');+ expect(cmd).toContain('\"$@\" bash -c');expect(cmd).not.toContain('--token-file');expect(cmd).not.toContain('token_dir=');dispose();diff --git a/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts b/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.tsindex 5f203970eb..88bf145b14 100644--- a/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts+++ b/frontend-modern/src/features/docs/__tests__/troubleshootingEntryGuide.test.ts@@ -44,7 +44,7 @@ describe('troubleshooting workflow entry', () => {const section = entry();const link = section.querySelector('a');expect(link?.getAttribute('href')).toBe('/docs/VM_DISK_MONITORING#backup-safety');- expect(section.querySelectorAll('li')).toHaveLength(9);+ expect(section.querySelectorAll('li')).toHaveLength(10);expect(section.querySelector('pre')).toBeNull();const beforeList = [...section.children].slice(@@ -62,30 +62,32 @@ describe('troubleshooting workflow entry', () => {it('keeps server updates, workload updates and reporting acceptance distinct', () => {const section = entry();- const rows = section.querySelectorAll('li');- expect(prose(rows[1] as HTMLElement)).toContain(- 'An update of a monitored container is a different job',- );- const updateLinks = [...rows[1].querySelectorAll('a')].map((link) => link.getAttribute('href'));+ const row = (label: string) => {+ const rows = [...section.querySelectorAll('li')].filter((element) =>+ prose(element.querySelector('strong') as HTMLElement).startsWith(label),+ );+ expect(rows, label).toHaveLength(1);+ return rows[0] as HTMLElement;+ };+ const update = row('Update failed or its result is uncertain');+ const install = row('Agent host is missing or reporting is rejected');+ const reporting = row('Guest readings are missing or disagree');+ const memory = row('Pulse itself uses more memory, CPU or disk writes');+ expect(prose(update)).toContain('An update of a monitored container is a different job');+ const updateLinks = [...update.querySelectorAll('a')].map((link) => link.getAttribute('href'));expect(updateLinks).toEqual(['/docs/AUTO_UPDATE#update-failed','/docs/DOCKER#check-a-failed-or-pending-workload-update',]);- expect(prose(rows[1] as HTMLElement)).toContain(- 'Preserve the current state and rollback evidence',- );- expect(prose(rows[2] as HTMLElement)).toContain('Installer success is not an accepted report');- expect(prose(rows[3] as HTMLElement)).toContain(- 'a working Pulse Agent view does not prove API recovery',- );- expect(prose(rows[6] as HTMLElement)).toContain(- 'Guest usage and database size are different measurements',- );+ expect(prose(update)).toContain('Preserve the current state and rollback evidence');+ expect(prose(install)).toContain('Installer success is not an accepted report');+ expect(prose(reporting)).toContain('a working Pulse Agent view does not prove API recovery');+ expect(prose(memory)).toContain('Guest usage and database size are different measurements');});it('routes every entry to an existing shipped heading in the production viewer', () => {const links = [...entry().querySelectorAll('a[href]')];- expect(links).toHaveLength(16);+ expect(links).toHaveLength(17);for (const link of links) {const href = link.getAttribute('href')!;const match = /^\/docs\/([^#]+)#(.+)$/.exec(href);diff --git a/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts b/frontend-modern/src/utils/__tests__/agentInstallCommand.test.tsindex b56e8c0f33..c0c7be1b52 100644--- a/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts+++ b/frontend-modern/src/utils/__tests__/agentInstallCommand.test.ts@@ -31,7 +31,8 @@ describe('agentInstallCommand', () => {expect(command).toContain("--url 'http://pulse.example:7655'");expect(command).toContain('token_dir=$(mktemp -d /tmp/pulse-agent-bootstrap.XXXXXX)');- expect(command).toContain('sudo bash -c');+ expect(command).toContain('set -- sudo');+ expect(command).toContain('\"$@\" bash -c');expect(command).not.toContain('token-123');expect(command).toContain('--token-file "$token_file"');expect(command).toContain('--insecure');@@ -60,7 +61,7 @@ describe('agentInstallCommand', () => {});const preflightIndex = command.indexOf('--preflight-only');- const sudoIndex = command.indexOf('sudo bash -c');+ const sudoIndex = command.indexOf('\"$@\" bash -c');expect(command).toContain('bootstrap_dir=$(mktemp -d /tmp/pulse-bootstrap.XXXXXX)');expect(command).toContain('trap cleanup EXIT');@@ -336,6 +337,21 @@ const variants = [];describe('single-line Unix install commands', () => {+ it.each(variants)('keeps one private body below the usual terminal line limit: %j', (options) => {+ const command = buildUnixAgentInstallCommand({+ ...options,+ token: 'present',+ extraArgs: [+ '--update',+ '--enable-docker',+ "--agent-id 'agent-42'",+ "--hostname 'node.example'",+ ],+ });+ expect(Buffer.byteLength(command, 'utf8')).toBeLessThan(4096);+ expect(command.match(/bash -c /g)).toHaveLength(1);+ expect(command).toContain('set -- sudo');+ });it.each(variants)('survives text-input normalization: %j', (options) => {const command = buildUnixAgentInstallCommand(options);const input = document.createElement('input');@@ -391,7 +407,8 @@ if history:env.update(HISTFILE=history, HISTSIZE="100", HISTFILESIZE="100", HISTCONTROL="", PS1="PULSE_TEST$ ")program = ["bash", "--noprofile", "--norc", "-i"] if history else ["sh", "-c", p["command"]]child = subprocess.Popen(program, stdin=slave, stdout=slave, stderr=slave, preexec_fn=session, env=env)-if history: os.write(master, (p["command"] + "\\n").encode())+command_sent = not bool(history)+exit_sent = Falseos.close(slave)output = b""sent = False@@ -406,6 +423,17 @@ while time.monotonic() < deadline:raiseif not chunk: breakoutput += chunk+ # A human pastes after the caller's prompt. Injecting a longer command+ # while the PTY is still in its startup canonical mode can truncate it+ # before Bash has even entered readline.+ if history and not command_sent and output.endswith(b"PULSE_TEST$ "):+ os.write(master, (p["command"] + "\\n").encode())+ command_sent = True+ continue+ # Do not queue exit while the private reader/installer owns the tty.+ if history and sent and not exit_sent and output.endswith(b"PULSE_TEST$ "):+ os.write(master, b"exit\\n")+ exit_sent = True# The interactive shell's echo of the command line quotes the prompt# text too, so a chunk can end there long before the bootstrap runs.# Only the bootstrap's own stty -echo (recorded by the stty fixture)@@ -424,7 +452,6 @@ while time.monotonic() < deadline:else:os.write(master, (p["input"] + "\\n").encode())sent = True- if history: os.write(master, b"exit\\n")if child.poll() is not None and not ready: breakelse:os.killpg(child.pid, signal.SIGKILL)@@ -958,7 +985,7 @@ describe('terminal-control portability', { timeout: 25_000 }, () => {const result = runPrivateUnix(command(), 'private-input', fixture.env('0', failure));expect(result.status, result.stdout + result.stderr).not.toBe(0);expect(result.stdout).toContain(error);- expect(result.stdout).toContain('No installation was attempted');+ expect(result.stdout).toMatch(/no installation was attempted/i);expect(result.stdout).not.toMatch(/A terminal is required|command not found|deadline expired|did not restore|private-input/,);diff --git a/frontend-modern/src/utils/agentInstallCommand.ts b/frontend-modern/src/utils/agentInstallCommand.tsindex 130a54db37..c2f9f2bd42 100644--- a/frontend-modern/src/utils/agentInstallCommand.ts+++ b/frontend-modern/src/utils/agentInstallCommand.ts@@ -239,7 +239,11 @@ export const buildUnixAgentInstallCommand = ({`curl ${curlFlags}${caCertArg} ${shellQuoteArg(`${normalizedBaseUrl}/install.sh`)} -o "$install_script";`,// Detachment must not require a downloadable new agent binary....(!uninstall ? [`bash "$install_script" ${preflightArgs}${caCertArg}${insecureArg};`] : []),- `if [ "$(id -u)" -eq 0 ]; then ${child} else sudo ${child} fi;`,+ // Expand the root/sudo prefix once. Repeating the entire quoted reader+ // makes a normal pasted command exceed some terminals' canonical line+ // limit. Positional arguments live only inside this isolated subshell.+ 'if [ "$(id -u)" -eq 0 ]; then set --; else set -- sudo; fi;',+ `"$@" ${child}`,')',].join(' ');};