fix(codex): preserve read-only approval floors · openclaw/openclaw@765477d
joshavant
·
2026-05-29
·
via Recent Commits to openclaw:main
File tree
extensions/codex/src/app-server
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1318,6 +1318,45 @@ allowed_sandbox_modes = ["read-only", "workspace-write"]
|
1318 | 1318 | ); |
1319 | 1319 | }); |
1320 | 1320 | |
| 1321 | +it("preserves explicit read-only sandbox for host exec approval ask floors", () => { |
| 1322 | +const execPolicy = resolveOpenClawExecPolicyForCodexAppServer({ |
| 1323 | +config: { |
| 1324 | +tools: { |
| 1325 | +exec: { |
| 1326 | +mode: "full", |
| 1327 | +}, |
| 1328 | +}, |
| 1329 | +}, |
| 1330 | +approvals: { |
| 1331 | +version: 1, |
| 1332 | +defaults: { |
| 1333 | +ask: "always", |
| 1334 | +}, |
| 1335 | +agents: {}, |
| 1336 | +}, |
| 1337 | +}); |
| 1338 | + |
| 1339 | +expect(execPolicy.mode).toBe("ask"); |
| 1340 | +expectRuntimePolicy( |
| 1341 | +resolveRuntimeForTest({ |
| 1342 | +pluginConfig: { |
| 1343 | +appServer: { |
| 1344 | +mode: "yolo", |
| 1345 | +approvalPolicy: "never", |
| 1346 | +sandbox: "read-only", |
| 1347 | +approvalsReviewer: "auto_review", |
| 1348 | +}, |
| 1349 | +}, |
| 1350 | + execPolicy, |
| 1351 | +}), |
| 1352 | +{ |
| 1353 | +approvalPolicy: "on-request", |
| 1354 | +sandbox: "read-only", |
| 1355 | +approvalsReviewer: "user", |
| 1356 | +}, |
| 1357 | +); |
| 1358 | +}); |
| 1359 | + |
1321 | 1360 | it("applies agent-scoped exec approval security floors before starting Codex app-server", () => { |
1322 | 1361 | const execPolicy = resolveOpenClawExecPolicyForCodexAppServer({ |
1323 | 1362 | config: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -464,6 +464,7 @@ export function resolveCodexAppServerRuntimeOptions(
|
464 | 464 | ? undefined |
465 | 465 | : forceDangerFullAccessSandbox |
466 | 466 | ? selectForcedDangerFullAccessSandbox({ |
| 467 | + configuredSandbox, |
467 | 468 | defaultPolicy, |
468 | 469 | openClawSandboxActive: params.openClawSandboxActive === true, |
469 | 470 | }) |
@@ -1074,9 +1075,13 @@ function selectForcedPromptingSandbox(params: {
|
1074 | 1075 | } |
1075 | 1076 | |
1076 | 1077 | function selectForcedDangerFullAccessSandbox(params: { |
| 1078 | +configuredSandbox?: CodexAppServerSandboxMode; |
1077 | 1079 | defaultPolicy: CodexAppServerDefaultPolicy | undefined; |
1078 | 1080 | openClawSandboxActive: boolean; |
1079 | 1081 | }): CodexAppServerSandboxMode { |
| 1082 | +if (params.configuredSandbox === "read-only") { |
| 1083 | +return "read-only"; |
| 1084 | +} |
1080 | 1085 | if (params.defaultPolicy?.dangerFullAccessAllowed === false) { |
1081 | 1086 | if (params.openClawSandboxActive) { |
1082 | 1087 | return params.defaultPolicy.sandbox ?? "workspace-write"; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。