[BUG] Permission settings unclear/inconsistent - security issues

Status Fixed / completed
Maintainer reply ✓ Yes — rboyce-ant
Activity 5 comments · opened Jul 31, 2025 · closed Aug 1, 2025
💡 Likely answer: A maintainer (rboyce-ant, contributor) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • Claude CLI version: 1.0.64
  • Operating System: macOS 15.5
  • Terminal: Warp

Bug Description

The permission settings don't behave as expected. Several bash commands can be executed although denied through settings.

Steps to Reproduce

  1. Put these permission in ~/.claude/settings.json
    "deny": [
      "Read(.env)",
      "Edit(.env)",
      "Write(.env)",
      "MultiEdit(.env)",
      "Bash(*:.env)"
    ]
  1. Instruct claude to cat your .env file.
  2. it will be able to do so

Expected Behavior

Permission denied

Actual Behavior

Permission not denied

Additional Context

I tried different syntax for \.env, .env\, .env - while the rules for Read, Edit, Write, etc seem to work, Bash seems to be just ignored.

View original on GitHub ↗

5 Comments

github-actions[bot] · 1 year ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/4467
  2. https://github.com/anthropics/claude-code/issues/4721
  3. https://github.com/anthropics/claude-code/issues/4787

If your issue is a duplicate, please close it and 👍 the existing issue instead.

🤖 Generated with Claude Code

Helmi · 1 year ago

Maybe related but not really duplicates so I'll leave it open.

rboyce-ant contributor · 1 year ago

@Helmi Thanks for the feedback. We intentionally haven't allowed wildcards in Bash allow rules because the commands this would allow are very unsafe. For example, *.env would allow rm -rf / -- .env which is probably not what you intended when writing this rule! The documentation on how permission rules work is here: https://docs.anthropic.com/en/docs/claude-code/iam#tool-specific-permission-rules

Helmi · 1 year ago

@rboyce-ant I get the general approach but my example isn't .env but :.env which in my mind would not allow any bash command on the .env file. I see why wild cards on the allow side of things would be problematic but on deny?

I think wildcards on the deny side should probably be safe?

Sidenote: If wildcards are disabled on intent for bash commands it might be worth putting it in the documentation?

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.