Security
Your application runs whatever command Claude requests. Run the session in an isolated environment, such as a container or a virtual machine, as the least-privileged user that can do the work. Treat every command as untrusted input.
Beyond isolation, add these controls:
- Validate commands before running them, with an allowlist rather than a blocklist. See Implement the bash tool.
- Set resource limits on the shell process (CPU, memory, and disk), for example with
ulimit. - Log every command and its output so you can audit what ran.
- Redact credentials and other secrets from output before returning it to Claude.