Repository navigation
insbx: a ready-made Claude Code policy; the offline account may read the program it runs (closes #40) - #87
Merged
Merged
Conversation
…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.
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.
Closes #40.
crates/sandbox/policies/claude-code.tomlMeasured on Windows 11 with Claude Code 2.1.323, network proxy, natively, as
insbx-offline:claude -p "…pong", allow =api.anthropic.comonlyhello.txtwritten--allowedTools Write --add-dir <outside>EPERM, nothing writtenapi.anthropic.comrefused in a loop until the wall limitCLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1The policy:
.and~/.claude.CLAUDE_CONFIG_DIR=~/.claudekeeps.claude.jsonthere. Claude saves that file by renaming a temp file into its folder, so granting~/.claude.jsonalone could never work.api.anthropic.comonly. 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).Two insbx changes it needed
~/.local/bin/claude.exefailed with "not found", unlesssetup-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] setvalues~,~/…and~\…are the home directory, as policy paths already were. A shared policy can then sayCLAUDE_CONFIG_DIR = "~/.claude".Both README examples that granted
~/.claude.jsonare fixed.Tests (Windows)
clippy
-D warningsclean. Sandbox crate: 84 unit tests, including new ones for reading the program,~inset, 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).