Cube AlgosBlog

· 6 min read · Deutsch

If Claude Code runs the deploy script anyway, why does nothing go live?

Suppose a deny rule tells Claude Code not to run the deploy script, and it runs anyway. Why does nothing go live? Two mechanisms meet here. One is how Claude Code matches a permission rule against a command. The other is what Ethereum needs before a smart contract deployment counts. This post works through both.

The developer, the script and its two command forms are a made-up example. It is built on the pattern Claude Code's own documentation uses for curl, rm and git push.

A deny rule for the deploy script

Claude Code can stop and ask before it runs a command, with a permission prompt. Its settings can answer some of those questions in advance. The permissions page describes three kinds of rule: allow, ask and deny. "Deny rules prevent Claude Code from using the specified tool." They are checked deny first, then ask, then allow, and the first match decides.

The rules are enforced by Claude Code, not by the model. The docs say so directly: instructions in a prompt or in CLAUDE.md shape what Claude tries to do, but they don't change these rules.

So in the example, the developer adds a deny rule for the deploy script to the project's settings, in the format the docs show:

{  "permissions": {    "deny": [      "Bash(./deploy.sh *)"    ]  }}

The rule matched only the short command

A Bash rule in Claude Code matches text. The docs put it in one sentence: "Bash rules match the whole command text, with * standing in for any text." Everything before the first * has to appear as written.

That is what happened in the example:

$ ./deploy.sh  denied by rule$ /work/app/deploy.sh  deployment built  waiting for signature

The first command starts with ./deploy.sh, so the rule matches and the command is denied. The second runs the same file by its full path. Its text starts with /work/app/, so the rule does not match.

This is documented behaviour, not a bug. The permissions page has a section called "What a Bash rule doesn't match". A rule "doesn't match the same program invoked in a different form, so a deny or ask rule covers the invocation Claude usually produces and isn't a security boundary around the program." Its own examples:

  • Bash(curl *) stops curl https://example.com, not /usr/bin/curl https://example.com or sh -c 'curl https://example.com'.
  • Bash(rm *) stops rm -rf build/, not /bin/rm -rf build/ or bash -c 'rm -rf build/'.
  • Bash(git push *) stops git push origin main, not git -C . push origin main.

Whether the second form then runs without a question is decided elsewhere: "Your other rules and the permission mode decide the commands in the last column." In the example, they let it through.

What the docs offer instead

The same page names two tools for limits that have to hold. For filesystem and network limits that don't depend on the command text, it points to sandboxing. To inspect the full command text with your own logic before it runs, it points to a PreToolUse hook. The example takes a third route, which does not depend on any rule at all.

A deployment needs a signature

On Ethereum, a smart contract goes live through a transaction. ethereum.org lists "contract deployment transactions" as one of the types: a transaction without a "to" address, where the data field carries the contract code.

Every transaction needs a signature. ethereum.org describes transactions as "cryptographically signed instructions from accounts", and the signature as something "generated when the sender's private key signs the transaction". The page on accounts says it plainly: "You need a private key to sign messages and transactions".

So in the example, the deploy script gets as far as it can without a key. The terminal shows deployment built, then waiting for signature. The last step needs a key the script does not have.

Where the key stays

In the example, a person keeps the private key, off the agent's machine. That is the example's choice, and it is the point. The agent built the deployment, but only the key holder could send it.

The reason to keep the key elsewhere, and not just behind another rule, is in the same permissions page. Read deny rules for a file apply to Claude's file tools and to file commands Claude Code recognises. They don't apply to a command that reads files without naming them, such as grep -r pattern . run from the directory that holds the file. So a key in a file on the agent's machine would be protected by the same kind of text matching the deploy script slipped past. A key that is not on that machine cannot be reached by any form of a command run there. This follows from the example, not from the docs.

The accounts page adds why it matters: an externally-owned account is "controlled by anyone with the private keys". A contract, once deployed, has no private key of its own; it is controlled by its code.

What this does not say

  • The rule is not useless. It stopped the short form, which is the form Claude usually produces. It is not a security boundary, and the docs never claim it is.
  • The example is made up. The script, the path /work/app/deploy.sh and the outputs are illustrations built on the docs' curl pattern, not a recorded session.
  • A signature is not a review. The key holder decides whether the deployment goes out. Whether the contract is correct is a separate question that the signature does not answer.
  • Keeping the key elsewhere is a choice, not a rule of Ethereum. Ethereum only requires a signature. Where the key lives, and who holds it, is up to whoever sets up the deployment.

Get the next explainer

Every Cube Algos reel gets a post like this one: the mechanism worked through, with sources and limits. If you would like the next one by email, sign up below. You will first get an email with a confirmation link; you are only on the list after you click it, and every email has a link to unsubscribe.

Sources

  • Claude Code Docs, "Configure permissions": deny, ask and allow, rules enforced by Claude Code, Bash rules matching command text, what a Bash rule doesn't match, sandboxing and PreToolUse hooks, the limits of Read deny rules.
  • ethereum.org, "Transactions": transactions are signed; contract deployment transactions.
  • ethereum.org, "Ethereum accounts": a private key is needed to sign; externally-owned and contract accounts.

All sources last opened on 1 December 2026. The terminal lines in this post are an illustration, not output from a run.