fix(sandbox): make /workspace bind mount read-only when workspaceAccess is not rw
This ensures that when workspaceAccess is set to 'ro' or 'none', the sandbox workspace (/workspace inside the container) is mounted as read-only, matching the documented behavior. Previously, the condition was: workspaceAccess === 'ro' && workspaceDir === agentWorkspaceDir This was always false in 'ro' mode because workspaceDir equals sandboxWorkspaceDir, not agentWorkspaceDir. Now the logic is simplified: - 'rw': /workspace is writable - 'ro': /workspace is read-only - 'none': /workspace is read-only
This commit is contained in:
parent
905c3357eb
commit
903e4dff35
@ -452,8 +452,7 @@ async function createSandboxContainer(params: {
|
||||
bindSourceRoots: [workspaceDir, params.agentWorkspaceDir],
|
||||
});
|
||||
args.push("--workdir", cfg.workdir);
|
||||
const mainMountSuffix =
|
||||
params.workspaceAccess === "ro" && workspaceDir === params.agentWorkspaceDir ? ":ro" : "";
|
||||
const mainMountSuffix = params.workspaceAccess === "rw" ? "" : ":ro";
|
||||
args.push("-v", `${workspaceDir}:${cfg.workdir}${mainMountSuffix}`);
|
||||
if (params.workspaceAccess !== "none" && workspaceDir !== params.agentWorkspaceDir) {
|
||||
const agentMountSuffix = params.workspaceAccess === "ro" ? ":ro" : "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user