Claude Code security: what to check in an app it helped you build.
People mean two things by Claude Code security. One is the tool itself: what it may read, run and send while it works on your machine. The other is the app it wrote: whether a stranger can read your users' data, call your payment code or find a secret key. This guide covers both, in that order, and is honest about where the built-in reviews stop.
The short answer: the tool has guardrails, your app needs its own
Claude Code's permissions and sandbox protect your computer while it works. They say nothing about the app it produces. Anthropic's own help article says its automated reviews should complement, not replace, your existing security practices and manual review. So treat the tool settings and the app check as two separate jobs. Do both on your own app, or on an app whose owner has asked you to.
Part one: how Claude Code handles your machine.
Six facts from Anthropic's documentation that decide what the agent can touch. Settings change between versions, so check the current docs for your install.
Manual mode asks first
In Manual mode, Claude Code starts with read-only permissions and asks before it edits a file, runs tests or executes a command. Other modes trade prompts for speed: Accept Edits approves file edits and a short list of file commands inside the working folder, and bypassPermissions skips most prompts. Teams can switch bypass mode off for everyone in managed settings.
Deny beats allow
Permission rules are checked in a fixed order: deny, then ask, then allow. An allow rule can't open a hole in a deny rule. A rule such as Read(./.env) in the deny list keeps Claude's file tools away from your environment file.
A Bash rule is not a wall
Anthropic says so directly: a rule like Bash(curl *) stops curl https://... but not /usr/bin/curl or sh -c 'curl ...'. Read and Edit deny rules also don't stop a script that opens the file itself. And once you approve a Bash command, it can write anywhere your user account can.
The sandbox is off until you turn it on
Run /sandbox to put Bash commands behind an operating-system boundary: writes limited to the project folder, and network traffic through a proxy that only reaches domains you allow. It uses Seatbelt on macOS and bubblewrap on Linux and WSL2, and doesn't run on native Windows. It still lets commands read most of your machine, including ~/.ssh, unless you deny those paths.
MCP servers are your call
Claude Code asks before it trusts a new project folder or the MCP servers in a project's .mcp.json. Anthropic does not audit or manage any MCP server, so a server you add has the access you give it. Treat it like any other dependency.
Web content arrives as a summary
When Claude fetches a page, it gets a summary of the answer rather than the raw page, and network commands such as curl and wget are not approved automatically. That lowers the risk of a web page or file steering the agent, which is called prompt injection. It doesn't remove it.
Five settings to make before the next session.
They take a few minutes and close the gaps people most often leave open. The names are from Anthropic's docs.
Deny your secrets
Add deny rules for .env files, key files and anything holding a token, so Claude's file tools never read them. Then remember the limit above, and keep real production keys out of the project folder altogether.
Turn on the sandbox
Run /sandbox and keep the allowed domains to the package registry and the services the project really calls. Add deny rules for ~/.ssh, cloud credentials and other folders the agent has no reason to read.
Use a separate test project
Point the local app at a development Supabase or Firebase project, a Stripe test-mode key and test data. If something goes wrong in a session, it goes wrong somewhere that holds no customer data.
Keep bypass for throwaway work
Skipping prompts is fine in a disposable container. On the machine that holds your keys and your client work, stay in a mode that asks. A team lead can switch bypass mode off in managed settings.
Review every MCP server you add
Read what each server can do, who maintains it and which tokens it needs. Give it the narrowest token the service offers, and remove servers you no longer use.
Part two: what Claude Code can check in the code it wrote.
Anthropic offers three different things here. They are easy to mix up, and they don't cover the same ground.
Type /security-review in a session and Claude reviews the changes on your current branch against the default branch on origin, looking for risks such as injection, authentication problems and data exposure. It needs a git remote called origin.
Use it before every merge. Its strength is the diff: a new endpoint with no auth check, a query built from user input, a key added to front-end code. Its limit is the same diff. It looks at what changed, not at a rule that was wrong from the first commit.
Anthropic's open-source claude-code-security-review Action runs on pull requests, analyses only the changed files and posts findings as comments on the lines concerned. Its README lists the categories it looks for, including authentication and authorisation, data exposure, business logic such as race conditions, and supply chain issues. It filters out denial of service, rate limiting and open redirects as likely false positives.
One warning from the README matters: the Action is not hardened against prompt injection and should only review trusted pull requests. Turn on GitHub's setting that requires approval before workflows run for outside contributors.
Five things to check by hand in an AI-built web app.
This is where React apps on Supabase or Firebase with Stripe most often go wrong, whichever tool wrote them. Broken access control is number one in the OWASP Top 10:2025.
if true must never reach production, and a rule that only checks request.auth != null gives every signed-in user the whole database. Our Supabase RLS guide has the SQL to check each table and a two-user test. VITE_ is bundled into the JavaScript every visitor downloads, and Vite's docs say those variables must not hold secrets. Search your built files for sb_secret_, service_role, sk_live_ and any provider token. Supabase says a secret key never belongs in a browser or in source control. If one has been there, rotate it. Stripe-Signature header and the endpoint secret, using the raw request body. Many generated handlers parse the JSON first, which breaks verification, or skip it. Stripe also sends the same event more than once, so log the event IDs you have handled and skip repeats. package.json, check each package is the one you meant, that it is maintained, and that the name is spelled the way its own project spells it. Commit the lockfile so every install gets the same versions. Built with Cursor instead? The same two jobs.
Cursor has its own controls for the agent and its own reviews for the code. The names differ; the limits are much the same.
.cursorignore are kept from the agent, Tab and @-mentions, but Cursor's docs say its terminal and MCP tools cannot block access to them, and that complete protection isn't guaranteed. Keep production secrets out of the project folder here too. /review-security command checks your branch before you push. Both read code, so the five hand checks above still apply. A routine that works with any AI coding assistant.
No tool covers everything. Layering cheap checks covers most of it, and leaves a person for the parts only a person can judge.
Write the rules down first
One line per table: who may read it, who may change it. Give the list to the assistant when it builds, and use it when you review. A review without rules can only find generic bugs.
Review every diff
Run /security-review or Cursor's /review-security before each merge, or the Action or Bugbot on each pull request. Read the findings; a comment that nobody acts on protects nothing.
Check the live settings
Once per release, look at what lives outside the code: RLS policies or Firebase rules in the console, which keys are set in the hosting provider, which webhook endpoints Stripe sends to. Then run the two-user test.
Have a person look before it matters
Before real users, real payments or a customer's questionnaire, someone who did not write the code should go through data access, sign-in, keys, payments and backups against your rules, with the owner's consent.
Questions about Claude Code security.
Read(./.env), turn on the sandbox, and keep production keys out of the project. Anthropic notes that deny rules don't stop a script that opens the file itself. Sources
Last checked 19 November 2026. Both tools change often, so check the current documentation before you rely on a setting or a plan.
Claude Code: Security Manual mode, trust prompts, MCP, how web content is handled.
Claude Code: Permissions Modes, deny-ask-allow order, the .env rule, why Bash rules are not a boundary.
Claude Code: Sandboxing What the sandbox covers, its defaults and platforms.
Claude Code: Commands What /security-review reviews.
Claude Help Center: Automated security reviews Reviews complement manual review.
anthropics/claude-code-security-review The GitHub Action, its categories and its prompt injection warning.
Anthropic: Claude Code Security The research preview and who can use it.
Cursor: Run modes, Ignore files, Bugbot, Security Review and Security The Cursor section.
OWASP Top 10:2025 Broken access control and supply chain failures.
Supabase: API keys and Firebase: Avoid insecure rules Data access checks.
Vite: Env variables and modes Which variables reach the browser.
Stripe: Webhooks Signature checks and duplicate events.
Book a free teardown.
Tell us what your app does and which assistant built it. With the owner's consent, we spend 20 minutes on its riskiest part, usually who can read which data, and tell you what to fix first.