Expand description
Shell executor that parses and runs bash blocks from LLM responses.
ShellExecutor is the primary tool backend for Zeph. It handles both legacy
fenced bash blocks and structured bash tool calls. Security controls enforced
before every command:
- Blocklist — commands matching any entry in
blocked_commands(or the built-inDEFAULT_BLOCKED_COMMANDS) are rejected withToolError::Blocked. - Subshell metacharacters —
$(,`,<(, and>(are always blocked because nested evaluation cannot be safely analysed statically. - Path sandbox — the working directory and any file arguments must reside under
the configured
allowed_paths. - Confirmation gate — commands matching
confirm_patternsare held for user approval before execution (bypassed byexecute_confirmed). - Environment blocklist — variables in
env_blocklistare stripped from the subprocess environment before launch. - Transactional rollback — when enabled, file snapshots are taken before execution
and restored on failure or on non-zero exit codes in
auto_rollback_exit_codes.
Structs§
- Shell
Executor - Bash block extraction and execution via
tokio::process::Command. - Shell
Output Envelope - Structured output from a shell command execution.
Constants§
- DEFAULT_
BLOCKED_ COMMANDS - The default list of blocked command patterns used by
ShellExecutor. - SHELL_
INTERPRETERS - Shell interpreters that may execute arbitrary code via
-cor positional args.
Functions§
- check_
blocklist - Check if
commandmatches any pattern inblocklist. - effective_
shell_ command - Build the effective command string for blocklist evaluation when the binary is a
shell interpreter (bash, sh, zsh, etc.) and args contains a
-cscript.