Skip to content

insbx: a ready-made Claude Code policy; the offline account may read the program it runs (closes #40) - #87

Merged
blockmandev merged 1 commit into
mainfrom
feat/insbx-read-program
Nov 13, 2026
Merged

blockmandev merged 1 commit into
mainfrom
feat/insbx-read-program

Conversation

@blockmandev

Copy link
Copy Markdown
Member

Closes #40.

crates/sandbox/policies/claude-code.toml

Measured on Windows 11 with Claude Code 2.1.323, network proxy, natively, as insbx-offline:

check result
claude -p "…pong", allow = api.anthropic.com only answered (exit 0)
Claude's Write tool in the project hello.txt written
Claude's Write tool outside the project, with --allowedTools Write --add-dir <outside> EPERM, nothing written
no hosts allowed api.anthropic.com refused in a loop until the wall limit
time, one-line answer 9 s unsandboxed; 59 s sandboxed; 22 s with CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

The policy:

  • Writes: . and ~/.claude. CLAUDE_CONFIG_DIR=~/.claude keeps .claude.json there. Claude saves that file by renaming a temp file into its folder, so granting ~/.claude.json alone could never work.
  • Network: api.anthropic.com only. Your own HTTP MCP servers' hosts must be added, or they're refused and slow the start (the remaining 22 s vs 9 s is mostly that).
  • Telemetry is switched off.

Two insbx changes it needed

  • The offline account may read the program a run was asked to start. The program is resolved the way the helper resolves it, and the read lasts the run, like the helper's own. Without it ~/.local/bin/claude.exe failed with "not found", unless setup-windows --read (administrator) opened its whole folder. A program the user can't re-ACL (System32) is left out, because it's readable already.
  • [env] set values ~, ~/… and ~\… are the home directory, as policy paths already were. A shared policy can then say CLAUDE_CONFIG_DIR = "~/.claude".

Both README examples that granted ~/.claude.json are fixed.

Tests (Windows)

clippy -D warnings clean. Sandbox crate: 84 unit tests, including new ones for reading the program, ~ in set, and the shipped policy parsing, plus 24 escape tests. Also the live runs above.

Known limit, as before: Claude Code's Bash tool (Git Bash) doesn't start under the sandbox yet (#38).

…the program it runs

Closes #40.

policies/claude-code.toml, measured on Windows 11 with Claude Code 2.1.323
under network proxy, natively:
- writes: the project and ~/.claude; CLAUDE_CONFIG_DIR=~/.claude keeps
  .claude.json there (Claude saves it by renaming a temp file into its
  folder, so ~/.claude.json alone could never be granted);
- network: api.anthropic.com only. `claude -p` answered; its Write tool
  wrote in the project; a write outside it failed with EPERM although
  Claude's own permissions (--allowedTools Write --add-dir) allowed it;
- CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1: without it a blocked
  telemetry host slowed a one-line answer from 22 s to 59 s (9 s
  unsandboxed; the rest is the user's own MCP servers being refused).

Two insbx changes it needed:
- The offline account may read the program a run was asked to start
  (resolved as the helper resolves it), per run like the helper itself.
  Without it claude.exe under ~/.local/bin could not start as the account
  ("not found") unless setup-windows --read opened its whole folder, which
  needs an administrator.
- An [env] set value of `~`, `~/...` or `~\...` is the home directory, as
  policy paths already were, so a shared policy can say
  CLAUDE_CONFIG_DIR = "~/.claude".

Both README examples that granted ~/.claude.json are fixed.
@blockmandev
blockmandev merged commit 3c1dca7 into main Nov 13, 2026
11 of 12 checks passed
@blockmandev
blockmandev deleted the feat/insbx-read-program branch November 15, 2026 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

insbx: a ready-made policy for running Claude Code (and what the Windows offline account must read)

1 participant