fix(agent): separate Claude tool process authority - #3116
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 863c020. Security Overview
Detected Code Changes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 863c0207e9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| resolved_parent = candidate.parent.resolve(strict=True) | ||
| resolved_parent.relative_to(host_root) |
There was a problem hiding this comment.
Make native Write/Edit path enforcement atomic
When a UID 1001 Bash or stdio MCP process can modify a directory beneath /work concurrently, it can replace a directory component with a symlink after resolved_parent is validated but before Claude's UID 1000 native Write/Edit tool opens the returned path. The native operation then follows the new symlink and can modify Claude-private state under /home/agent, defeating the authority separation; the path must be enforced atomically with the mutation rather than checked in this separate hook.
Useful? React with 👍 / 👎.
Summary
/workas the only writable filesystem shared by both identities/workStack
Verification
CAP_SETUID; tool UID 1001 has no capabilities; private homes are mutually inaccessible;/workremains sharedMerge blocker
This PR is intentionally a draft. The required race exercise proved that PreToolUse path validation is not atomic with Anthropic's native Write/Edit execution: a concurrent UID 1001 process can replace a validated
/workdirectory component with a pre-created symlink before UID 1000 performs the mutation, causing the operation to reach Claude's private home.Do not merge until native mutation is made atomic with path enforcement or authoritative session state is moved outside Claude's writable home. Mount-wide
nosymfollowis not included because it would disable legitimate symlink use throughout/work.Summary by cubic
Isolates Claude from model-controlled tools by running Claude as UID 1000 with a private home and demoting Bash and stdio MCP processes to UID 1001 with no capabilities, sharing only /work. Tightens runtime to a fail-closed tool inventory and enforces safe filesystem writes per ENG-1552.
New Features
Dependencies
uidmap; createtoolsuser (UID 1001) and subordinate UID range forapiuser; validatenewuidmapand/etc/subuidat runtime.Written for commit 863c020. Summary will update on new commits.