AIToday
Large Language ModelsAI Coding AssistantsAI Safety & AlignmentZenn AI/MLPublished: Nov 8, 2026, 06:00 JST

Claude Code permissions tested: Read(./.env) and Bash(git push *) leak

Send on LINE
Claude Code permissions tested: Read(./.env) and Bash(git push *) leak

3 Key Points

  1. What happened

    In a test on macOS with Claude Code v2.1.280, a deny rule on Read(./.env) stopped the read tool and cat, but python3 and filename-less grep still read the file; git -C work push origin main slipped past Bash(git push *).

  2. Why it matters

    The rules are enforced by Claude Code itself, not the AI model, and are checked deny → ask → allow—so a broad deny cannot be carved out with an allow, and only recognized command forms are reliably blocked.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

Context & Analysis

The line is drawn between CLAUDE.md, which it calls a request to Claude, and permissions, which Claude Code enforces on its own before an action runs. That distinction matters because the default has shifted: from v2.1.283, terminal and VS Code sessions start in Auto mode, where a separate classifier approves actions instead of the user, so the confirmation dialog most users used to see rarely appears. Choosing "don't ask again" in that dialog quietly adds allow rules—for Bash commands and web fetches they persist in .claude/settings.local.json for the repository, while file-edit approvals last only until the session ends. Opening the permissions list shows how many such rules have accumulated. The test results themselves set the limits: the .env deny held against the read tool and cat but not against a Python one-liner or a filename-less grep, and denial was verified in deny mode because the ask dialog could not be reproduced automatically. For git push, commands joined with && and prefixed with timeout were still caught, but git -C, git -c push.default=current, and git 'push' were not. What happens to a command that slips through then depends on the mode—Manual shows its normal confirmation, Auto leaves it to the classifier—and hooks' PreToolUse can inspect commands with a custom script. The sandbox, off by default, is offered as the OS-level backstop for script-based reads.

FAQ
What's the difference between CLAUDE.md and permissions?
CLAUDE.md holds instructions to Claude and works as a request. Permissions are enforced by Claude Code itself, checked against an action right before it runs, independent of the AI's judgment.
Which rule wins if several apply?
Claude Code checks deny, then ask, then allow, and the first match decides. An allow cannot create an exception to a deny—denying Bash(aws *) still blocks an allowed Bash(aws s3 ls).
How do I stop a .env file from being read completely?
The Read deny rule covers Claude's read tool, recognized Bash file commands like cat and head, and input redirection. To also stop script-based reads, the sandbox, which is off by default, is an option.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next article"Illegible" AI risks won't yield to safety cases, LessWrong essay argues