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:

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

Limits: what an agent can still do

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:

Advisory everywhere else: every call that does not match this table is recorded and allowed by the open source client.