PulseAugur
EN
LIVE 00:20:22

Claude Code can access secrets in .env files despite .gitignore

A security researcher discovered that Anthropic's Claude Code, specifically version 2.1.233, can access sensitive information from .env files even when they are included in .gitignore. The agent consistently read the .env file in multiple test runs, regardless of whether it was ignored by Git or renamed. The researcher found that only explicit "Read deny" rules and specific hooks reliably prevented Claude Code from accessing this information, highlighting that standard Git practices are insufficient for protecting secrets from AI agents. AI

IMPACT Highlights potential security risks in AI coding assistants and the need for explicit access controls beyond standard development practices.

RANK_REASON Security vulnerability discovered in a specific AI coding assistant.

Read on dev.to — Claude Code tag →

AI-generated summary · Google Gemini · from 1 sources. How we write summaries →

Claude Code can access secrets in .env files despite .gitignore

COVERAGE [1]

  1. dev.to — Claude Code tag TIER_1 Français(FR) · Charles Hasse ·

    Does Claude Code read your .env file?

    <p>I used to think putting <code>.env</code> in <code>.gitignore</code> was enough to keep the agent out of it.</p> <p>So on August 17, 2026 I built a throwaway repo, planted a fake database password and a fake Stripe key in a <code>.env</code>, and asked Claude Code 2.1.233 some…