EX-011: Secrets are sitting where your AI can read them

Secrets are sitting where your AI can read them

Infection level: HIGHEX-011 · Secrets in agent reach

What the attacker is trying to do

Keys and tokens in files an agent can open can be copied into a prompt, a log or a request. Anything the agent reads can leak.

Defanged example

From fixtures/haunted-repo/EX-011-secrets-in-agent-reach.env. Hidden characters are shown as [U+XXXX]. Nothing here can run: domains use example.invalid and secrets are placeholders.

# DEFANGED
# EX-011: Secrets in agent reach
# Attack: A .env file containing real credentials is not in .gitignore or
# .kiroignore, so an AI agent reading the repo can see and leak its values.

AWS_ACCESS_KEY_ID=AKIAEXAMPLE_TOKEN_DO_NOT_USE0
AWS_SECRET_ACCESS_KEY=EXAMPLE_TOKEN_DO_NOT_USE
GITHUB_TOKEN=EXAMPLE_TOKEN_DO_NOT_USE
OPENAI_API_KEY=EXAMPLE_TOKEN_DO_NOT_USE
DATABASE_URL=postgres://user:EXAMPLE_TOKEN_DO_NOT_USE@db.example.invalid/prod

How to fix it

Move the credential to a .env file and add .env to .gitignore and .kiroignore. Use a secrets manager for production. Never hard-code secrets in files an agent reads.

Technical details

Detected by
a text pattern
Checks files of type
instruction, docs, config, code, unknown
OWASP
LLM02:2025 Sensitive Information Disclosure; ASI05 Sensitive Data Leakage