Repository navigation
Conversation
|
The core idea is sound: The problem is everything else. This PR's diff is +1488/-13 across 8 files, but the body says the actual incremental change versus PR #1506 is only 3 files / +59/-8. The rest — Please either:
As submitted, this isn't reviewable as the "nested apply_patch" fix the title promises. |
canonicalizePath now walks up only for genuinely-missing paths (ENOENT/ENOTDIR) and rethrows permission errors and symlink loops. Replace the root-unsafe slice with path.basename. guardFileSystem refuses strict confinement when a custom adapter lacks a compatible canonicalizer. handleToolCall resolves file-path targets again and refuses an unverifiable mutating target under --project-only. Exempt the audited CLI ask_user UI override from the external-tool gate while keeping MCP/custom name collisions external. Document that projectOnly is not an OS boundary. Tests cover root-boundary canonicalization, fail-closed realpath errors, the adapter refusal, and ask_user under all four permission modes.
Add a top-level regression that goes through CodebuffClient.run with a restricted policy, spawns a child through the real spawn_agents handler, and proves the child's inherited requestToolCall denies shell and writes. This is the end-to-end inheritance check requested in review, beyond the handler-level unit tests.
Exercise the nested apply_patch target check in project-only mode: in-project paths dispatch, out-of-project and symlink-escape paths are rejected, and a malformed target with no path fails closed. The write override is explicitly trusted so the test isolates target confinement from host trust.
6611d08 to
7d88eb1
Compare
Validate nested
apply_patchtargetsThe execution policy must check the target nested in an
apply_patchcall'soperation.path. This follow-up resolves that path against the project root before dispatch: in-project targets are allowed, and outside-project targets are rejected before the write override runs. The regression test explicitly grants external-tool trust so it verifies target confinement after host trust has been granted.PR branch and scope
mainsecurity/1450-apply-patch-target-review-r26611d08c6d6a1017f9a7fa9e12b48d5183883fac3cf2370efebb951527139963ec3501d208f9003c.764e46286target-path validation and6611d08c6trusted-override regression.GitHub does not support stacked pull requests across forks, so this follow-up targets upstream
main; its displayed diff includes the prerequisite SDK change until #1506 is merged. The incremental compare above shows this follow-up's scope.Verification
The complete stacked suite passed 98 tests across 9 files, including both
apply_patchtarget tests. No typecheck diagnostic was reported in changed files.Inference for this contribution was provided by FreeInference.org. FreeInference did not review, direct, approve, or otherwise participate in this work; all implementation, testing, and publication decisions are the contributor's own. If you find this useful, consider donating to FreeInference.org — they provide a useful and vital service.