← Claude Code Hub
Jun 3, 2026 · 4 min read ✦ Tip #090

Security in Claude Code: make it catch its own vulnerabilities before they hit prod

An official plugin puts Claude to work reviewing its own code for vulnerabilities as it writes, and fixing them in the same session. The earliest security layer: it catches the flaw in the editor, not in the PR.

The security-guidance plugin: Claude's code passes through 3 layers (edit, turn, commit) that catch vulnerabilities before prod

TL;DR Install the security-guidance plugin (/plugin install security-guidance@claude-plugins-official) and Claude reviews its own code for vulnerabilities as it writes, in three layers: a per-edit pattern match, an end-of-turn diff review, and a deeper review on every commit. It catches injection, authz bypass, unsafe deserialization, weak crypto, and hands them to Claude to fix in the same session, before the PR. It runs on its own and never blocks: it's one layer of defense, not the only one.

Update, November 1, 2026: installing the plugin from /plugin now activates it when you close the panel, so the /reload-plugins step is no longer needed and I've removed it.

security-guidance doesn't ask Claude to grade itself. It runs an independent review (a separate instance, fresh context, security-focused prompt) over what Claude just wrote. It's the earliest layer in the chain: it catches the flaw in the editor, before it reaches the PR, the review, and CI. Catch it here and it never ships to prod.

The three layers

When What it does Cost
On each edit Pattern match for risky calls: eval(, pickle, dangerouslySetInnerHTML, .innerHTML =, edits under .github/workflows/ 0, no model call
At end of turn Background review of the turn's diff: injection, authz bypass, IDOR, SSRF, weak crypto Model usage
On each commit/push Claude makes Agentic review that reads surrounding code (callers, sanitizers) to cut false positives Model usage

If it finds something, it re-prompts Claude with the finding and Claude fixes it in the conversation. You see the problem and the fix in your session, not in an after-the-fact report.

How to turn it on

# In a Claude Code session:
/plugin install security-guidance@claude-plugins-official

Pick user scope so it loads in every local session. When you close the panel the plugin is active in the session, no /reload-plugins needed. For a shared repo (or Claude Code on the web, where user plugins don't carry over), declare it in .claude/settings.json:

{ "enabledPlugins": { "security-guidance@claude-plugins-official": true } }

From there it runs on its own. No command to remember.

Tune it to your project

Where it fits (and what it isn't)

It's one layer of defense in depth, not a complete solution: the reviewer model can miss things, and no layer blocks the commit. The full chain:

  1. security-guidance, in session (this)
  2. /security-review, on demand when you ask
  3. /code-review locally over your diff, before you open the PR
  4. Code Review / /ultrareview, on the PR
  5. Your CI: static analysis, supply-chain scanners

Each stage catches what the previous one missed. This plugin's value is shrinking what reaches the later ones, not replacing them.

Watch out for

  • It doesn't block. Findings arrive as instructions; Claude fixes them, but the final call is yours.
  • It needs git for the turn and commit reviews. Without a repo, only the pattern match runs.
  • It costs tokens on the turn and commit layers (the per-edit one is free). Capped at 20 commit reviews per hour.
  • It needs Python 3.8+ on your PATH; the first run creates a venv under ~/.claude/security/.
  • The model-backed reviews use a strong model by default, configurable via SECURITY_REVIEW_MODEL and SG_AGENTIC_MODEL.

Reference

Aspect Detail
Install /plugin install security-guidance@claude-plugins-official (active when you close the panel)
Requirements CLI v2.1.144+, Python 3.8+, git (for turn/commit)
Layers edit (patterns) · turn (diff) · commit (agentic)
Custom rules .claude/claude-security-guidance.md · .claude/security-patterns.yaml
Disable layers ENABLE_PATTERN_RULES=0 · ENABLE_STOP_REVIEW=0 · ENABLE_COMMIT_REVIEW=0 · SECURITY_GUIDANCE_DISABLE=1
Built on hooks (PostToolUse, Stop…)

Official docs: Catch security issues as Claude writes code

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
FREE GUIDE

Approve less, but better.

Ten minutes in, you're hitting yes without reading. That's not review, that's prayer. A 10-page guide with the five levers in order of risk.

  • 1. Rules the first match wins
  • 2. Mode a dial, not a switch
  • 3. Auto mode a classifier approves for you
  • 4. Sandbox a fence the OS puts up
  • 5. Bypass only inside a container
Are you a professional Web developer?

You'll receive the guide by email · Unsubscribe anytime

of 10
#

Wmedia · 10 pages
FREE GUIDE · 10 pages · 5 levers

Approve less, but better.

Ten minutes in, you're hitting yes without reading. That's not review, that's prayer. A 10-page guide with the five levers in order of risk.

Are you a professional Web developer? · Unsubscribe anytime

Tired of approving permissions without reading?