Claude Code plugin to catch security vulnerabilities during coding

Anthropic released the security-guidance plugin for Claude Code to review code changes for common vulnerabilities and fix them in the same session.

cpaua3 min445

Anthropic has introduced the security-guidance plugin for Claude Code, designed to catch common vulnerabilities as the AI writes code and resolve them within the same session. This tool acts as an initial screening layer to reduce the volume of security-related issues that reach human reviewers during pull requests. Internal testing at Anthropic showed a 30–40% decrease in security-related comments in PRs created with the plugin.

Three levels of vulnerability scanning

The plugin uses hooks to monitor code changes at different depths. On every file edit, it performs a fast pattern match for risky calls, such as eval(), os.system, or dangerouslySetInnerHTML. This stage uses deterministic string matching and does not incur model usage costs.

At the end of each turn, the plugin computes a git diff of all changes made by Claude, including Bash commands and subagents. A separate Claude instance reviews this diff in the background for complex issues like authorization bypass, server-side request forgery, and weak cryptography.

When Claude executes a git commit or git push via the Bash tool, the plugin performs a deeper agentic review. This process analyzes surrounding code, including sanitizers and callers, to verify if a potential vulnerability is real in the specific codebase context.

Customizing security policies

Organizations can define their own rules in a claude-security-guidance.md file. This Markdown file allows teams to describe their threat model and checklists in plain language, which the model-backed reviews use as additional context.

For the per-edit layer, users can create a .claude/security-patterns.yaml file to add regex or substring rules. These rules can include specific reminders for the AI, such as warnings about hardcoded API key prefixes or requirements to filter multi-tenant queries by org_id.

These files can be placed in the project repository or distributed via MDM to the user scope at ~/.claude/. The plugin concatenates these rules with built-in checks, though built-in checks cannot be individually removed.

Installation and environment requirements

The plugin is available for all Claude Code users via the official marketplace. To install it in a terminal session, use the following command:

code
/plugin install security-guidance@claude-plugins-official

The system requires Python 3.7 or later, though Python 3.10 or later is necessary for agentic commit reviews and third-party providers like Amazon Bedrock. It also requires a git repository to perform end-of-turn and commit reviews.

Once installed, the plugin runs automatically without requiring separate commands. Users can manage their Claude Code sessions more effectively by configuring the plugin in .claude/settings.json to enable it for entire teams.

The end-of-turn and commit reviews use additional model usage, defaulting to the Claude Opus model. Users can change this by setting the SECURITY_REVIEW_MODEL and SG_AGENTIC_MODEL environment variables. This tool is intended as one layer of defense and should be paired with system checkups and CI scanning for full security enforcement.

Sources

Catch security issues as Claude writes code - Claude Code Docs

Share

Author

cpaua

VibeCode blog admin. Writing about vibe coding, AI and open source.

Related news

Comments

To leave a comment, log in
Loading...

Weekly digest

The best of vibe coding, AI agents and open source — once a week, no spam.