Repository navigation
Conversation
Additional Comments (2)
It would be safer to only return Prompt To Fix With AIThis is a comment left during a code review.
Path: src/agents/sandbox/fs-bridge.ts
Line: 161:167
Comment:
[P1] `stat()` treats *any* non-zero `stat` exit as “not found”, which can mask real errors.
`runCommand(..., { allowFailure: true })` then `if (result.code !== 0) return null;` (src/agents/sandbox/fs-bridge.ts:161-167). This collapses permission errors, missing `stat` binary, invalid paths, etc. into ENOENT behavior, which can lead to confusing fallbacks (e.g., image path rewrite) and harder debugging.
It would be safer to only return `null` for the “no such file” case and throw (or propagate stderr) for other failures.
How can I resolve this? If you propose a fix, please make it concise.
Previously, all callers effectively got If this is intentional, consider adding/adjusting a unit test to lock in the overload semantics (number vs. options object) so future refactors don’t regress it. Prompt To Fix With AIThis is a comment left during a code review.
Path: src/web/media.ts
Line: 221:229
Comment:
[P2] New `loadWebMedia()` overload defaults `optimizeImages` to `true`, which changes behavior for callers passing options objects.
Previously, all callers effectively got `optimizeImages: true`. Now object callers get `optimizeImages: options.optimizeImages ?? true` (src/web/media.ts:221-234), but number/undefined callers also force `optimizeImages: true`. This is correct, but it’s easy to miss that object callers can now disable optimization (and bypass the previous implicit behavior).
If this is intentional, consider adding/adjusting a unit test to lock in the overload semantics (number vs. options object) so future refactors don’t regress it.
How can I resolve this? If you propose a fix, please make it concise. |
fae8175 to
bdaaa6d
Compare
|
+1, this is the right direction. I've been dealing with the host-path vs container-path mismatch a lot while working with sandbox agents. The core problem is simple — exec runs inside the container, but file tools run on the host. Agents find files at My current workaround is mounting the container workspace at the exact same absolute path as the host (e.g. This PR just sidesteps all of that by running file I/O inside the container too. One execution context, no translation needed. The SandboxFsBridge abstraction is clean and the Greptile concerns from the initial review look addressed in the current diff. There are still some related path issues around bundled skills, system prompt This would fix or largely address #9560, #9348, #2432. Would love to see this move forward. |
9338578 to
24ce93f
Compare
24ce93f to
795ec6a
Compare
|
Merged via squash. Thanks @davidbors-snyk! |
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 795ec6a Co-authored-by: davidbors-snyk <[email protected]> Co-authored-by: steipete <[email protected]> Reviewed-by: @steipete
I discussed this issue with @steipete before opening the PR. This is a bigger patch. It moves sandboxed file operations from the host inside the container. This is meant as a solution to security issues that could arise from symlink race-condition attacks when file ops are performed on the host. A completely secure host-side implementation is impossible as Node.js doesn't expose
openat().Greptile Overview
Greptile Summary
This PR introduces a
SandboxFsBridgethat routes sandboxed file operations throughdocker execinside the sandbox container rather than performing them on the host. Call sites for apply_patch, read/write/edit, and image loading were updated to use the bridge when sandboxed, andloadWebMediawas extended to support a customreadFileoverride.Overall this aligns with the repo’s sandbox architecture by making file reads/writes occur in the same isolated environment as other sandboxed execution, reducing host-side TOCTOU/symlink race exposure.
Main things to double-check are API surface consistency (
execDockervsexecDockerRawcancellation), and error handling granularity in the new bridge (especially where errors are currently collapsed to “not found”).Confidence Score: 4/5
execDockersignature, and (2)stat()masking non-ENOENT errors as null, which can hide operational failures. No obvious security regressions were found in the new shell scripts (arguments are passed positionally and quoted).(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!
Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)