fix(qa): isolate packaged mock auth bootstrap (#126247)

* fix(qa): isolate packaged mock auth config

Punchcard-Session: frost-orchard-lantern-ze
(cherry picked from commit 648bd40a4f)

* fix(qa): scrub inherited shell startup env

* fix(qa): block exported Bash functions
This commit is contained in:
Vincent Koc
2026-08-21 06:51:34 +08:00
committed by GitHub
parent 40e3ab8784
commit fa71a6f27b
6 changed files with 192 additions and 40 deletions
@@ -925,24 +925,22 @@ describe("release Telegram QA workflow", () => {
);
expect(createSut).not.toContain('chmod 0711 "$temp_root"');
expect(createSut).not.toContain('chmod 1777 "$temp_root"');
expect(createSut).toContain('"${temp_root}/state/qa-auth-bootstrap/openclaw.json")');
expect(createSut).toContain(
'"$(stat -c \'%F:%a:%u:%g\' "$requested_config_path")" == "regular file:600:${SUT_UID}:${SUT_GID}"',
);
});
it("adds an empty PS1 only after attested runtime environment verification", () => {
it("does not defer Bash startup cleanup to the privileged launcher", () => {
const createSut = requireRun(
"run_telegram",
"Create isolated Telegram SUT identity and launcher",
);
const launcher = extractHereDocument(createSut, "LAUNCHER");
const verification = '[[ "$actual_env_keys_b64" == "$runtime_expected_env_keys_b64" ]]';
const ps1Export = "export PS1=";
const candidateExec = 'exec "$runtime_node_bin" "${runtime_node_args[@]}"';
expect(launcher.match(/export PS1=/gu)).toHaveLength(1);
expect(launcher.indexOf(verification)).toBeGreaterThan(-1);
expect(launcher.indexOf(ps1Export)).toBeGreaterThan(launcher.indexOf(verification));
expect(launcher.indexOf(candidateExec)).toBeGreaterThan(launcher.indexOf(ps1Export));
expect(launcher.match(/exec "\$runtime_node_bin"/gu)).toHaveLength(1);
expect(launcher).toContain('grep -Ev "^(PWD|SHLVL|_)$"');
expect(launcher).not.toContain("export PS1=");
expect(launcher).not.toContain("export -n BASHOPTS SHELLOPTS");
expect(launcher).not.toContain("unset BASH_ENV ENV");
});
it("mounts an isolated SUT-owned tmp without exposing the host tmp tree", () => {