Skip to content

Commit 36179dc

Browse files
authored
fix(repair): suppress target pnpmfile via npm_config env spelling (#1068)
pnpm 11 only honors npm_config_* environment settings, so the PNPM_CONFIG_IGNORE_PNPMFILE key in codexSubprocessEnv() was inert and a target repository's .pnpmfile.cjs could execute arbitrary code during repair installs (caught by the pnpm-deploy hook containment test). Scripts suppression only survived through the redundant npm_config_ignore_scripts key. Add npm_config_ignore_pnpmfile alongside the retained PNPM_CONFIG_* belt-and-braces keys, and make the test's unsafe-pnpmfile leg disable the spelling pnpm actually reads.
1 parent 62acb03 commit 36179dc

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ checkpoint, and status-only commits are intentionally omitted.
180180

181181
### Fixed
182182

183+
- Codex subprocess containment now actually suppresses target `.pnpmfile.cjs` execution: pnpm 11 only honors `npm_config_*` environment settings, so the previously used `PNPM_CONFIG_IGNORE_PNPMFILE` spelling was inert and a target repository's pnpmfile could run arbitrary code during repair installs.
183184
- Reconcile observers now start only for review titles they can classify, so queue-backed `Review exact item` and support runs no longer consume runner slots merely to report `skipped`; a new hourly janitor also cancels runs stuck in `queued` for over 24 hours before they decay into uncancellable zombies.
184185
- Deployment runs waiting for human approval no longer count as runner-queue congestion in operational health: a forgotten approval gate had pinned `oldest_queued_minutes` at eight-plus days and held work-execution status away from healthy; approval-gated runs now report separately (count and oldest age) in the API and the execution alert.
185186
- Terminal command acknowledgements whose status comment was deleted (or never existed) now complete as a durable `missing_status_comment` skip instead of requeueing the finalization driver forever every ~20 minutes.

‎src/repair/process-env.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ export function codexSubprocessEnv(): NodeJS.ProcessEnv {
1919
const env: NodeJS.ProcessEnv = {
2020
...process.env,
2121
...clawsweeperGitIdentityEnv(),
22+
// pnpm 11 only honors npm_config_* env settings; keep PNPM_CONFIG_* for pnpm versions that read them.
2223
PNPM_CONFIG_IGNORE_SCRIPTS: "true",
2324
PNPM_CONFIG_IGNORE_PNPMFILE: "true",
2425
npm_config_ignore_scripts: "true",
26+
npm_config_ignore_pnpmfile: "true",
2527
};
2628
const pathKey = Object.keys(env).find((key) => key.toLowerCase() === "path") ?? "PATH";
2729
const searchPath = env[pathKey];

‎test/repair/process-env.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ test("codexSubprocessEnv forces ClawSweeper git identity and strips tokens", ()
3636
PNPM_CONFIG_IGNORE_SCRIPTS: "false",
3737
PNPM_CONFIG_IGNORE_PNPMFILE: "false",
3838
npm_config_ignore_scripts: "false",
39+
npm_config_ignore_pnpmfile: "false",
3940
},
4041
() => {
4142
const env = codexSubprocessEnv();
@@ -59,6 +60,7 @@ test("codexSubprocessEnv forces ClawSweeper git identity and strips tokens", ()
5960
assert.equal(env.PNPM_CONFIG_IGNORE_SCRIPTS, "true");
6061
assert.equal(env.PNPM_CONFIG_IGNORE_PNPMFILE, "true");
6162
assert.equal(env.npm_config_ignore_scripts, "true");
63+
assert.equal(env.npm_config_ignore_pnpmfile, "true");
6264
assert.equal(internalCodexModel("internal"), "secret-model");
6365
assert.deepEqual(codexModelArgs("internal"), []);
6466
assert.deepEqual(codexModelArgs("secret-model"), []);
@@ -160,6 +162,7 @@ test("Codex subprocess prevents pnpm deploy from installing target Git hooks", (
160162
const unsafePnpmfile = deploy("unsafe-pnpmfile", {
161163
...codexSubprocessEnv(),
162164
PNPM_CONFIG_IGNORE_PNPMFILE: "false",
165+
npm_config_ignore_pnpmfile: "false",
163166
});
164167
assert.equal(unsafePnpmfile.status, 0, unsafePnpmfile.stderr || unsafePnpmfile.stdout);
165168
assert.equal(git("config", "--local", "--get", "core.hooksPath"), "git-hooks");

0 commit comments

Comments
 (0)