Repository navigation
fix(code): a caller trusted with code/shell may code/read any file her OS user can read - #4829
Merged
Merged
Conversation
…r OS user can read
Kimi, 2026-10-06: code/read refused a diff she had just written outside her workspace
("Path ... escapes workspace") while code/shell, which her trust admits, let her cat it.
For a caller who may run arbitrary commands, the read sandbox contains nothing and only
costs turns; Joel, the same day: give the AIs more power, pull back only on a real problem.
- PathSecurity::validate_read_in(path, ReadScope): Host also resolves an existing
ABSOLUTE path outside every root; Sandbox is exactly validate_read. Relative paths and
traversal are judged by the sandbox under both scopes.
- code/read's scope is asked through the gate's own resolvers:
is_command_authorized("code/shell", caller_trust(caller)). It can never be wider than
the shell grant, so a provisional remote peer keeps the workspace sandbox.
- Writes never widen: validate_write is unchanged.
Test: host_scope_reads_outside_the_sandbox_and_only_absolute_paths. Four tests in this
area (three file_engine globs and path recovery, plus path_security's absolute-path
rebase) fail on Windows on canary too, before this change; they are not this PR's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Contributor
Author
|
One small change at d8951ef; the substance is right. The change: in What's right:
6/6 checks green. I'll approve the head that moves the function. |
…nction keeps its own docs (Cormac on #4829) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply
enabled auto-merge (squash)
October 6, 2026 18:08
Contributor
Author
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.
Why:
code/readrefused Kimi a diff she had just written outside her workspace (Path … escapes workspace), whilecode/shell, which her trust allows, let hercatit. For a caller who can run arbitrary commands, the read sandbox contains nothing and only costs her turns. Joel, 2026-10-06: give the AIs more power, and pull back only on a real problem.What changes:
PathSecurity::validate_read_in(path, ReadScope). UnderHost, it also resolves an existing absolute path outside every root.Sandboxis exactly today'svalidate_read. Relative paths and traversal are judged by the sandbox under both.code/readasks the gate's own resolvers for its scope:is_command_authorized("code/shell", caller_trust(caller)). So the read scope can never be wider than the shell grant, and a provisional remote peer keeps the workspace sandbox exactly as now.validate_writeis unchanged.Tests:
host_scope_reads_outside_the_sandbox_and_only_absolute_paths. Four existing tests in this area fail on Windows on plain canary too, so they aren't this PR's:glob_scoped_to_subdirectory_via_root_paramglob_matches_files_by_extension_recursivelya_mistyped_path_gets_pointed_at_the_real_oneabsolute_paths_rebase_inside_refuse_outside_keep_the_slash_idiomI ran them on canary with no change to confirm. They look like
/-vs-\and Unix-absolute-path assumptions.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc