Skip to content

BlastShield is in beta and may contain bugs. Validate it in a non-production environment before relying on it for safety-critical workflows.

Guard

blastshield-guard provides command-argument-level filtering as a complement to the sandbox-exec profiles. While sandbox-exec operates at the file/process level and cannot filter by command arguments, blastshield-guard intercepts mutating subcommands before they reach tools such as Terraform, gcloud, kubectl, and gh.

When you launch an agent with blastshield, temporary runtime wrappers are injected automatically and mutating commands are hard-blocked. Persistent wrappers installed for regular shell use still prompt for Touch ID or your sudo password.

Philosophy: read-only by default. Any subcommand that isn’t explicitly read-only is treated as mutating and requires authentication.

Agent runs: terraform apply
PATH lookup finds wrapper first
Wrapper checks: is "apply" read-only? ─── NO
Runtime guard blocks command
Exit 1; run it yourself outside the agent sandbox
  1. Runtime wrappersblastshield creates temporary wrappers for guarded CLIs found on your current PATH
  2. PATH interception — The temporary guard directory is prepended to PATH before the sandboxed command starts
  3. Read-only check — Each wrapper checks if the subcommand is in the read-only allowlist
  4. Default deny — If the subcommand isn’t read-only, it is treated as mutating
  5. Runtime block — Inside blastshield, mutating commands exit with a clear block message
  6. Pass-through — Read-only commands execute immediately without any interruption

No installation is required for the runtime guard. blastshield enables it automatically:

Terminal window
blastshield claude
blastshield codex --dangerously-bypass-approvals-and-sandbox

Disable automatic guard injection when you explicitly need raw PATH behavior:

Terminal window
blastshield --no-guard claude

You can also install persistent wrappers for regular shell use outside BlastShield:

Terminal window
# Install to default location (~/.blastshield/guard)
blastshield-guard install
# Install to custom location
blastshield-guard install ~/bin/guard

Then add the guard directory to your PATH before the real CLI paths:

Terminal window
export PATH="$HOME/.blastshield/guard:$PATH"

For AI agents, add this to their environment configuration.

Read-Only (auto-allow)Mutating (requires auth)
init, plan, fmt, validateapply, destroy
show, output, consoleimport, taint, untaint, refresh
state list, state showstate rm, state mv
workspace list, workspace selectworkspace delete, workspace new
providers, version, graph
Read-Only (auto-allow)Mutating (requires auth)
list, describe, getdelete, create, deploy, update
auth, status, versionadd, remove, patch, set, reset
config, helprestart, resize, enable, disable
submit, cancel
Read-Only (auto-allow)Mutating (requires auth)
describe-*, list-*, get-*delete, create, put, update
head-*, waitdeploy, terminate, run-*
s3 ls, s3 cp (download), s3 presignstart-*, stop-*, reboot
sts get-caller-identityauthorize, revoke, send, cancel
logs describe-*, logs get-*
dynamodb scan/query/get-item
iam list-*/get-*
Read-Only (auto-allow)Mutating (requires auth)
list, showdelete, create, update, deploy
account show/listset, remove, add, lock, unlock
version, helpscale, restart
Read-Only (auto-allow)Mutating (requires auth)
get, describe, logsapply, create, delete, patch
top, eventsscale, taint, exec
api-resources, api-versions, explaincordon, uncordon, drain
auth can-irollout restart, rollout undo
config view, config get-contextslabel, annotate, set
rollout status, rollout historyexpose, run, cp, debug
version
Read-Only (auto-allow)Mutating (requires auth)
repo list/view/clone/forkrepo delete/edit/rename
pr list/view/diff/checkoutpr merge/close
issue list/viewissue close
release list/view/downloadrelease delete
workflow list/viewworkflow disable/enable
auth statusrun cancel
api -X DELETE/PUT/PATCH
Read-Only (auto-allow)Mutating (requires auth)
list, status, historyinstall, upgrade
show, searchdelete, uninstall, rollback
version, repo list/updatepush
Terminal window
blastshield-guard install [DIR]

Creates wrapper scripts in the specified directory. Only wraps CLIs that are found on the system.

Terminal window
blastshield-guard uninstall [DIR]

Removes the wrapper scripts from the specified directory.

Terminal window
blastshield-guard list

Shows all guarded CLIs with their read-only and mutating patterns.

Terminal window
blastshield-guard check <cli> [args...]

Tests whether a specific command would be allowed or blocked:

Terminal window
# Check if terraform apply would be blocked
blastshield-guard check terraform apply
# Output: BLOCKED (mutating — requires auth): terraform apply
# Exit: 1
# Check if terraform plan would be allowed
blastshield-guard check terraform plan
# Output: ALLOWED (read-only): terraform plan
# Exit: 0

Runtime wrappers created by blastshield do not prompt for authentication. Mutating commands are blocked and must be run by you outside the agent sandbox.

Persistent wrappers installed with blastshield-guard install use sudo as their authentication mechanism:

  • Touch ID — On MacBooks with Touch ID, sudo can prompt for biometric authentication
  • Password — Falls back to your macOS user password
  • Fresh auth requiredsudo -k invalidates the timestamp, ensuring a fresh prompt each time

Automatic runtime guards cover repo-local and Hermit shims when the command is resolved through PATH, such as terraform apply with ./bin already on PATH. Direct path execution bypasses argument filtering.

Layer 1 (sandbox) is the hard boundary. It blocks credential access regardless of how the CLI is invoked. Use both layers together for defense in depth.

  1. Always use with Layer 1 — The guard alone is not sufficient; always run agents inside blastshield sandbox-exec profiles
  2. Invoke tools by command name — Runtime guards cover commands resolved through PATH, including Hermit shims
  3. Default deny — Any subcommand not in the read-only list is treated as mutating. Add new read-only patterns cautiously.
  4. Layer 1 is your safety net — Even if an agent bypasses the guard, it still cannot read credentials (blocked by sandbox)