Claude Code security review: what it checks and what to add

Claude Code can review its own work: the /security-review command checks the changes on your branch, and Anthropic's plugins review code while it is written. These reviews catch common vulnerabilities early. They are model-based, so they can miss issues and give different results from run to run. Pair them with an independent, rule-based scanner and a few permission settings.

Last reviewed: November 2026

What Claude Code offers for security today

Claude Code has two kinds of security features, and they answer different questions. The first kind limits what the agent may do on your machine. The second kind reviews the code the agent writes.

Controls on the agent are described in Anthropic's Claude Code security documentation: permission modes that decide which actions run without asking you, allow, ask and deny rules, a sandbox for Bash commands with filesystem and network isolation, and a trust prompt for folders you have not opened before. These protect your workstation and your credentials. They do not judge whether the generated code is safe.

Reviews of the code come in several layers. This is how Anthropic's documentation describes them:

FeatureWhen it runsWhat it does
/security-reviewWhen you run itAnalyses the changes on your current branch for vulnerabilities such as injection, authentication issues and data exposure (commands reference).
Security guidance pluginAutomatically, while Claude writesA pattern check on each file edit, a model review at the end of each turn and a deeper review on each commit or push Claude makes (plugin documentation).
Claude Security pluginWhen you run itA multi-agent scan of a repository or a diff. Findings are checked by independent verifier agents before they reach the report (plugin documentation).
Code ReviewOn pull requestsSeveral agents review each GitHub pull request for logic errors and security vulnerabilities. Available on Team and Enterprise plans (Code Review documentation).

What the /security-review command does

/security-review ships with Claude Code. According to the Claude Code commands reference, it reviews the diff between your branch and the default branch of origin, so it needs an origin remote. It looks at what changed, not at the whole repository.

According to Anthropic's support article on automated security reviews, the command looks for SQL injection, cross-site scripting, authentication and authorization flaws, insecure data handling and dependency vulnerabilities. It explains each issue it finds, and you can then ask Claude to implement the fix. The command can be customised for a project.

The same analysis is available as a GitHub Action that comments on pull requests. The action's README on GitHub states that the action is not hardened against prompt injection and should be used only on trusted pull requests. It also lists what the action filters out on purpose as low-impact or noisy, including denial of service, rate limiting concerns and open redirects. If one of those matters to your application, you need another check for it.

A typical run looks like this:

> /security-review

  (Claude reads the diff of your branch and reports findings)

> Fix the SQL injection in orders/search.py and run the review again.

What a model-based review can and cannot be relied on for

A model reads code the way a person does. That makes it good at questions that need context: is this endpoint missing an ownership check, does this function trust a value it should not, does the fix break the caller. The security guidance plugin's documentation lists authorization bypass and insecure direct object references among the issues its model review can catch and a string match cannot.

The same property sets the limits. Anthropic's documentation is direct about them:

  • It can miss issues. The Code Review documentation says that a review with no findings does not mean the code is secure. The security guidance documentation calls the plugin one layer of defence in depth, not a complete security solution.
  • It is not repeatable. The Claude Security plugin documentation says that scans are nondeterministic: two scans of the same code can surface different findings.
  • It does not block by default. None of the security guidance plugin's layers block a write or a commit. Findings go back to Claude as instructions. A Code Review result does not approve or block a pull request by itself.
  • It can be steered by what it reads. Text in a pull request or a file is input to the model, which is why the GitHub Action is documented for trusted pull requests only.

There is also a general point that applies to any author and any reviewer. A reviewer built on the same kind of model as the author tends to share the author's blind spots. Anthropic reduces this by running the review as a separate call with a fresh context and a security-focused prompt. A check that works in a different way reduces it further.

So rely on a model-based review to find problems early and to explain them. Do not use an empty review as proof that a release is clean, and do not use it as the control an auditor will ask you to repeat.

Where an independent scanner fits

Anthropic's own layering puts a second kind of tool next to its reviews. Both plugin pages end with a table whose last row is your existing static analysis and dependency scanners, running in CI, for language-specific rules, supply-chain checks and policy enforcement. The Claude Security plugin page says the plugin does not replace existing source-code security tools, and that its reasoning complements the deterministic checks those tools provide.

A rule-based scanner adds three things a model review does not:

  • Repeatability. The same rule on the same code gives the same result, so a finding that disappears has been fixed, not overlooked.
  • Systematic coverage. Static application security testing (SAST) traces data flows through the whole project against a fixed rule set, and software composition analysis checks every dependency against known vulnerabilities.
  • A gate and a record. A scan can fail a pipeline, and its report is evidence for a team lead or an auditor.

The scanner does not have to wait for CI. Claude Code can call any tool that has an API, so the scan can sit inside the agent loop: write, scan, read the findings, fix, scan again. With DerScanner the agent reads the API description at docs.derscanner.com and connects by itself, which takes three minutes. The steps are on the page about connecting a coding agent to DerScanner. DerScanner runs in the cloud, on-premise or in a network with no internet access.

Checklist: Claude Code settings

These settings come from Anthropic's permissions documentation and the security best practices in the security documentation.

  • Deny reads of secret files. Add Read deny rules for .env files and secret folders. Rules are evaluated deny first, then ask, then allow, so an allow rule cannot reopen a denied path.
  • Turn on the sandbox for Bash. Run /sandbox. The documentation notes that a Bash deny rule matches the command text and is not a security boundary around the program. The sandbox enforces filesystem and network limits at the operating system level.
  • Audit permissions. Run /permissions regularly and remove allow rules nobody needs any more.
  • Share the configuration. Check the project's permission settings into version control. In an organisation, use managed settings to enforce the standard.
  • Install the security guidance plugin and describe your threat model in .claude/claude-security-guidance.md.
.claude/settings.json
{
  "permissions": {
    "deny": [
      "Read(./.env)",
      "Read(./secrets/**)"
    ]
  },
  "enabledPlugins": {
    "security-guidance@claude-plugins-official": true
  }
}
.claude/claude-security-guidance.md
# Security guidance for this repo

- Every route under /admin checks the admin role before any database read.
- Build SQL with parameters, never with string formatting.
- Read credentials from the secret manager, never from source files.

Checklist: review habits

  • Run /security-review before you commit a significant change. Anthropic's support article recommends this.
  • Read the diff yourself for anything that touches authentication, authorization, payments or personal data. The security documentation states that you are responsible for reviewing proposed code and commands before approval.
  • Give the agent an independent scanner and one standing instruction: scan after each change, fix the findings, scan again.
  • Keep a SAST and dependency scan in CI as the gate. Do not let the agent that wrote the code be the only reviewer.
  • Do not pipe untrusted content into the agent, and run automated review only on pull requests from people you trust.
  • When a finding is suppressed, record who decided and why. A person makes that call, not the agent.

For the risks this checklist is meant to catch, see vibe coding security risks. For a full team process, from the agent loop to release, see how to secure AI-generated code.

Frequently Asked Questions

Try DerScanner on your own code, free

Give Claude Code a second opinion: connect it to DerScanner, and it scans the code it writes, fixes the findings and scans again.

Request a free pilot. We give you access and help with the first scan. It works in the cloud and on-premise.

Want to describe your project first? Take the 2-minute PoC survey