Blocking Claude Code from reading a .env credentials file
CCDV-F
Claude Code
Easy
Question 27 of 105
A repository contains a .env file with database credentials. Engineers want Claude Code's file tools blocked from reading it in every session on that project.
Which permission rule accomplishes this?
Show answer and explanation
BA deny rule Read(./.env) in the project's settings
A Read deny rule is what the docs prescribe: deny beats allow, it also blocks Edit and Write on the same path, and it covers the file commands Claude Code recognises in Bash such as cat and head. An Edit deny rule is consulted but governs changes, not reads. The Bash rule closes one command spelling and leaves the Read tool open. Claude Code consults only Read and Edit path rules, so a Write path rule is accepted, never checked, and flagged at startup.
Anonymous, no account needed. Your tally stays in this browser.
Practice by topic: Claude Code questions