harn-sandbox-policy
БесплатноБез исполняемых скриптовНе проверенUse for the process sandbox — read/write roots, the credential denylist, the toolchain-cache environment, and the per-backend profile emission on macOS…
от burin-labs★ 34 звезды на GitHubОб этом скилле
Harn sandbox policy
The sandbox decides what a child process spawned by an agent tool call may read
and write. It has one owner, crates/harn-vm/src/stdlib/sandbox/, and three
backends that project the same CapabilityPolicy onto their platform.
Pair it with harn-agent for autonomy gating and harn-orchestration for where the policy comes from.
The three axes, which are not the same axis
Confusing these is the most common mistake here.
workspace_roots/read_only_rootsscope Harn's own file builtins (read_file,harness.fs.*), throughcheck_fs_path_scope.process_sandbox.{presets,read_roots,write_roots,read_deny_roots}scope child processes only, through the OS backend. These never widen Harn's file builtins.allow_tcp_loopbackandunix_socket_rootsare the two socket grants on this axis: loopback admits IP onlocalhost, socket roots admit Unix-domain sockets whose socket file lives under a root, and neither opens remote egress. Both are host-owned: a nested policy cannot invent them. Whether a child may write any of its writable roots isCapabilityPolicy::children_may_write: theworkspacewrite capability, orprocess_sandbox.allow_child_workspace_writefor a role that runs commands but edits nothing. Every backend reads that one predicate.sandbox_profiledecides whether either is enforced at all.enforces_path_scope()gates axis 1 and the toolchain-cache environment;confines_processes()gates axis 2.
A grant on one axis is not a grant on another, and a bug report that says "the agent cannot read X" needs to name which one before it can be diagnosed.
Adding a read root
Add it to the policy the embedder builds, or to a preset in
sandbox/mod.rs if it belongs to every run. Presets are additive and expand
per-platform in macos.rs / linux.rs / windows.rs.
Do not add a root by inferring it from the command being run. A read surface that is a function of the tool call is not auditable and fails order-dependently: the same command succeeds or fails depending on what ran before it.
Adding a denylist row
crates/harn-execution-policy/src/known_paths/known_paths.toml. One line under
[credential] home, plus a line under [credential.reason] saying why. It is
data on purpose: the sandbox denylist, the taint gate's secret-read check, the
command risk scan, and the default approval patterns all derive from it, and
credential_path_parity_tests fails if any of them misses an entry. A
credential file name that can live anywhere (*.pem) goes under
basename_globs instead; the sandbox cannot deny a name, so only the path
matchers see those.
The denylist beats every grant. PackageManagerConfig admits measured
tool roots, including credential-bearing ~/.config/composer; unknown
~/.config and ~/.cache siblings stay closed. A host's explicit parent grant
also loses to a denial. The denial is
checked before any grant in check_fs_path_scope, and it unions rather than
intersects as policies nest, because narrowing a denial would widen authority.
Per backend:
macOS emits
(deny file-read* (subpath …))after every allow.sandbox-execis last-match-wins, so position is the enforcement.Linux has no deny rule. Landlock is allow-only, so a denial is expressed by not granting:
expand_around_deniedsubstitutes the siblings that do not lead to the denial. An ancestor it cannot enumerate ends the walk, granting nothing beneath it; any other enumeration error still fails closed.The rule worth carrying to any allow-only backend: "cannot enumerate" ends the walk, it never refuses the spawn. The absence of a grant is already the denial, so stopping early is strictly narrower than continuing. Refusing instead took every run down twice here, once for a missing
~/.kubeand once for an unreadable$HOME, and gained no authority either time.Windows has no OS sandbox, so nothing applies the denylist there; OpenBSD does not apply it yet.
When a toolchain command fails under an agent
Two failure shapes, and they are not both the sandbox refusing something.
- "Permission denied" writing a cache — the tool is writing outside every
write root. Relocate its cache env var with the pure caches in
workspace_env.rs(that is howCCACHE_TEMPDIR, which defaults to/run/user/<uid>, is handled). Do not widen a write root for it. - "No module named X" / "command not found" for something installed —
nothing was refused. Check whether an env var moved the place the tool looks.
HOMEandPYTHONUSERBASEare deliberately not relocated for exactly this reason; a relocated user site made an installedpytestinvisible while it worked fine in the operator's terminal.
The distinction matters because the second shape leaves no denial to find, and an agent retrying it gets no diagnostic at all.
When the sandbox did refuse
Установить harn-sandbox-policy в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл harn-sandbox-policy?
Use for the process sandbox — read/write roots, the credential denylist, the toolchain-cache environment, and the per-backend profile emission on macOS seatbelt and Linux Landlock (Windows has no OS sandbox).
Как установить скилл harn-sandbox-policy?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл harn-sandbox-policy запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic