serve --acp applies --yolo / --auto (or permissions in config.toml)
like the TUI; before, every edit and command went to the orchestrator.
claude no longer asks to run outside the sandbox. With the sandbox on it
stays confined; only a stored claude:unsandboxed rule or
--no-claude-sandbox lets it out, and yolo never does.
The sandbox reads the files the global git config includes and may stat
$HOME and the directories above allowed paths and includeIf gitdir
paths (metadata only). git died on both before.
hx mcp-serve logs a failed start to $TMPDIR/hx-mcp-serve.log; claude
hides its stderr and only reports "mcp__hx__approve not found".
- serve --acp applies --yolo / --auto (or `permissions` in config.toml)
like the TUI; before, every edit and command went to the orchestrator.
- claude no longer asks to run outside the sandbox. With the sandbox on it
stays confined; only a stored `claude:unsandboxed` rule or
--no-claude-sandbox lets it out, and yolo never does.
- The sandbox reads the files the global git config includes and may stat
$HOME and the directories above allowed paths and includeIf gitdir
paths (metadata only). git died on both before.
- hx mcp-serve logs a failed start to $TMPDIR/hx-mcp-serve.log; claude
hides its stderr and only reports "mcp__hx__approve not found".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
johannes
added 1 commit 2026-11-17 15:48:31 +00:00
- serve --acp applies --yolo / --auto (or `permissions` in config.toml)
like the TUI; before, every edit and command went to the orchestrator.
- claude no longer asks to run outside the sandbox. With the sandbox on it
stays confined; only a stored `claude:unsandboxed` rule or
--no-claude-sandbox lets it out, and yolo never does.
- The sandbox reads the files the global git config includes and may stat
$HOME and the directories above allowed paths and includeIf gitdir
paths (metadata only). git died on both before.
- hx mcp-serve logs a failed start to $TMPDIR/hx-mcp-serve.log; claude
hides its stderr and only reports "mcp__hx__approve not found".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Here are some key observations to aid the review process:
⏱️Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪PR contains tests
🔒Security concerns
Sandbox scope widening: the sandbox now grants file-read-metadata on $HOME, parent dirs of allowed paths, and includeIf gitdir paths. It also grants read on files included by the global git config. Metadata exposure is low risk, but included git-config files can hold credentials or tokens, so confirm only the exact included files are readable and that symlinks are not followed outside the intended set. Also check config trust: if yolo can be enabled from repo-local config, untrusted repos can disable permission prompts in ACP mode.
ACP mode now sets yolo/auto from cfg.permissions. Check where cfg is loaded from. If a project-local config.toml can set permissions = "yolo", a cloned repo could silently turn off all prompts for an orchestrated run. Also check that --yolo and --auto are mutually exclusive in the CLI definition, since auto && !yolo quietly resolves the conflict.
// no TUI, no prompts: every permission question goes to the orchestrator, except what
// --yolo / --auto (or `permissions` in config.toml) settle here, the same as in the TUI
{letyolo=cli.yolo||cfg.permissions.as_deref()==Some("yolo");letauto=cli.auto||cfg.permissions.as_deref()==Some("auto");letmuta=agent.cx.state.allow.lock().unwrap_or_else(|e|e.into_inner());a.set_yolo(yolo);a.set_auto(auto&&!yolo);}
has_rule uses self.rules.contains(rule), which is an exact match. If stored rules can be globs or prefixes (the glob helper above suggests so), a pattern like claude:* will not count as claude:unsandboxed. Confirm the intent. Also confirm rules is a set of String so contains(&str) compiles and behaves as expected. The "yolo never unsandboxes" guarantee depends entirely on callers using has_rule instead of the general permission check, so add a test that pins it.
/// A stored rule (`.hx/allow.json` or "always" this session), ignoring yolo and edit grants.
pubfnhas_rule(&self,rule: &str)-> bool{self.rules.contains(rule)}
The assertion hardcodes the exact order of file-read-metadata literals in one long string. It passes only if the path list is deterministically sorted and deduplicated (for example a BTreeSet). If it is built from a HashSet or insertion order, the test will be flaky. Also, the sandbox logic that reads git-config includes and stats $HOME and ancestor dirs is not in this diff, so verify it separately.
## PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
<table>
<tr><td>⏱️ <strong>Estimated effort to review</strong>: 3 🔵🔵🔵⚪⚪</td></tr>
<tr><td>🧪 <strong>PR contains tests</strong></td></tr>
<tr><td>🔒 <strong>Security concerns</strong><br><br>
<strong>Sandbox scope widening:</strong><br> the sandbox now grants `file-read-metadata` on `$HOME`, parent dirs of allowed paths, and `includeIf gitdir` paths. It also grants read on files included by the global git config. Metadata exposure is low risk, but included git-config files can hold credentials or tokens, so confirm only the exact included files are readable and that symlinks are not followed outside the intended set. Also check config trust: if yolo can be enabled from repo-local config, untrusted repos can disable permission prompts in ACP mode.</td></tr>
<tr><td>⚡ <strong>Recommended focus areas for review</strong><br><br>
<details><summary><a href='https://git.jokresner.de/johannes/hx/src/branch/refs/pull/194/head/crates/hx-cli/src/main.rs#L1197-L1210'><strong>Unattended Auto-Approve</strong></a>
ACP mode now sets yolo/auto from `cfg.permissions`. Check where `cfg` is loaded from. If a project-local `config.toml` can set `permissions = "yolo"`, a cloned repo could silently turn off all prompts for an orchestrated run. Also check that `--yolo` and `--auto` are mutually exclusive in the CLI definition, since `auto && !yolo` quietly resolves the conflict.
</summary>
```rust
// no TUI, no prompts: every permission question goes to the orchestrator, except what
// --yolo / --auto (or `permissions` in config.toml) settle here, the same as in the TUI
{
let yolo = cli.yolo || cfg.permissions.as_deref() == Some("yolo");
let auto = cli.auto || cfg.permissions.as_deref() == Some("auto");
let mut a = agent
.cx
.state
.allow
.lock()
.unwrap_or_else(|e| e.into_inner());
a.set_yolo(yolo);
a.set_auto(auto && !yolo);
}
```
</details>
<details><summary><a href='https://git.jokresner.de/johannes/hx/src/branch/refs/pull/194/head/crates/hx-core/src/permit.rs#L405-L408'><strong>Exact-Match Rule Lookup</strong></a>
`has_rule` uses `self.rules.contains(rule)`, which is an exact match. If stored rules can be globs or prefixes (the `glob` helper above suggests so), a pattern like `claude:*` will not count as `claude:unsandboxed`. Confirm the intent. Also confirm `rules` is a set of `String` so `contains(&str)` compiles and behaves as expected. The "yolo never unsandboxes" guarantee depends entirely on callers using `has_rule` instead of the general permission check, so add a test that pins it.
</summary>
```rust
/// A stored rule (`.hx/allow.json` or "always" this session), ignoring yolo and edit grants.
pub fn has_rule(&self, rule: &str) -> bool {
self.rules.contains(rule)
}
```
</details>
<details><summary><a href='https://git.jokresner.de/johannes/hx/src/branch/refs/pull/194/head/crates/hx-core/src/sandbox.rs#L608-L610'><strong>Brittle Test</strong></a>
The assertion hardcodes the exact order of `file-read-metadata` literals in one long string. It passes only if the path list is deterministically sorted and deduplicated (for example a `BTreeSet`). If it is built from a `HashSet` or insertion order, the test will be flaky. Also, the sandbox logic that reads git-config includes and stats `$HOME` and ancestor dirs is not in this diff, so verify it separately.
</summary>
```rust
assert!(p.contains(
"(allow file-read-metadata (literal \"/home/u\") (literal \"/home/u/.cargo\") (literal \"/home/u/.cargo/registry\") (literal \"/home/u/proj\") (literal \"/home/u/w\") (literal \"/home/u/w/x\"))"
));
```
</details>
</td></tr>
</table>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
permissionsin config.toml)like the TUI; before, every edit and command went to the orchestrator.
stays confined; only a stored
claude:unsandboxedrule or--no-claude-sandbox lets it out, and yolo never does.
$HOME and the directories above allowed paths and includeIf gitdir
paths (metadata only). git died on both before.
hides its stderr and only reports "mcp__hx__approve not found".
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Preparing review...
PR Reviewer Guide 🔍
Here are some key observations to aid the review process:
Sandbox scope widening:
the sandbox now grants
file-read-metadataon$HOME, parent dirs of allowed paths, andincludeIf gitdirpaths. It also grants read on files included by the global git config. Metadata exposure is low risk, but included git-config files can hold credentials or tokens, so confirm only the exact included files are readable and that symlinks are not followed outside the intended set. Also check config trust: if yolo can be enabled from repo-local config, untrusted repos can disable permission prompts in ACP mode.Unattended Auto-Approve
ACP mode now sets yolo/auto from
cfg.permissions. Check wherecfgis loaded from. If a project-localconfig.tomlcan setpermissions = "yolo", a cloned repo could silently turn off all prompts for an orchestrated run. Also check that--yoloand--autoare mutually exclusive in the CLI definition, sinceauto && !yoloquietly resolves the conflict.Exact-Match Rule Lookup
has_ruleusesself.rules.contains(rule), which is an exact match. If stored rules can be globs or prefixes (theglobhelper above suggests so), a pattern likeclaude:*will not count asclaude:unsandboxed. Confirm the intent. Also confirmrulesis a set ofStringsocontains(&str)compiles and behaves as expected. The "yolo never unsandboxes" guarantee depends entirely on callers usinghas_ruleinstead of the general permission check, so add a test that pins it.Brittle Test
The assertion hardcodes the exact order of
file-read-metadataliterals in one long string. It passes only if the path list is deterministically sorted and deduplicated (for example aBTreeSet). If it is built from aHashSetor insertion order, the test will be flaky. Also, the sandbox logic that reads git-config includes and stats$HOMEand ancestor dirs is not in this diff, so verify it separately.