{"slug": "keep-claude-code-away-from-your-env-files-with-permission-deny-rules", "title": "Keep Claude Code away from your .env files with permission deny rules", "summary": "A developer published guidance on using Claude Code permission deny rules to prevent the tool from reading sensitive files such as .env files, private keys, and cloud credentials folders. The deny entries, placed under permissions.deny in .claude/settings.json or settings.local.json, override allow rules so blocked paths stay inaccessible even when broad Read access is granted. The writeup also recommends using ask for commands like git push and allow for safe everyday commands like npm test.", "body_md": "Claude Code reads files to help you. That is great, until the file is .env, a private key, or a cloud credentials folder. Permission deny rules let you block those reads outright.\n\nIn .claude/settings.json (shared with the team) or settings.local.json (personal), add these entries under permissions.deny:\n\nDeny rules win over allow rules, so even if you later allow broad Read access, these paths stay blocked.\n\nUse deny for things that must never happen, ask for things like git push that need a human, and allow for safe everyday commands like npm test.\n\nI keep copy-ready Claude Code configs (CLAUDE.md templates, slash commands, hooks, permission rules) in Vildanden Agent Config. There is a free sample: [https://justly-mia-429.rehost.page/](https://justly-mia-429.rehost.page/)", "url": "https://wpnews.pro/news/keep-claude-code-away-from-your-env-files-with-permission-deny-rules", "canonical_source": "https://dev.to/vildandenai/keep-claude-code-away-from-your-env-files-with-permission-deny-rules-gii", "published_at": "2026-11-09 01:16:24+00:00", "updated_at": "2026-11-09 02:02:48.503520+00:00", "lang": "en", "topics": ["ai-tools", "ai-agents", "developer-tools"], "entities": ["Claude Code", "Anthropic", "Vildanden Agent Config"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/keep-claude-code-away-from-your-env-files-with-permission-deny-rules", "markdown": "https://wpnews.pro/news/keep-claude-code-away-from-your-env-files-with-permission-deny-rules.md", "text": "https://wpnews.pro/news/keep-claude-code-away-from-your-env-files-with-permission-deny-rules.txt", "jsonld": "https://wpnews.pro/news/keep-claude-code-away-from-your-env-files-with-permission-deny-rules.jsonld"}}