Part of the AI coding agent security checklist
A secure-by-default AI coding agent setup
Secure by default means the safe behaviour is the one you get without doing anything, and the risky one needs a deliberate step. Coding agents do not start that way. This guide lists the settings and habits that move them closer.
Checked against Claude Code's documentation under Sources and ranwhat's source. Published .
What secure by default means for an agent
An agent starts with whatever your account can do: your files, your shell, your tokens. Nothing in that is wrong by itself. The risk is that the agent reads text you did not write and acts on it. OWASP's advice for that is to give the model least privilege, require human approval for high-risk actions, and treat the model as an untrusted user. Secure by default is those three, set up once, so you are not relying on a prompt.
The settings to start from
This is one ~/.claude/settings.json that combines the deny rules and the sandbox from the prompt injection guide. Adjust the hosts and paths to your own work.
{
"permissions": {
"deny": ["Bash(curl *)", "Bash(wget *)", "Read(./.env)", "Read(~/.aws/**)"],
"disableBypassPermissionsMode": "disable"
},
"sandbox": {
"enabled": true,
"allowUnsandboxedCommands": false,
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"],
"strictAllowlist": true
}
}
}The reasoning behind each line is in prompt injection in coding agents and blocking .env reads.
Give it less to steal
A command the agent runs can use every token in its environment and on disk. Make that set small.
Review what you plug in
Every MCP server and every hook is a program that runs for the agent, and neither one is limited by the sandbox.
Keep a record you can read
The transcripts your agent writes are already an audit trail, and they expire. Claude Code's are removed after 30 days by default.
Run the check on a schedule that suits you, so that a risky action or a leaked secret is something you find in days and not never. The audit log guide covers a hook or OpenTelemetry for a record from now on, and where each agent keeps its history covers the others.
ranwhat reads the history locally and flags risky actions and secrets left on disk. It does not enforce any of the settings above, and it blocks nothing unless you install its Claude Code hook. It tells you what already happened.
Where to go from here
The AI coding agent security checklist puts these steps in order. To check what an agent wrote, read how to check that AI-written code is secure. All guides are on the guides page.
Sources
- Claude Code securitysafeguards, no system immune, MCP not audited
- Claude Code sandboxingwhat the sandbox covers, allowedDomains, unsandboxed retry
- Claude Code permissionsdeny, ask, allow order, Bash rule limits, bypassPermissions
- OWASP LLM01: Prompt Injectionleast privilege, human approval, treat the model as untrusted
- Simon Willison: the lethal trifectaprivate data, untrusted content, a way out
- ranwhat READMEwhat check reads and flags