Repository navigation
Conversation
This was referenced Feb 22, 2026
Contributor
Author
|
Note on Windows CI failure: The `checks-windows (node, test)` failure is a pre-existing issue on main — not caused by this PR. Fix: #23128 |
dashed
force-pushed
the
alberto/sandbox-fs-bridge-user
branch
from
February 22, 2026 04:08
cf9a7db to
2cb5c2e
Compare
…ssion denied When capDrop: ['ALL'] is used, root lacks DAC_OVERRIDE. The workspace directory (/workspace) is owned by uid 1000 with mode 0700, so docker exec as root gets 'Permission denied'. Propagate the docker.user field through all exec paths: - fs-bridge.ts: add -u flag to runCommand docker exec - bash-tools.shared.ts: add user param to buildDockerExecArgs - bash-tools.exec-runtime.ts: pass sandbox.user to buildDockerExecArgs - pi-tools.ts: pass sandbox.docker.user to sandbox config - docker.ts: add -u flag to setupCommand exec
dashed
force-pushed
the
alberto/sandbox-fs-bridge-user
branch
from
February 22, 2026 05:20
2cb5c2e to
91793d8
Compare
Contributor
|
Closing as AI-assisted stale-fix triage. Linked issue #20979 ("[Bug] Default sandbox config breaks file tools for non-root gateway users (post-#4026)") is currently CLOSED and was closed on 2026-02-22T22:34:02Z with state reason COMPLETED. If the underlying bug is still reproducible on current main, please reopen this PR (or open a new focused fix PR) and reference both #20979 and #23112 for fast re-triage. |
Contributor
|
Closed after AI-assisted stale-fix triage (closed issue duplicate/stale fix). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #20979 (partially — addresses the propagation gap; see #20991 for the fallback default).
When
agents.defaults.sandbox.docker.useris configured, the value was only used bybuildSandboxCreateArgsfor the initialdocker create. All subsequentdocker execcalls — FS bridge (Read/Write/Edit tools), bash exec runtime, pi-tools sandbox config, and the container setup command — ran as root (no-uflag). WithcapDrop: ["ALL"], root lacksDAC_OVERRIDEand gets "Permission denied" on the workspace directory owned by the configured user.This PR propagates
docker.userthrough all exec paths so everydocker execincludes-u <user>.Root Cause
docker.userwas partially wired:buildSandboxCreateArgspassed--usertodocker create, but four other exec call sites constructed their owndocker execargs without consultingdocker.user:fs-bridge.ts— Read/Write/Edit/apply_patch toolsbash-tools.exec-runtime.ts— Bash tool runtimebash-tools.shared.ts(buildDockerExecArgs) — shared exec arg builderdocker.ts(createSandboxContainer) — setup commandChanges
src/agents/bash-tools.shared.ts— Adduser?: stringtobuildDockerExecArgsparams and insert-uflag:export function buildDockerExecArgs(params: { ... tty: boolean; + user?: string; }) { const args = ["exec", "-i"]; + if (params.user) { + args.push("-u", params.user); + } if (params.tty) {src/agents/bash-tools.exec-runtime.ts— Passsandbox.userthrough:tty: opts.usePty, + user: opts.sandbox.user,src/agents/sandbox/fs-bridge.ts— Insert-ubefore container name:src/agents/sandbox/docker.ts— Add-uto setup command exec:src/agents/pi-tools.ts— Passdocker.usertoBashSandboxConfig:env: sandbox.docker.env, + user: sandbox.docker.user,src/agents/bash-tools.shared.ts(type) — AddusertoBashSandboxConfig:export type BashSandboxConfig = { ... env?: Record<string, string>; + user?: string; };Relationship to #20991
This PR and #20991 are complementary:
docker.userconfigured but not propagated to execdocker.usernot configured at allBoth are needed: #20991 provides a sensible default when no user is configured, this PR ensures the configured value actually reaches all exec commands.
Test Plan
buildDockerExecArgsuser flag (bash-tools.shared.test.ts)buildSandboxCreateArgsuser flag (docker.test.ts)oxlint— 0 errorsoxfmt— cleantsgo— cleanFixes #20979
Related: #20991, #17941, #16379
Greptile Summary
This PR systematically propagates the configured
agents.defaults.sandbox.docker.uservalue to alldocker execcommands, fixing a critical permission issue whencapDrop: ["ALL"]is set.Key changes:
buildDockerExecArgsinbash-tools.shared.tsto accept and insert-uflagdocker.userbuildDockerExecArgsandbuildSandboxCreateArgsImpact:
The fix resolves permission denied errors that occurred because root (default exec user) lacks
DAC_OVERRIDEcapability whencapDrop: ["ALL"]is configured, preventing access to workspace directories owned by the configured user. All docker exec calls now run as the same user specified in the container creation.Confidence Score: 5/5
user?: string), backward-compatible (gracefully handles undefined/empty values), and include comprehensive unit tests covering edge cases (undefined, empty string, flag ordering). No breaking changes or risky refactoring.Last reviewed commit: cf9a7db