Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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.

  1. workspace_roots / read_only_roots scope Harn's own file builtins (read_file, harness.fs.*), through check_fs_path_scope.
  2. 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_loopback and unix_socket_roots are the two socket grants on this axis: loopback admits IP on localhost, 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 is CapabilityPolicy::children_may_write: the workspace write capability, or process_sandbox.allow_child_workspace_write for a role that runs commands but edits nothing. Every backend reads that one predicate.
  3. sandbox_profile decides 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-exec is 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_denied substitutes 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 ~/.kube and 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 how CCACHE_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. HOME and PYTHONUSERBASE are deliberately not relocated for exactly this reason; a relocated user site made an installed pytest invisible 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

Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить harn-sandbox-policy с