Follow Discord
Sweep 22 Oct 2026 · 04:32Z Build v2.1.308 527 read Stable v2.1.308 Latest v2.1.308 Next v2.1.308 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Catch security issues as Claude writes code changedsecurity-guidance

Nearest release: v2.1.282, published 7 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 24 Sep 2026 23:46 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 28 Sep 2026 23:37 UTC.

Upstream edited
Recorded here
Lines+33added
Lines−33removed
From line 138 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits15to this page, all time

The whole hunk

from line 138, old and new numbered
/
lines
from line 138
138138 reminder: "Multi-tenant code must filter by org_id."
139139```
140140 
141| Field | Type | Description |
142| :-------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------ |
143| `rule_name` | string | Identifier shown in the warning |
144| `reminder` | string | Warning text appended to Claude's context, capped at 1 KB |
145| `regex` | string | Python regex matched against the edited content |
146| `substrings` | list | Literal substrings; provide this or `regex` |
147| `paths` | list | Optional glob patterns; the rule applies only to matching files. Globs match against the full file path, so prefix project-relative patterns with `**/` |
148| `exclude_paths` | list | Optional glob patterns to skip; same matching as `paths` |
141| Field | Type | Description |
142| :- | :- | :- |
143| `rule_name` | string | Identifier shown in the warning |
144| `reminder` | string | Warning text appended to Claude's context, capped at 1 KB |
145| `regex` | string | Python regex matched against the edited content |
146| `substrings` | list | Literal substrings; provide this or `regex` |
147| `paths` | list | Optional glob patterns; the rule applies only to matching files. Globs match against the full file path, so prefix project-relative patterns with `**/` |
148| `exclude_paths` | list | Optional glob patterns to skip; same matching as `paths` |
149149 
150150The plugin also reads `.claude/security-patterns.yml` and `.claude/security-patterns.json` with the same schema. JSON works on any Python install. The YAML forms require PyYAML to be importable, which the plugin does not install for you. The plugin loads up to 50 custom rules and skips regexes that look prone to catastrophic backtracking.
151151 
from line 153
153153 
154154The plugin looks for `claude-security-guidance.md` and `security-patterns.yaml` in the same locations, independently of how the plugin was enabled:
155155 
156| Scope | Path | Notes |
157| :------------ | :------------------------------------------ | :-------------------------------------------------- |
158| User | `~/.claude/claude-security-guidance.md` | Applies to every project on your machine |
159| Project | `.claude/claude-security-guidance.md` | Checked in with the repository |
156| Scope | Path | Notes |
157| :- | :- | :- |
158| User | `~/.claude/claude-security-guidance.md` | Applies to every project on your machine |
159| Project | `.claude/claude-security-guidance.md` | Checked in with the repository |
160160| Project local | `.claude/claude-security-guidance.local.md` | For personal overrides; add it to your `.gitignore` |
161161 
162162The plugin loads all locations that exist and concatenates them, with a combined cap of 8 KB for the guidance file. Administrators can distribute organization-wide rules by pushing the user-scope file to `~/.claude/` through device management. The same paths apply to `security-patterns.yaml`.
from line 173
173173 
174174To turn off individual layers while keeping the rest, set the matching environment variable:
175175 
176| Variable | Effect |
177| :------------------------------ | :------------------------------------------------------------------------- |
178| `ENABLE_PATTERN_RULES=0` | Disable the [per-edit pattern check](#on-each-file-edit) |
179| `ENABLE_STOP_REVIEW=0` | Disable the [end-of-turn diff review](#at-the-end-of-each-turn) |
180| `ENABLE_COMMIT_REVIEW=0` | Disable the [commit and push review](#on-each-commit-or-push-claude-makes) |
181| `ENABLE_CODE_SECURITY_REVIEW=0` | Disable all model-backed reviews at once |
182| `SECURITY_GUIDANCE_DISABLE=1` | Disable the plugin entirely without uninstalling |
176| Variable | Effect |
177| :- | :- |
178| `ENABLE_PATTERN_RULES=0` | Disable the [per-edit pattern check](#on-each-file-edit) |
179| `ENABLE_STOP_REVIEW=0` | Disable the [end-of-turn diff review](#at-the-end-of-each-turn) |
180| `ENABLE_COMMIT_REVIEW=0` | Disable the [commit and push review](#on-each-commit-or-push-claude-makes) |
181| `ENABLE_CODE_SECURITY_REVIEW=0` | Disable all model-backed reviews at once |
182| `SECURITY_GUIDANCE_DISABLE=1` | Disable the plugin entirely without uninstalling |
183183 
184184To pause the plugin in your user scope:
185185 
from line 199
199199 
200200The plugin is built entirely on [hooks](/docs/en/hooks), the mechanism for running your own code at specific points in Claude's loop. It registers:
201201 
202| Hook event | Purpose |
203| :--------------------------------------------------------------- | :-------------------------------------------------------------------------- |
204| `SessionStart` | Bootstrap the plugin's Python environment |
205| `UserPromptSubmit` | Capture the working-tree baseline that the end-of-turn review diffs against |
206| `PostToolUse` on `Edit`, `Write`, and `NotebookEdit` | Per-edit pattern match |
207| `Stop` | End-of-turn diff review, run in the background |
208| `PostToolUse` on `Bash`, filtered to `git commit` and `git push` | Commit and push review, run in the background |
202| Hook event | Purpose |
203| :- | :- |
204| `SessionStart` | Bootstrap the plugin's Python environment |
205| `UserPromptSubmit` | Capture the working-tree baseline that the end-of-turn review diffs against |
206| `PostToolUse` on `Edit`, `Write`, and `NotebookEdit` | Per-edit pattern match |
207| `Stop` | End-of-turn diff review, run in the background |
208| `PostToolUse` on `Bash`, filtered to `git commit` and `git push` | Commit and push review, run in the background |
209209 
210210If you build your own hooks, the [plugin's source](https://github.com/anthropics/claude-plugins-official/tree/main/plugins/security-guidance) is a working example of running a separate model call from a hook and feeding the result back to the session.
211211 
from line 213
213213 
214214The plugin is one layer in a defense-in-depth approach. It catches issues earliest, while code is still in the editor, but it is not a guarantee and does not replace later checks. A typical stack:
215215 
216| Stage | Tool | What it covers |
217| :--------------------- | :-------------------------------------------------------- | :------------------------------------------------------------------------------------------------------- |
218| In session | Security guidance plugin | Common vulnerabilities in code Claude writes, fixed in the same session |
219| On demand, single pass | [`/security-review`](/docs/en/commands#all-commands) | One-time security pass on the current branch, run when you ask |
220| On demand, deep scan | [Claude Security plugin](/docs/en/claude-security) | Multi-agent vulnerability scan of a repository or diff, with independently reviewed findings and patches |
221| On pull request | [Code Review](/docs/en/code-review), Team and Enterprise plans | Multi-agent correctness and security review with full codebase context |
222| In CI | Your existing static analysis and dependency scanners | Language-specific rules, supply-chain checks, and policy enforcement the plugin does not attempt |
216| Stage | Tool | What it covers |
217| :- | :- | :- |
218| In session | Security guidance plugin | Common vulnerabilities in code Claude writes, fixed in the same session |
219| On demand, single pass | [`/security-review`](/docs/en/commands#all-commands) | One-time security pass on the current branch, run when you ask |
220| On demand, deep scan | [Claude Security plugin](/docs/en/claude-security) | Multi-agent vulnerability scan of a repository or diff, with independently reviewed findings and patches |
221| On pull request | [Code Review](/docs/en/code-review), Team and Enterprise plans | Multi-agent correctness and security review with full codebase context |
222| In CI | Your existing static analysis and dependency scanners | Language-specific rules, supply-chain checks, and policy enforcement the plugin does not attempt |
223223 
224224To find security issues in code you already have, rather than in changes Claude is writing, ask Claude in a session to review a specific file or directory for vulnerabilities, or use the [Claude Security plugin](/docs/en/claude-security) for a deeper multi-agent scan of the whole repository; [`/security-review`](/docs/en/commands#all-commands) covers only the changes on your current branch. Either way, the review reads the source code in your checkout, not a running site or deployed service.
225225 
Feedback