Agents need guardrails that keep them away from secrets and from their own configuration. Deny rules on .env and credential paths, ignore files such as .cursorignore, and built-in protection for .git and agent settings folders all help. Ignore files often limit indexing and reads by tools but not what a shell command can open.
Read in this order
- OfficialClaude Code: Permission modes (protected paths)Start here: which paths stay protected even in permissive modes.
- OfficialCursor: Ignore fileHow ignore files work and where their coverage stops.
- OfficialClaude Code: SecurityHow deny rules and sandboxing combine to protect secrets.