Never-list: shell and file rules (Shield KYA OSS)
Status: approved by the owner on 2026-10-29. Changes to the table need owner approval. The 2026-10-29 follow-up adds: .env template names by their last suffix, backslash-newline line continuation, the ksh function NAME { ... } form, and tool-name verbs that match inside names, except a short list of harmless words. The same text is kept in sdks/kya/docs/never-list.md (the public copy); the two files must stay byte-identical. A later follow-up (2026-10-29) narrows the git ref check, adds glob forms of the secret names, denies a download substitution piped into a shell, and adds the ruby and php file reads. No rule id changed. On 2026-10-30 groups f, g and h were added: agent-driven persistence, reverse tunnels and reverse shells, and exfiltration of environment names or values. Those rows wait for owner review. Groups a to e are unchanged.
What the never-list does
The open source kya hooks deny a tool call when it matches the never-list. The hook exits with code 2 and the host shows the deny reason. No config file, environment variable, approval or --shadow flag lifts a never-list deny.
Every other call is recorded and allowed. The open source client is advisory and fails open: if kya breaks or times out, the call goes ahead. Enforcement with human approval runs on the hosted service, which fails closed. The package doc oss-vs-hosted.md compares the two.
Two kinds of never-list rule exist:
- Tool-name rules match the tool name alone, for example
mcp__postgres__drop_table. A destructive verb inside the name is enough, except inside a harmless word (see below). - Input rules (this page) match the shell command text or the file path of the call.
Rules
Each row is one rule. The rule id is shown in the deny reason, for example KYA denied Bash: NEVER_EVENT (rule rm-recursive-home-or-system; never-list rules cannot be overridden).
| Group | Rule id | Blocks | Examples allowed |
|---|---|---|---|
| a | rm-recursive-home-or-system |
Recursive rm (-r, -R, -rf, --recursive) on /, /*, ~, ~/*, ~/.*, the home directory, another user’s home (/home/<user>, /Users/<user>) a top-level system directory (/bin, /boot, /etc, /home, /lib, /lib64, /Library, /opt, /private, /root, /sbin, /srv, /System, /usr, /var, /Users), or a parent folder of the working directory when the host gives it (rm -r ../.., rm -rf ../*; the project folder itself and its sub folders are not parents). Works with sudo, env, bash -c, quotes, extra flags and $HOME or ${HOME}. |
rm -rf node_modules, rm -rf ./build, rm -rf /tmp/x, rm -rf ~/proj/node_modules |
| a | find-delete-home-or-system |
find on a protected path (home, root, a top-level system dir) with -delete or -exec rm. Filters do not help: find ~ -type f -delete is blocked. |
find . -name '*.log' -delete, find ~/Library/Caches -name x -delete |
| b | git-force-push-protected-branch |
git push with --force, -f (also inside bundles such as -fu), --force-with-lease or a + refspec, when the destination is main, master, or starts with release or prod. The destination can be HEAD:main or refs/heads/main. |
git push origin feature, git push -fu origin feature, git push --force-with-lease origin feature, git push origin main (no force) |
| c | secret-read-shell |
A read or copy of a secret file in a shell command: cat, head, tail, less, sed, awk, grep, cut, sort, tar, zip, base64, xxd, diff, jq, md5sum and similar read verbs, cp, scp, rsync and install sources, dd if=, < file, a git ref read (git show HEAD:.env, git cat-file -p HEAD:.env), a call that names a secret file in a command that runs an interpreter (python3 -c "open('.env')", ruby -e "File.read('.env')", php -r "file_get_contents('.env')"), and curl/wget upload forms (-d @file, -F f=@file, -T file). Secret files: ~/.ssh/id_* (not .pub), ~/.ssh/*, ~/.aws/credentials, gcloud credential files, /etc/shadow, /etc/gshadow and /etc/master.passwd, macOS keychains (~/Library/Keychains/* and /Library/Keychains/*, and a copy or archive of the folder itself), Safari and system cookie files (Cookies.binarycookies), browser stores in a real profile location only (Chrome, Chrome Beta and Canary, Brave, Edge, Chromium, Vivaldi, Arc and Opera Login Data, Cookies, Local State and their -journal files under ~/Library/Application Support/<vendor>, ~/.config/<browser>, ~/snap/<app>, ~/.var/app/<id> or AppData\Local|Roaming\<vendor>; Firefox logins.json, key4.db, cert9.db and cookies.sqlite under ~/.mozilla/firefox, ~/Library/Application Support/Firefox or AppData\Roaming\Mozilla\Firefox), also under a custom HOME and, when the host gives the working folder, as a relative path (cat Library/Keychains/x in the home folder); a glob that can match Keychains counts, ~/.npmrc, ~/.netrc, ~/.git-credentials, .env and .env.*, except a name that ends in .example, .sample or .template (.env.local.example is a template; .env.example.local is secret, because only the last suffix counts). Globs that could match one of these names count too: .env*, .e[n]v, .en?, .e?v.local, *.pem, *.key, ~/.s?h/id_rsa, ~/.a?s/credentials, ~/.n?mrc, and any glob name under ~/.ssh or ~/.aws. |
cat README.md, cat .env.example, cat .env.local.example, cp .env.example .env, ls ~/.ssh, ssh -i ~/.ssh/id_rsa host, curl -o .env URL, git commit -m "chore: rotate server.key", grep -e server.key notes.md, cat *, kubectl get pods, docker ps, cat /etc/passwd, cat extension/chrome/Cookies, cat docs/Library/Keychains/README.md, sqlite3 app.db .tables |
| c | secret-read-file |
The file path of a tool that reads (Read, view, read_file, and any tool that is not a write or edit tool) names one of the secret files above. | Read README.md, Write .env (writes are not blocked by this rule) |
| c | keychain-password-dump |
A security command that prints keychain passwords: security find-generic-password or find-internet-password with -w or -g (also in a bundle such as -ga or -wa), and security dump-keychain -d; also security export, security find-key, security -i, security interactive, and security with no sub-command when its input is piped or redirected (echo ... | security). |
security find-identity -v, security unlock-keychain, security show-keychain-info, security find-generic-password -s svc (no password flag), security list-keychains |
| d | mkfs |
mkfs and mkfs.*. |
none |
| d | dd-to-block-device |
dd ... of=/dev/<disk> (sd, hd, vd, xvd, nvme, mmcblk, disk, rdisk, md, dm-, loop, mapper). |
dd if=in.img of=out.img, dd if=/dev/zero of=/dev/null |
| d | redirect-to-block-device |
> /dev/<disk> or >> /dev/<disk>. |
cmd 2>/dev/null |
| d | fork-bomb |
A function that pipes itself into a backgrounded copy of itself, such as :(){ :\|:& };:. |
echo : |
| d | chmod-chown-recursive-root |
chmod -R 777 on a protected path, and chown -R (any owner) on a protected path. Home counts as protected, so chown -R me ~ is blocked. |
chmod -R 755 ./dist, chown -R $USER ./work, chmod 777 file.sh |
| e | pipe-network-to-shell |
Output of curl or wget piped, directly or through more pipes, into sh, bash, zsh, dash or ksh, also through sudo. Also a download run through a substitution or process substitution: sh -c "$(curl ...)", bash <(curl ...), source <(curl ...), eval "$(curl ...)", and bash -c "curl ... \| sh". A download substitution whose output is piped into a shell: echo $(curl ...) \| sh, cat <(curl ...) \| sh, echo `curl ...` \| sh. |
curl https://x.com \| jq ., curl -o a.sh URL && less a.sh, echo $(date), echo $(curl -s x) \| jq ., bash -c "echo $(curl x)" |
| f | ssh-authorized-keys-write |
A write to ~/.ssh/authorized_keys or authorized_keys2 (any home, /root/.ssh, any letter case): a redirect >, >>, >|, >&, &> or &>>, tee, the destination of cp, mv or install (a directory destination gets each source basename; -t DIR, -tDIR, --target-directory=DIR and any unique prefix of the long option name the directory), sed -i, dd of=, curl -o/--output (attached -o/path too), and curl or wget downloads with a server-chosen name into a directory: the directory is tested joined with authorized_keys, so every download into a .ssh directory is blocked, whatever its spelling (~/.SSH, $HOME/.ssh, ./../.ssh) after the paths are normalized. A Write, Edit or apply_patch call on the same path is blocked too. Reading the file is not blocked. |
cat ~/.ssh/authorized_keys, cp ~/.ssh/authorized_keys ./backup/, cp -t ./build key, curl -O --output-dir ~/Downloads https://x.example/readme.md |
| f | ssh-copy-id |
Any ssh-copy-id. It adds a key to the authorized keys of a remote host, which is the same persistence as a write to the file. |
ssh-keygen -t ed25519 -f ~/.ssh/github_key, ssh -i ~/.ssh/deploy_key host |
| f | persistence-cron |
crontab -, crontab -e or crontab FILE (installs a table), and a write to /etc/cron*, /etc/crontab or /var/spool/cron (redirect, tee, cp, mv, install, sed -i, dd, or a Write call). crontab -l and crontab -r are not blocked. |
crontab -l, crontab -l > cron.bak |
| f | persistence-at-job |
at TIME and at -f FILE, which schedule a job. at -l and at -d are not blocked. |
at -l |
| f | persistence-launchd |
launchctl load or launchctl bootstrap, and a write to any file in ~/Library/LaunchAgents, /Library/LaunchAgents or /Library/LaunchDaemons (redirect, tee, cp, mv, install, or a Write call). |
launchctl list, launchctl print gui/501 |
| f | persistence-systemd-user |
systemctl --user enable or systemctl --user link, and a write to a file under ~/.config/systemd/user or /etc/systemd/user. |
systemctl --user status x, systemctl --user start x |
| f | persistence-schtasks-create |
schtasks /create (a Windows scheduled task). |
schtasks /query |
| f | shell-rc-download-append |
A command that writes a shell start file (~/.zshrc, ~/.zshenv, ~/.zprofile, ~/.zlogin, ~/.bashrc, ~/.bash_profile, ~/.bash_login, ~/.profile) and has a curl or wget word anywhere in its text, heredoc bodies included. The download runs at every shell start. |
echo 'export PATH=$HOME/bin:$PATH' >> ~/.zshrc, cat ~/.zshrc |
| f | long-input-persistence-words |
A shell command longer than 64 KB whose whole text names one of the persistence or tunnel words: authorized_keys, LaunchAgents, LaunchDaemons, systemd/user, /etc/cron, /var/spool/cron, crontab, launchctl, systemctl, schtasks, ssh-copy-id, autossh, RemoteForward, LocalForward, ProxyCommand, /dev/tcp/, /dev/udp/, ssh, nc, ncat, netcat, socat, or a shell start file name. The parsed windows miss the middle of a long command, so the word search runs on the whole text first. Coarse on purpose. |
echo x > out.txt padded to 80 KB |
| g | ssh-reverse-forward |
ssh with -R (any destination, also bundled such as -fNR or -R8080:...), or RemoteForward in an -o option. Options after the destination count too (ssh host -R 9000:x -N). A host name does not make a reverse tunnel safe, so there is no host exception. |
ssh -L 8080:localhost:80 host, ssh -N -L 8080:localhost:80 dev.example.com |
| g | ssh-local-forward-raw-ip |
ssh with -L (or -o LocalForward) and -N to a dotted IPv4 address (with or without user@). Options after the destination count too. A host name is not checked. |
ssh -N -L 8080:localhost:80 dev.example.com, ssh host -- -R 9000:x (after -- it is a command) |
| g | reverse-shell-netcat-exec |
nc, ncat or netcat with an exec flag: -e, -c or --exec, --sh-exec, also inside a short cluster (-nve); and socat with an EXEC: or SYSTEM: address. A listener without an exec flag, and nc host port < file, are not matches. |
nc -zv localhost 5432, nc -l 4444, nc 203.0.113.7 4444 < payload.bin |
| g | reverse-shell-dev-tcp |
Bash /dev/tcp/HOST/PORT or /dev/udp/... as the target of <, > or >>, or as the first word of a command part (bash -i >& /dev/tcp/... splits at the &). Text that only names the path is not a match. |
git commit -m "block /dev/tcp", echo /dev/tcp/x |
| g | autossh-tunnel |
Any autossh: a tunnel that restarts itself. |
ssh -N dev.example.com |
| g | ssh-tunnel-device |
ssh -w (a layer 3 tunnel device on both ends), in any position. |
ssh host |
| g | ssh-proxy-command-exec |
ssh with a -o option whose keyword ends in command (ProxyCommand, LocalCommand, KnownHostsCommand, RemoteCommand, any letter case) and whose value is not one of the two jump shapes, ssh -W %h:%p HOST and nc %h %p. Double quotes are removed first, as OpenSSH reads them, so -o "ProxyCommand=nc x 22" and -o '"ProxyCommand" nc x 22' are both read. The keyword ends at the first = or space, so -oProxyCommand=... and -o "ProxyCommand nc x 22" are both read. A -o value with no readable keyword is denied (fail closed). PermitLocalCommand is a yes/no switch and is not gated. This is an allowlist of the value: any other command runs on connect, so every other value is denied. |
ssh -o 'ProxyCommand=ssh -W %h:%p bastion' host, ssh -o 'ProxyCommand=nc %h %p' host, ssh -o PermitLocalCommand=yes host |
| g | ssh-config-written |
ssh -F FILE when the same command writes FILE (a redirect, tee, cp, mv, install, sed -i, dd, or a curl or wget output). The config can carry a ProxyCommand written in the same call. |
ssh -F ~/.ssh/config host (not written by the command) |
| g | ssh-code-loading-option |
ssh that loads a shared library as a provider: -I LIB (PKCS#11), and -o PKCS11Provider= or -o SecurityKeyProvider= with any value other than none or empty. A library runs code in ssh’s process. |
ssh -o PKCS11Provider=none host, ssh -o SecurityKeyProvider= host |
| h | env-dump-to-raw-ip |
A client (curl, wget, nc, ncat, netcat, socat, telnet) with a public dotted IPv4 operand, in the same command as an environment dump (env, printenv, bare set, export -p, declare -p, compgen -e, also inside $(...)) or a $NAME or ${NAME} reference. Loopback (127.x), private (10.x, 172.16 to 172.31, 192.168.x) and link-local (169.254.x) addresses are allowed. |
curl http://127.0.0.1:8080 -H "X: $TOKEN", env \| curl -d @- http://10.0.0.5/, env NODE_ENV=x node server.js, set -euo pipefail |
How matching works
- Only the command word counts.
echo rm -rf ~andgit commit -m "rm -rf ~"are allowed. - Tool-name rule: a tool on a known MCP server is denied when its name contains
drop,truncate,purgeortransfer, in any case and with any separator. Somcp__postgres__drop_table,mcp__postgres__DropDatabase,mcp__postgres__droptableandmcp__postgres__truncate-tableare denied. A verb inside one of these harmless words is not counted:dropdown,dropdowns,dropbox,dropboxes,droplet,droplets,dropout,dropouts,dropzone,purgeable,transferable,transference,transferor. Somcp__postgres__dropdown_selectis allowed. A verb in another word still counts, somcp__postgres__dropdown_drop_tableis denied. - Shell commands are checked for shell tools:
Bash,bash,run_shell_command,run_terminal_command, and names that containbash,shell,terminal,execorcommand. - File paths are checked for tools that are not write or edit tools.
- Write tools (Write, Edit, MultiEdit and apply_patch) are checked only by the persistence rows in group f (
ssh-authorized-keys-write,persistence-cron,persistence-launchd,persistence-systemd-user), so a write to.envis still allowed. For apply_patch the paths come from the*** Add File:,*** Update File:,*** Delete File:and*** Move to:lines of the whole patch, not a window. Persistence paths are matched without regard to letter case (macOS file systems are case-insensitive by default). - A redirect target is not an operand. Redirect operators that end a segment (
>|,>&,&>,&>>) still give their target: the first word of the next segment is read as the target. Forcp,mvandinstall, a directory destination receives each source under its basename, socp key ~/.ssh/writes~/.ssh/key. The directory can be given with-t DIR,-tDIR,--target-directory DIR,--target-directory=DIRor a unique prefix of the long option. For curl and wget, an output option can take its value attached (-o/path,-sSo~/x,--output=/x). For a download with a server-chosen name (curl-O,-J,--remote-name,--remote-header-name,--content-disposition; wget without-O), the output directory is tested as a write target, and each non-option operand is also read as a URL, so a scheme-less host works. The rules match the files under a LaunchAgents, cron or systemd directory, so a directory is enough for them. A download into a.sshdirectory is tested asauthorized_keys. Forssh, a value option takes the rest of its word or the next word, and every option is read wherever it stands, before or after the destination. - A field longer than 64 KB is checked at its first and its last 64 KB. Text in the middle of a longer field is not checked.
- Words are unwrapped before matching:
env,sudo(with its options such as-u root),nice,time,timeout,xargs,command,eval,sh -c,bash -c, braces,if/then. The ksh formfunction NAME { ... }is checked whereverfunctionstarts a command: after wrappers (time,time -p,coproc,sudo,envand the others), assignments,{,!or control words such asthen. Repeated headers (function a function b { ... }) are all read. Each candidate command word goes through every rule, so a pipe into a shell and a heredoc fed to a shell are seen inside a function body.coproc NAMEis read as a name only before{or a compound keyword (if,while,until,for,case,select). Otherwisecoprocis a wrapper:coproc sudo -u root rm -rf /andcoproc git push --force origin mainare read as the command.functionorcoprocas an argument (echo function,git log --grep function) and a path (/bin/function) are not checked. - A backslash at the end of a line joins that line to the next, as in the shell. So
rm -rf \followed by a newline and~isrm -rf ~, and it is denied. A backslash-newline inside double quotes joins too. Inside single quotes it is text. Quotes and backslashes are removed, sor""misrm, and$'\x72m'is decoded torm. - Quotes group words. A
;,|or&&inside quotes is text, sogit commit -m "a; rm -rf ~"is allowed. Quoted code given tosh -c,bash -corevalis scanned as code, sobash -c "rm -rf ~"is denied. - A command word with a substitution is read by its basename with the
$(...)groups removed:/bin$(:)/rm -rf ~isrm. A download substitution in a command word (/bin/$(curl ...)) is denied, and a word that expands to nothing ($(:) rm -rf ~) does not hide the next word. - A
#that starts a word begins a comment to the end of the line, so# don't do thisopens no quote and a command in the comment is not run. A quote with no closing quote is a literal character, so the text after it is still checked. $'...'words are decoded as one word: their quotes and separators are text. Substitutions skip quoted text when they look for their closing)or backtick.- grep-like tools (
grep,egrep,fgrep): the first operand is the search pattern, not a file, unless-eor-fnames the patterns. - Option values are not files:
scp -i KEY,rsync -e "ssh -i KEY"andopenssl ... -out FILEdo not count as reads. The file that is the source ofscpstill counts. - Read tools: the path fields
file_path,path,absolute_pathand theincludeandpathslists of read tools (read_many_files) are checked. - A
NAME=valueassignment in the same command is substituted into$NAMEand${NAME}, sod=~; rm -rf $dmatches. - Paths are resolved before comparison:
~,~root,$HOME, repeated slashes,/./and..are handled. - Any parse error, unknown shape or missing input allows the call.
- Rules run in table order. The first match gives the deny reason.
- Git ref reads. For every git command, each word that is not an option is checked by the part after each colon. So
git show HEAD:.env,git show :0:.env,git show HEAD@{1}:.env,git log -L10,20:.envandgit whatchanged HEAD:.envare denied, whatever the subcommand. A text option skips its value:-mand--messagefor commit, tag, merge, revert, notes, stash, am and cherry-pick;--grep,--author,-Sand-Gfor log, show and similar commands. So a commit message, a tag message orgit log --grep x:.envis not a read. Attached forms (--message=x,-mx) are one option word and are skipped.-c alias.*(the key is compared without case),--config-env alias.*and the environment formsGIT_CONFIG_KEY_<n>=alias.*andGIT_CONFIG_PARAMETERSare denied, because an alias can run any command.-F FILE(every command) is checked as a file. Only the text options of a known subcommand skip their value. If any option before the subcommand is unknown, no word is exempted, sogit --frobnicate commit -m "x: a.key"is denied. Known global options that take a value (-C,-c,--git-dir,--work-tree,--namespace,--super-prefix,--config-env,--attr-source,--shallow-file) are skipped for the force-push rule too. - Glob names. A glob in a path follows the shell rule for a leading dot:
*,?and[...]do not match a name that starts with a dot, unless the glob starts with a literal.. Socat *,cat *.envandhead */*.csvare allowed, andcat .*,cat .e[n]vandcat ~/.s?h/id_rsaare denied. A glob counts only when it could match a fixed target:.envor.env.local(any directory),.npmrc,.netrcor.git-credentials(in the home directory),id_*(not.pub) under.ssh,credentialsunder.aws. Any glob name under.sshor.awscounts. - Interpreter reads. A command that runs python, node, ruby, perl, php, deno, bun or lua is denied when any call in that command names a secret file. The calls are
open(,Path(,readFileSync(,readFile(,read_text(,read_bytes(,File.read(,IO.read(,file_get_contents(,fopen(andreadfile(, with the name as the first argument. The scan reads the whole command text, sopython3 x.py; echo "open('.env')"is denied.echo "open('.env')"is allowed, because echo is not an interpreter. - Download into a pipe. A download substitution (
$(curl ...),<(curl ...), a backtick) counts as the output of a download. When that segment is followed by a pipe into a shell, the call is denied. The same substitution as an argument of a shell (bash -c "echo $(curl x)") is allowed.
Limits: what an agent can still do
- HEAD-based force push.
git push --forcewith no branch name is allowed. kya does not read the current branch. Git aliases are not resolved. - Seatbelt, not a sandbox. The matcher reads words and separators. It does not parse shell fully, so a determined agent can still find a way around these rules. Treat the list as a guard for common mistakes.
- Secret list is best effort. The secret files above are the stores the list names: SSH keys, AWS, gcloud, npm, netrc, git credentials,
.env,*.pemand*.key, the system password hashes, macOS keychains and Safari cookies, and the Chrome, Brave, Edge, Chromium, Vivaldi and Firefox stores in their real profile folders. Other password managers, other browsers, and any file a tool copies first are not covered. A relative path is resolved only when the host gives the working folder (a bare name only in a folder that can hold a store, or, as a dot name or a glob of up to 64 characters such as.npmrcor.n*rc, in a home directory; runs of*count as one, and a bare glob or brace name still over 64 characters in a home directory is denied as a secret read),cd ~/Library/Keychains && cat login.keychain-dbis not followed, and a copy of the whole home folder (tar czf b.tgz ~) is not read as a secret read.~/.kube/configand~/.docker/config.jsonare in the guard pack, whereguardAllowcan allow them. - Accepted over-denies. A
rmof a/Volumes/<name>that has a glob (/Volumes/*,/Volumes/Mac*,/Volumes/{a,b}) is denied for every name, because a glob can match the boot volume.security exportis denied whole, also when it only exports certificates, and so aresecurity find-key,-i,-pandinteractive. macOSsecurityaccepts a prefix of a sub-command (list-k,find-i), so a prefix stands for every command it starts and a deny applies when any of them is denied (security find-i -wis denied,security find-i -vis not). Asecuritysub-command that is not plain lower-case words and dashes (a brace, a glob, an extglob such as@(a|b), upper case) counts as every command too. Asecuritysub-command built at run time ($(echo find-generic-password),${S:-export}) counts as every command, so it is denied. A piped or redirectedsecuritywith a word that starts no known sub-command is denied. - Working folder changes are not followed. The matcher resolves a relative path against the working folder the host gives. A
cdorpushdinside the command line is not tracked, socd ~/Library/Keychains && cat login.keychain-dbis not read as a keychain read. Braces are expanded on the word before its path is normalised, so~/x/{..,y}/.npmrcis also~/.npmrc. A word with{a,b}groups (and{j..l}or{1..3}ranges, up to 256 numbers) is expanded to at most 256 variants. One rule covers everything that is not fully expanded (a longer range, a step such as{1..100..2}, zero padding such as{01..10}, more than 256 variants, a word over 2048 characters, more than 16 groups): each such group is read as a wildcard that also matches a name that starts with a dot, so~/{x,.ssh,y}/id_rsa...is denied; the word is also checked with each group as its first and as its last alternative, and group by group (the first 16 groups, 8 alternatives each; 1 group and 4 alternatives for a word over 8192 characters). The work is bounded for a whole command (2048 variants and forms over all its words, so a command of thousands of brace words stays fast). Past the bound the command is denied (“brace expansion too large to check”): the next word with any closed{...}pair (a comma list, a range, a nested or a literal group such as{x}) makes it a secret read, so an early harmless word cannot starve a later secret word, and the file check and the folder check of a word both honour it. Before the bound, a literal group ({},{x}) is plain text, so{.ssh,{x}}still expands around it. A word with no closed{...}group costs nothing. A brace word the wildcard form makes match (cat {1..1000},cat {1..10..2}) can be denied. A plain glob that can match/etc/shadowis denied too (cat /etc/*,cat /etc/s*,grep -rn foo /etc/*). A{}with no comma and no..stays literal. A glob in a store file name longer than 256 characters after runs of*are joined is denied inside a store folder. - sh rules only (Git Bash). The matcher parses commands with sh rules. PowerShell and cmd syntax are not parsed: unquoted backslashes are dropped as sh drops them, and
%USERPROFILE%,$env:USERPROFILEandRemove-Itemare not understood. A quoted word that looks like a Windows path ("C:\Users\me\.ssh\id_rsa",'\\wsl$\Ubuntu\home\me',/c/Users/mewith a Windows HOME) is read as a path in both its sh form and its Windows form. A word such as"r\m"stays a different program, as in sh. A rooted\word('\Users\me','\Windows') and the Windows home variables (%USERPROFILE%,$USERPROFILE,$HOMEPATHfollowed by a separator) count for the delete rules. Other words with a backslash keep sh rules on Linux and macOS, so a regex such as's/\.env//'is allowed. On a Windows host every word with a backslash is also read as a path, so a regex argument with\.env-like text can be denied (accepted cost). On macOS and Windows hosts names ignore case, so/USERS/MEis read as/Users/meandRM,/BIN/RMandSsh -Iasrmandssh; on macOS/private/etcis/etc,/Volumes/<name>and/System/Volumes/Dataare volume roots and/Volumesitself is protected forrm, and a/Volumes/<name>with a glob (/Volumes/*/Users) counts as the boot volume. Linux stays case-sensitive. - Built at run time.
$(echo rm) -rf ~, brace expansion, text read from a file or the network and then run, and code that builds a path from pieces (open(".e" + "nv")) are not seen. - Middle of a long field. Text between the first and last 64 KB of a field longer than 64 KB is not checked by the parsed rules. For a shell command longer than 64 KB, the persistence and tunnel words (
long-input-persistence-words) are searched in the whole text first. A long apply_patch is scanned in full for its header lines. - Commands that run another command. Only the wrappers listed above are unwrapped.
watch rm -rf ~,ssh host "rm -rf ~",npx,make,kubectl execanddocker runare not read as running their argument. A download inside them is not checked either. - Compound names. A verb inside a name counts unless it is a listed harmless word, so
postgres__drop_down_listis denied. Adding a harmless word needs owner approval. - Sourced files.
source script.shand./script.shrun code that is not read. Only the command text is checked. - Other tools. Hosts other than the ones listed in the package docs get no hook. Cursor has no hook in this package.
- Stdin targets.
ls ~ | xargs rm -rfis not seen: the targets come from stdin. - Substitutions as data. A download inside
$(...)used as a plain argument is allowed (docker build --build-arg V=$(curl ...),cp $(curl ...) .). Only a download run as code (sh -c,bash <(...),source,eval), or a download whose output is piped into a shell (echo $(curl ...) | sh), is denied. - Key reads by other tools.
ssh-keygen -yreads a private key to print the public part. It is not in the list. - Run-time commands. Commands assembled at run time (
$(echo rm), base64 decoding, text read from a file or the network and then run,evalof text built from pieces) and scripts that the agent writes and then runs are not seen. - Other readers.
git addof a secret file andsource .envare not in the read list. - False positives you will see. A heredoc fed to a shell or interpreter (or piped into one) is code, so a line in it that starts with a listed command is blocked. A heredoc fed to
catis text.find ~ -name x -deleteis blocked whatever the filters. A command that runs an interpreter and names a secret file in a read call (open('.env'),readFileSync('.env')) is blocked, even when the call is in a later part of the command. Text that only names the file, such asecho "open('.env')", is not.cat .*andcat ~/.*rcare blocked, because the glob can match.envor.npmrc.cat ./.npmrcin a project is allowed, because a home credential is matched only in the home directory. A git word with a colon whose part after the colon ends in a secret name is denied, for examplegit clone https://host/x.keyand agit -c alias.*setting of any kind. - Compound names with a verb. A verb inside a name counts unless it is in a listed harmless word. So
postgres__drop_down_listis denied, anddroppableis denied. Adding a harmless word needs owner approval. - Name matches.
prod*also matchesproduction-hotfix.*.pemand*.keymatch by file name, so a public certificate is blocked too. - Hosts without a shell hook. Cursor has no hook in this package (MCP only). The Python SDK does not have the input rules yet.
- Host key names. The hook reads the tool input from
tool_inputortoolInput. A host that sends the input under another key is not checked. - Hosted mode. The local input rules run before the hosted plane answers, and
--plane-shadowdoes not lift them. Other calls follow the hosted policy. - Public IPv4 only. The raw IP rules (
ssh-local-forward-raw-ip,env-dump-to-raw-ip) see dotted IPv4 literals. A decimal, octal or hex address (3232235777), an IPv6 literal, and a name that resolves to an address (1.2.3.4.nip.io,evil.example) are not seen.ssh -Ris different: it is denied for any destination. - Raw IP without -N.
ssh -L 8080:host:80 203.0.113.7(no-N) to a raw IPv4 address is allowed, because the rule asks for-Ntoo. - Private addresses.
env-dump-to-raw-ipallows 10.x, 172.16 to 172.31, 192.168.x, 127.x and 169.254.x on purpose: a dev or ops call to an internal host often carries a token. The cost is that an environment dump sent to a private address is not blocked. - Persistence written by other tools. A write from python, node, perl, ruby or
lnis not read. A target built at run time ($(echo ~)/.ssh/authorized_keys,"$DIR/x"withDIRset in an earlier call) is not resolved. A download in the content of a Write call that targets a shell start file is not read. - Reverse shells in other forms.
nc host 4444 | sh, apython -corperl -esocket shell, and amkfifoshell are not read. Only thenc -e,ncat --sh-exec,socat EXEC:and bash/dev/tcpforms are. - Removal is not blocked.
crontab -r,systemctl --user disableandlaunchctl unloadare not in the list. - Input over 1 MB as a string. A tool input given as a JSON string over 1 MB is not parsed (fail open). A patch given as an object is scanned in full.
- Config written by an earlier call.
ssh -F FILEis denied only when the same command writes FILE. A config written by an earlier call, or by a Write call, is not read. Only the same-call case is seen. - Other ssh options.
IdentityAgentnames a socket, not a command, and is not gated.Match execis a config-file keyword and is not read from an-ovalue. A config file withProxyCommandthat was written by an earlier call is not read (see above). - Other programs and libraries. Other ssh-family options and tools that load a program or library are not gated: XAuthLocation, SSH_SK_PROVIDER, ssh-keygen -D/-w, ssh-add -s/-S, ssh-agent -P.
- Download names. The file name the server picks is not read exactly. The output directory is tested, joined with
authorized_keys, and joined with each URL basename (also for a scheme-less host). The bare basename is tested too, so a dotfile such as.zshrcis caught in any directory. A name that matters only with a directory context is caught through the directory test. - Netcat without an exec flag.
nc host port | shand a listener piped into a shell are not seen (only the exec flags and the/dev/tcpform are).Known limits (advisory in OSS; the hosted gate enforces)
A static parser cannot resolve shell expansion. The open source check is advisory by design: it blocks the common shapes above and records everything else. The hosted gate is the enforcing layer and fails closed. These shapes are not caught by the OSS rules, and each one is pinned by a test that asserts the current result (allowed), so a change is deliberate:
- Expansion inside a word.
r${x}m -rf ~andg${x}it push --force origin mainare not evaluated when the variable is not set in the same command. - Variable indirection across calls.
$X -rf ~is not resolved whenXwas set in an earlier call. A word that starts with$keeps the scan going, so the words after it are still checked. - eval of generated text.
eval "$(printf 'rm -rf ~')": the text the substitution produces is not analysed. - Encoded payloads.
echo <base64> | base64 -d | sh: the decoded text is not read. - Scripts that run files.
bash ./clean.shandsource x.sh: the file contents are not read. - Aliases. A command defined with
aliasis not resolved. - Glob suffixes of key names. Only the literal
*.pemand*.keyare caught.cat *.pe?andcat *.[pk]eyare allowed. - Globs a shell does not expand.
cat [.]envis allowed. A shell does not expand it, so no file is read, but a tool that globs by itself is not checked. - Glob names outside the fixed targets. A gcloud credential path written as a glob (
~/.config/gc*/application_default_credentials.json) is allowed. The literal path is denied. - Ruby and PHP forms without parentheses, or with the name second.
ruby -e "File.read '.env'"andperl -e "open(my $f, '<', '.env')"are allowed. - A download in one call, a pipe in the next.
x=$(curl ...)in one call andecho "$x" | shin a later call are allowed. Within one command, the same text is denied. - Git config can run commands.
core.pager,core.sshcommand,core.fsmonitor,diff.external,*.textconv,credential.helperand analias.*with!can run any command. The static check does not read config files, so a command that sets them in a config file is not seen.git config alias.s '!cat .env'is allowed. - Git reads without a colon.
git add .env,git log -p -- .envandgit hash-object .envread a secret file, but noREF:PATHword is seen, so they are allowed.git showof a whole tree or blob with a path, such asgit show HEAD -- .env, is allowed for the same reason.
Advisory everywhere else: every call that does not match this table is recorded and allowed by the open source client.