Claude Code security audit — checks the version, permissions (missing deny rules AND allows that are too broad in settings.json + settings.local.json), secret-guard.js patterns, scans the supply chain (dependencies, editor/browser extensions, MCP configs) with Bumblebee, and creates a summary Knowledge note. Re-run after each major Claude Code update or security incident. Trigger with /security-audit.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Security Audit?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/zoomma1-security-audit)
---
name: security-audit
description: Claude Code security audit — checks the version, permissions (missing deny rules AND allows that are too broad in settings.json + settings.local.json), secret-guard.js patterns, scans the supply chain (dependencies, editor/browser extensions, MCP configs) with Bumblebee, and creates a summary Knowledge note. Re-run after each major Claude Code update or security incident. Trigger with /security-audit.
---
# Skill: /security-audit
Full audit of the Claude Code security setup in 7 steps. Produces a report + dated Knowledge note.
---
## Step 1 — Claude Code version
```bash
claude --version
```
Extract the version number (e.g. `2.1.119`).
**Minimum reference version**: `2.1.90`
(Adversa AI bug fix — bypasses deny rules if >50 subcommands)
- If version ≥ 2.1.90 → ✅ SAFE
- If version < 2.1.90 → 🔴 **CRITICAL** — update immediately (`npm update -g @anthropic-ai/claude-code`)
---
## Step 2 — Permissions: deny **and** allow
> ⚠️ Read both sections together, never the denylist alone. A broad allow short-circuits deny rules: matching is done on the **prefix** of the command, so `Bash(bash *)` auto-approves `bash -c 'rm -rf ~'` — which doesn't start with `rm`, and so `Bash(rm -rf*)` never matches. An audit that only looks at `deny` returns a "9/9 ✅" verdict on an open setup. (Cause: audit 2026-07-27.)
**Files to read — both**:
- `~/.claude/settings.json` → `permissions.deny` + `permissions.allow`
- `~/.claude/settings.local.json` → `permissions.allow` ← **this is where allows pile up across sessions**, and it's the file that was overlooked on 2026-07-27
### 2A — Deny rules
**Reference list** (expected deny rules):
```
Bash(rm -rf*)
Bash(sudo rm*)
Bash(git push *--force*)
Bash(git push *-f *)
Bash(git reset --hard*)
Bash(git stash drop*)
Bash(git stash clear)
Bash(git branch -D*)
Bash(chmod -R 777*)
```
For each rule in the reference list:
- ✅ Present in `permissions.deny`
- ⚠️ Missing → list as missing
If rules are missing → propose the JSON block to add to `settings.json` and wait for {USER_NAME}'s validation before writing.
### 2B — Broad allows
Flag any `allow` rule that grants a **generic interpreter, executor or network channel**. Patterns to flag:
| Pattern | Why |
|---|---|
| `Bash(bash *)`, `Bash(sh *)`, `Bash(zsh *)` | `-c 'anything'` — bypasses all deny rules |
| `Bash(python *)`, `Bash(python3 *)`, `Bash(node *)`, `Bash(uv run *)` | `-c` / `-e` = arbitrary execution |
| `Bash(awk *)`, `Bash(perl *)`, `Bash(find *)` | `system()`, `-exec` — diverted execution |
| `Bash(ssh *)`, `Bash(ssh)`, `Bash(scp *)` | arbitrary command on a remote machine |
| `Bash(curl *)`, `Bash(wget *)` | exfiltration + `\| bash` |
| `Bash(git *)`, `Bash(npm *)`, `Bash(docker *)` | destructive subcommands or arbitrary hooks |
Sorting rule: a **broad** allow (bare verb + `*`) is replaced by the **specific** entries already present further down the file — they almost always exist, accumulated session after session.
Before proposing a removal, map the actual consumers:
- **Hooks** (`settings.json` → `hooks`) don't go through the Bash tool → never impacted by removing an allow.
- Skills that run commands (`/project-c-check`, `/digest`, `/graph`…) will only re-prompt on **new** variants, not on commands already listed specifically.
Announce this cost to {USER_NAME}, then wait for explicit validation before writing. After writing, **validate the JSON** and confirm the rule count before/after.
---
## Step 3 — secret-guard.js coverage
### 3A — Bash patterns (`DANGER_PATTERNS`)
Read `~/.claude/hooks/secret-guard.js` → `DANGER_PATTERNS` array.
**Expected reference patterns** (at minimum):
- `.env` files (cat/less/more/head/tail)
- `.pem` / `.key` files
- SSH private keys (`id_rsa`, `id_ed25519`…)
- `.aws/credentials`
- `.docker/config`
- `printenv` (bare)
- `env` (bare)
- `export VAR_SECRET=literal`
- `Authorization: Bearer <token>`
- `--user user:pass`
- `git remote -v`
- `echo $VAR_SECRET`
- `history`
- `cat ~/.netrc`
List the reference patterns missing from the current file. Propose additions if missing — wait for validation before writing.
### 3B — file-tools coverage (Read/Edit/Write/Glob/Grep)
Since 2026-07-28, `secret-guard.js` no longer guards only `Bash`: a **`file-tools`** branch blocks with `deny` the **Read / Edit / Write / Glob / Grep** tools on sensitive paths. An audit that only checks 3A will therefore declare the hook compliant while **half its scope can be unplugged** without anything signalling it.
Check **both** sides, independently:
1. **The wiring** — ⚠️ **Resolve the *active* guard, never look for a hard-coded path.** The hook may be declared in `~/.claude/settings.json`, in `~/.claude/settings.local.json`, **or in a plugin's `hooks.json`** (e.g. `~/Dev/tmafr-clients/plugins/tmafr/hooks/hooks.json`) — and the migration of hooks to plugins is in progress, so the location moves.
The procedure: ① **enumerate all `PreToolUse`** entries in `settings.json`, `settings.local.json` *and* the `hooks.json` of loaded plugins; ② identify which one actually responds for file-tools; ③ **test it empirically in session** (attempt a read on a sensitive path and check for the `deny`) rather than concluding from the presence of a block.
An audit that looks for a block at a specific location produces a **false "CRITICAL" verdict** on a *hardened* setup — the worst of both error types: it cries fire where the guard has been strengthened, and it teaches you to ignore its own alerts.
*(Cause: 2026-08-31 — step 3 looked for a hard-coded path; `secret-guard.js` was active and proved it by blocking a command in session. `git-guard.js` remains the last hook declared hard-coded in `settings.json`, not migrated.)*
Once the guard is resolved, it must match `Read|Edit|Write|Glob|Grep`, **distinct** from the `Bash` block. If the block has disappeared → the hook's branch is dead, the code may be intact. If both matchers have been **merged** → flag that too: the separation is deliberate (a single matcher reintroduces a Node spawn on every Read/Grep, the most frequent calls).
2. **The paths** — the `file-tools` branch list must cover at minimum: `.env*`, `*.pem`, `*.key`, `id_rsa` / `id_ed25519`, `.aws/credentials`, `.docker/config`, `.netrc`. Verify that **wildcards are stripped before comparison** on the code side (`*.env*` → `.env`) — otherwise silent false negatives on any glob call.
⚠️ **Never conclude "file-tools covered ✅" based on the presence of the block alone.** A block present with an empty or stale list protects exactly as much as a missing block, and it reassures — which is worse. Apply here the general rule from Step 2B: look first for **what bypasses** the guard rather than checking its completeness in isolation (a broad `allow` in `settings.local.json` cancels out a perfect denylist).
---
## Step 4 — Supply chain scans
> **Convention**: external scanners stack as **sub-sections** of this step (4A, 4B…), never as new numbered steps — otherwise each addition renumbers the report and the tracker.
### 4A — Bumblebee (dependencies, extensions, MCP)
Pinned binary: `~/.claude/tools/bumblebee/bumblebee`, catalogs in `threat_intel/`, installed release recorded in `INSTALLED_RELEASE`.
**1. Freshness — before the scan, never after**
```bash
cat ~/.claude/tools/bumblebee/INSTALLED_RELEASE
```
> Shows the currently installed release.
```bash
curl -s https://api.github.com/repos/perplexityai/bumblebee/releases/latest | jq -r '.tag_name, .published_at'
```
> Fetches the latest published release and its date, for comparison.
- Installed release ≠ latest → propose the update (procedure below).
- Catalogs older than **30 days** → 🟠 flag it **in the report, next to the result**. A "0 findings" on stale catalogs is not a security verdict: it's a verdict on the known campaigns *as of the catalog date*. Staying silent about it means displaying a state that has survived its invalidation.
⚠️ **Never refresh the catalogs alone.** Those on `main` are at `schema_version 0.2.0`, the v0.1.2 binary only reads `0.1.0` → the scan exits with **exit 2** and does not run. Binary and catalogs are updated **together**, via the release.
**2. Scans**
```bash
cd ~/.claude/tools/bumblebee && ./bumblebee scan --profile baseline --exposure-catalog ./threat_intel --findings-only
```
> Scans the global roots (user packages, editor and browser extensions, Homebrew, MCP configs) against the known campaign catalogs. ~3 s.
```bash
cd ~/.claude/tools/bumblebee && ./bumblebee scan --profile project --root "$HOME/Dev" --exposure-catalog ./threat_intel --findings-only
```
> Same scan on the lockfiles of development repos. ~10 s.
Read-only by construction: no package manager execution (`npm ls`, `pip show`…), no install script triggered, no source file read.
**3. Reading the result**
| Output | Verdict |
|---|---|
| `findings=0` on both profiles | ✅ no exposure to the catalog's campaigns — **note the age of the catalog alongside** |
| `findings>0` | 🔴 read the `record_type=finding` records (`package_name`, `version`, `source_file`) — remediation goes into a dedicated ticket, it is not within the audit's scope |
| exit ≠ 0, empty output | ⚠️ **do not read as "clean"** — read stderr: incompatible catalog schema, missing root, timeout |
**Update (binary + catalogs, together)**
Download the release's `darwin_arm64` tarball and its `checksums.txt`, verify with `shasum -a 256 -c --ignore-missing checksums.txt`, then replace **`bumblebee` and `threat_intel/`** and update `INSTALLED_RELEASE`. Never install a binary whose checksum has not been verified — this is a supply chain tool.
**Known limitation — don't confuse it with coverage**
MCP servers are inventoried **without version** (32/33 on the 2026-08-04 run, `confidence: low`). Matching is done on the exact triplet `(ecosystem, normalized_name, version)`: a compromised MCP server **therefore cannot produce a finding** in v0.1. Bumblebee tells you *which* MCPs you have, not whether they are healthy. Real coverage applies to npm / PyPI / RubyGems / Composer / Go / Homebrew / editor and browser extensions — versioned, `confidence: high`.
`SKILL.md` files without a lockfile are not enumerated either (only 1 `agent-skill` surfaced out of 87) → scope of SkillSpector (**4B**, upcoming), no overlap between the two.
---
## Step 5 — Fetch security sources (optional, on request)
If {USER_NAME} asks "check the latest vulnerabilities" or "fetch the sources":
Sources to consult:
- Adversa AI blog (search "Claude Code security")
- Recent HN discussions on Claude Code (WebSearch "Claude Code security site:news.ycombinator.com")
Extract only actionable findings (new vulnerabilities, new patterns to block, new version bugs).
By default (without explicit request): **skip this step** — too slow for a routine audit.
---
## Step 6 — Create the Knowledge note
Create `{VAULT_PATH}\{KNOWLEDGE_FOLDER}\Claude code\security-audit-YYYY-MM-DD.md`:
```markdown
---
date: YYYY-MM-DD
type: Security Audit
claude_version: [version]
---
# Audit sécurité Claude Code — YYYY-MM-DD
## Version
- Installée : [version] ✅/🔴
- Minimale requise : 2.1.90
## Deny rules
[résumé : X/9 présentes — liste des manquantes ou "Toutes présentes"]
## Allows larges
[liste des allows larges trouvées dans settings.json + settings.local.json, ou "Aucune"]
[si suppression : compte de règles avant → après, + validation JSON]
## secret-guard.js
[résumé : X/14 patterns présents — liste des manquants ou "Tous présents"]
## Supply chain (Bumblebee 4A)
- Release : [vX.Y.Z] — dernière publiée : [vX.Y.Z]
- Catalogues : [N] campagnes, publiés le [YYYY-MM-DD] — **âge : [N] jours** [🟠 si > 30]
- baseline : [N] composants, **[N] findings**
- project (`~/Dev`) : [N] composants, **[N] findings**
- Non couvert : serveurs MCP (inventoriés sans version → non appariables), skills sans lockfile
## Actions appliquées
[liste des modifications faites ce run, ou "Aucune modification nécessaire"]
## À relancer
- Après chaque mise à jour majeure Claude Code
- Après tout incident sécurité
- Prochaine échéance : [date suggérée]
```
---
## Step 7 — Update the command-tracker
- Open `{VAULT_PATH}\{CLAUDE_CODE_FOLDER}\command-tracker.md`
- `/security-audit` line → replace the date with today's date (`YYYY-MM-DD`)
---
## Absolute rules
- Never modify `settings.json` or `secret-guard.js` without explicit validation from {USER_NAME}
- Always create the Knowledge note even if no modification is necessary (traceability)
- Recommended frequency: after each major Claude Code update, or at least monthly