Skip to content

Commit 040beef

Browse files
committed
fix(sandbox): restore workspace-write for task --write (revert openai#471's danger-full-access)
openai#471 (commit a6e501a) mapped --write to danger-full-access. Under approvalPolicy: never that removes all containment — --write silently grants full host-filesystem authority. Adversarial review flagged it as a privilege expansion (confidence 0.99). Reverting to workspace-write as in upstream main; asked the openai#471 author for the intent behind the change (openai#471 issuecomment-4991428428).
1 parent 1977031 commit 040beef

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

plugins/codex/scripts/codex-companion.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ async function executeTaskRun(request) {
491491
defaultPrompt: resumeThreadId ? DEFAULT_CONTINUE_PROMPT : "",
492492
model: request.model,
493493
effort: request.effort,
494-
sandbox: request.write ? "danger-full-access" : "read-only",
494+
sandbox: request.write ? "workspace-write" : "read-only",
495495
onProgress: request.onProgress,
496496
persistThread: true,
497497
threadName: resumeThreadId ? null : buildPersistentTaskThreadName(request.prompt || DEFAULT_CONTINUE_PROMPT)

tests/runtime.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ test("write task output focuses on the Codex result without generic follow-up hi
736736
assert.equal(result.stdout, "Handled the requested task.\nTask prompt accepted.\n");
737737
});
738738

739-
test("task --write starts Codex with unrestricted sandbox access", () => {
739+
test("task --write starts Codex with workspace-write sandbox", () => {
740740
const repo = makeTempDir();
741741
const binDir = makeTempDir();
742742
const statePath = path.join(binDir, "fake-codex-state.json");
@@ -750,10 +750,10 @@ test("task --write starts Codex with unrestricted sandbox access", () => {
750750

751751
assert.equal(result.status, 0, result.stderr);
752752
const state = JSON.parse(fs.readFileSync(statePath, "utf8"));
753-
assert.equal(state.lastThreadStart.sandbox, "danger-full-access");
753+
assert.equal(state.lastThreadStart.sandbox, "workspace-write");
754754
});
755755

756-
test("resuming task --write upgrades the thread to unrestricted sandbox access", () => {
756+
test("resuming task --write upgrades the thread to workspace-write sandbox", () => {
757757
const repo = makeTempDir();
758758
const binDir = makeTempDir();
759759
const statePath = path.join(binDir, "fake-codex-state.json");
@@ -773,7 +773,7 @@ test("resuming task --write upgrades the thread to unrestricted sandbox access",
773773

774774
assert.equal(result.status, 0, result.stderr);
775775
const state = JSON.parse(fs.readFileSync(statePath, "utf8"));
776-
assert.equal(state.lastThreadResume.sandbox, "danger-full-access");
776+
assert.equal(state.lastThreadResume.sandbox, "workspace-write");
777777
});
778778

779779
test("task --resume acts like --resume-last without leaking the flag into the prompt", () => {

0 commit comments

Comments
 (0)