Known limitations
What shellfirm does not catch today, per-shell limits, and why it is a safety net and not a sandbox.
shellfirm is a safety net for mistakes, not a sandbox. It reads the
command line before it runs. It cannot see what a program does once it has
started, and it does not stop someone who is determined to get around it. For
AI agents, shellfirm sandbox turns on
the agent's own OS sandbox, which stops what a command does once it runs
(reading your credential files, for example).
This page lists what it does not cover today, so you can decide where you
need other controls.
Risky commands with no check yet
- Reverse shells: only the common spellings are recognised; other spellings are not.
- Encoded or downloaded text that is decoded and piped or passed straight into a shell or interpreter is not always followed.
- Sending secrets (keys, tokens, credential files) to another host with
curl,awsorghis not detected in general. - Reading secrets: private keys and credential files are flagged (Medium),
also with Claude Code's
Readtool, and so is listing a credential folder (ls ~/.ssh), but reading a.envfile is not. Add a custom check to be asked before an agent reads one. A command that only uses a token (GH_TOKEN=$(gh auth token) …,… | docker login --password-stdin) is asked like printing one. - Checks apply to the shell and to AI agents alike: a check cannot yet be
limited to agents, and
shellfirm config ignore <id>turns it off for both. - Destructive API calls are recognised only when the line shows them: an
HTTP
DELETE(curl -X DELETE,http DELETE,wget --method=DELETE) or a GraphQL mutation with a top-level field that deletes or archives something. A request body read from a file, a pipe or a heredoc (curl -d @mutation.json,echo … | curl -d @-), a URL-encoded query, or aPOSTto a delete endpoint is not. - Calls to a local development server (
localhost,127.0.0.1,*.localhost,host.docker.internal) are not checked as destructive API calls, even when the port is forwarded to a remote service. A path that starts with_or holds a*(localhost:9200/_all) still is. - Printing a secret environment variable is recognised by its name
(
echo $GITHUB_TOKEN); a copy made in an earlier command under another name (echo $T) is not. - Lock-out commands beyond locking the root account (locking or removing other users, firewall rules that drop the SSH port) are not checked.
- git configuration that runs programs:
git -cwith a program value (core.pager,core.editor) is Medium, and-c diff.external=/-c credential.helper=are not matched. Neither aregit config include.path …andgit config init.templateDir …, which make later git commands run another file's settings or hooks. - Commands fed on standard input from a file or another program are not
read:
ssh host < script.sh,sudo bash < script.sh,cat cmds.txt | sudo bashandecho 'rm -rf /srv' | ssh host bashall report "No risky patterns matched". Text written on the same line is checked when it goes to a root shell or a here-doc:echo 'rm -rf /srv' | sudo bashandssh host <<EOF…rm -rf /srv…EOFare both Critical, and an agent is denied.
A known false positive
Hardening a firewall the right way (ufw allow OpenSSH && ufw default deny incoming) is still treated as a possible lock-out: High, and an AI agent is
denied. Run the two commands one at a time, or approve the prompt.
What the shell hook can see
The hooks expand what they can before checking: aliases (including chains),
history references (!!, !$) and the body of shell functions you call. For
aliases and history references the banner's Command: line shows what will
really run. For a function, the banner and the audit log show the line as
typed (nuke build); the function body is checked with it. Limits:
- Scripts you run (
./cleanup.sh) are not inspected. Only the line you type is. - Commands built at run time (
$CMD, the output ofeval "$(…)") can only be checked as far as they are visible on the line. - Large functions loaded from a file (over 16 KB: nvm, sdkman, conda) are
treated like a program on
PATH: their arguments are checked, their body is not read. So a call whose danger is only in such a body is not prompted. The same function typed or pasted into the session gets a Mediumshell:function_depth_limitchallenge instead. - Function budget: in bash, zsh and fish, every function a line calls is
followed within a budget of 64 functions / 64 KB (16 KB for one body). Past
it, the line gets the Medium
shell:function_depth_limitchallenge instead of being skipped.
Per-shell limits
| Shell | Status and limits |
|---|---|
| Bash, Zsh, Fish | Tested end to end. |
| Elvish | Tested. fn functions are not expanded: calling one is checked as typed, not by what its body runs. |
| Xonsh | Tested. Aliases are expanded and the usual subprocess forms are checked, but Python code that starts programs from computed values is not. |
| Nushell | Tested, with a limitation: Nushell cannot cancel a command line from a hook. Nushell built-in commands (rm, mv, cp, save, …), custom commands and programs run by path get no challenge: shellfirm prints a warning and the line runs. External programs get the normal challenge; when you cancel, they do not start and Nushell reports them as "not found". Treat Nushell protection as a warning, not a guard. |
PowerShell, Oils (osh) | Hooks are shipped but not yet tested end to end. Please report what works. |
bash with ble.sh is not supported. ble.sh replaces readline, so the key
binding shellfirm installs for Enter is never used. shellfirm doctor's default
check does not detect it, and ble.sh garbles the in-session check;
echo $BLE_VERSION printing a version means you are on ble.sh (if Enter does
nothing, grep -n ble.sh ~/.bashrc from another shell tells you the same). See
Plugins and frameworks.
A missing binary fails open. If shellfirm is no longer on PATH (for
example after nvm use switches to a Node version where @shellfirm/cli is
not installed), the hook prints shellfirm: binary not found in PATH; commands are NOT being checked once per session, and from then on every line runs
unchecked. This is on purpose, so that removing shellfirm never locks your
shell. See Shell setup.
In bash, zsh and fish, $? after a blocked line is still the previous
command's status (a key binding cannot set it). Scripts should use
shellfirm check --exit-code instead.
AI agents
- The hook checks command lines, not the scripts behind them. The agent hook
sees every command line the agent runs (Claude Code
Bash/PowerShell/Monitor, CursorbeforeShellExecution) and the file edits it guards (shellfirm, policy, agent-settings, persistence and shell startup files). It does not read the contents of other files. So an agent that writes a script and then runs it is not stopped by what the script does: aWriteofcleanup.shcontainingrm -rf ~, thenbash cleanup.shorchmod +x cleanup.sh && ./cleanup.sh, both pass with no answer (allow). The same is true formake clean,npm run cleanand anything else that runs code from a file. Inline code on the command line is checked:python3 -c "import shutil; shutil.rmtree('/home/dev')"andnode -e "require('fs').rmSync('/home/dev',{recursive:true})"are Critical and denied (fs:interpreter_inline_deleteplus the home-directory delete). Keep your agent's own permission prompt on for script runs. - Standard input to a remote or root shell is not read when it comes from
a file or another program (see above):
an agent's
ssh host < deploy.shorecho '…' | ssh host bashpasses. - The shell hook does not protect agents. Use the agent hooks
(
shellfirm connect <agent>, see Supported agents). - MCP tools (Zed, or any MCP client without a shellfirm hook) are advisory: the agent decides whether to call them. See Other agents.
- Not every hook is fail-closed: if shellfirm is missing or times out, Cursor, Codex CLI, Qwen Code and Windsurf run the command (Gemini CLI blocks it except when shellfirm exits with status 1, and blocks a missing binary or a crash; Copilot CLI lets a timeout through). Claude Code, Cline and OpenCode block. See Fail-closed.
- Codex CLI, Windsurf, Cline and OpenCode hooks cannot ask, so a risky command there is blocked instead of asked; run it yourself if it is intended.
- Codex CLI runs no hook for
write_stdin(input sent to a runningexec_commandsession): only the command that started the session is checked.shellfirm sandbox codexcovers what runs there. - Copilot CLI
write_bashinput is checked one call at a time: a command typed across several calls (rm -rf, then~/{enter}) can get through. Input with a key that edits the line or recalls history ({backspace},{up},{tab}, ...), a raw control character or bash history expansion (!!,!$) is denied. Copilot CLI has no OS sandbox shellfirm can configure; keepwrite_bashbehind Copilot's own permission prompt (--deny-tool) if that matters to you. - Gemini CLI headless runs (
gemini -p --yolo) wait for an answer to anaskthat nobody can give. See Gemini CLI. - Claude Code blocks on a hook failure only from version 2.1.295 on (the
onFailurehook field). - Claude Code skips the hook entirely when it is started with
--bare, or with hooks turned off (disableAllHooks;shellfirm statusanddoctorreport it ashook OFF). See Permission modes and headless runs.
Databases and wrap
shellfirm wrap reads the statements you type in a
terminal client, and shellfirm check reads SQL on a command line or in a
file passed with -f / <. Outside that, nothing is checked:
- GUI clients and application code (DBeaver, pgAdmin, DataGrip, an ORM in your app, a migration run by your app at startup) never pass through shellfirm.
- SQL generated at run time is not checked. In psql,
\gexec(run every value a query returns as a statement) is itself a Medium challenge,wrap:psql_gexec: "those statements are not checked". - Stored procedures and functions are opaque:
psql -c "CALL purge_all()"reports "No risky patterns matched", whatever the procedure drops. - A WHERE clause that matches every row is not recognised:
DELETE FROM users WHERE id IN (SELECT id FROM users)reports "No risky patterns matched". Only a missing WHERE or a literal always-true one (WHERE true,WHERE 1=1) is flagged. - The database host does not raise the challenge.
psql -h prod-db.internal -c "UPDATE users SET a=1"is the normal Highdatabase:update_all_rows(Math for you, deny for an agent), with no production context, unlikessh prod-dborkubectlon a production context.
Other limits
- The audit log is local. There is no forwarding to a central collector yet; ship the JSON Lines file with your log agent.
- Secret redaction in the audit log is best effort: a secret passed as a
plain positional argument (
tool login s3cr3t) cannot be recognised. - A process killed while the challenge is on screen (
kill -9, a closed terminal window) writes no audit record. The command does not run either. - Project policies apply to targets shellfirm can see. A directory
computed at run time, another user's
~nameor a script that changes directory is not followed.
Report a gap
If a risky command is not caught, open an issue at github.com/kaplanelad/shellfirm/issues, or add the check yourself: see Contributing. Protection coverage lists what is covered today.
If you found a way around a check (a command that matches a check, deny list or policy but runs without a challenge or denial), please do not open a public issue. Report it privately: Security gives the email address to write to, what counts and how reports are handled.