Skip to content
BENIBIX Learn

Permission Rule Wildcard

AI⌨️ Claude CodeConfiguration

Also known as Bash(git log *), Bash(ls:*)

A star in a rule that stands for any text, and where it goes matters.

Think of it like

It is like a blank in a form. Anything can go in that one spot.

Example

Lucy first allowed Bash(git *). That let git push run too. She swaps it for Bash(git log *) and Bash(git diff *).

Why it matters

One star in the wrong place can allow far more than you meant.

Definition

A wildcard is a star in a permission rule that stands for any text. In a Bash rule, everything before the first star must match as written. So Bash(git log *) covers only git log, but Bash(git *) covers every git command. A space before a final star counts: Bash(ls *) skips lsof, and Bash(ls*) does not.

Example code

json
{
  "permissions": {
    "allow": ["Bash(git log *)", "Bash(git diff *)"]
  }
}
Allow two git commands, not all of git.
Move the star, and the reach changes.

Common mistake

Putting the star right after the program name. Put it after the subcommand.

Key takeaways

  1. 1
    Star is any text. Spaces too.
  2. 2
    After the subcommand. git log *.
  3. 3
    Space counts. ls * vs ls*.