claudit-sec
CLAUDE.md298 starsChanged 9 months agoApache-2.0View on GitHub
CLAUDIT-SEC is a read-only, single-file security audit tool for macOS that inspects Claude Desktop and Claude Code configuration, scheduled tasks, extensions, plugins, skills, permissions, and runtime state. This project is built and maintained using Claude Code. This file provides architecture context and development guidelines that Claude Code uses when working on the codebase. The script follows this structure:
The file
We split this CLAUDE.md into the rules it gives an agent
9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 104
Associative array key iteration: Use ${(k)arr[@]} not ${!arr[@]}
- Very specific: line 106
Lowercase expansion: Use ${(L)var} not ${var,,}
- Very specific: line 108
Read into array: Use read -rA not read -ra
- Very specific: line 110
No
printf -v: Use var=$(printf ...) instead - Distinctive: line 114
When run as root (uid 0) — which is how MDMs like FleetDM, Jamf, Mosyle, and CrowdStrike RTR execute scripts — the script automatically …
- Distinctive: line 157
Read-only invariant: Never write to, modify, or delete any file being audited
- Distinctive: line 159
Sensitive data: Always redact tokens, keys, passwords, secrets in all output formats
- Distinctive: line 160
New collectors: Add to the script, update the collector table above
- Very specific: line 161
Testing: Run zsh claude_audit.sh --json and verify finding counts and section coverage
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDIT-SEC — Claude Security Audit Tool
Project Overview
CLAUDIT-SEC is a read-only, single-file security audit tool for macOS that inspects Claude Desktop and Claude Code configuration, scheduled tasks, extensions, plugins, skills, permissions, and runtime state.
claude_audit.sh— Zsh (~1900 lines, requiresjq) — designed for MDM/CrowdStrike RTR style deployment
This project is built and maintained using Claude Code. This file provides architecture context and development guidelines that Claude Code uses when working on the codebase.
Architecture
The script follows this structure:
- Preflight checks — OS validation, dependency checks
- User context detection — single user, explicit
--user, or all-users scan - Session directory discovery — finds
local-agent-mode-sessions/org/user/paths - 14 data collectors — each reads specific config files and populates findings
- Finding aggregation — counts by severity (WARN, INFO, REVIEW)
- 3 output renderers — ASCII (ANSI color + Unicode tables), HTML (dark theme), JSON (SIEM-ready)
Data Collectors
| Collector | Source Files | Key Findings |
| Desktop Settings | claude_desktop_config.json → preferences | keepAwakeEnabled, allowAllBrowserActions, menuBar, sidebar |
| Cowork Settings | cowork_settings.json, config.json | scheduledTasks, webSearch, networkMode |
| MCP Servers | claude_desktop_config.json → mcpServers | Server names, commands, env var keys |
| Plugins | installed_plugins.json, remote manifest, marketplace cache | installed/remote/cached plugins |
| Plugin Hooks | hooks/hooks.json in plugin directories | Shell commands on lifecycle events |
| Connectors | local_*.json → remoteMcpServersConfig, .mcp.json | web/desktop/not_connected, egressAllowedDomains, disabledMcpTools |
| Skills | User skills (6 paths), installed plugin skills (3 paths) — see Key Paths | SKILL.md frontmatter parsing |
| Scheduled Tasks | scheduled-tasks.json | Cron expressions with english translation |
| Extensions (DXT) | extensions-installations.json | Signature status, dangerous tools |
| Extension Settings | Claude Extensions Settings/*.json | Allowed directories |
| Blocklist | extensions-blocklist.json | Governance control presence |
| Claude Code Settings | ~/.claude/settings.json | Permission grants |
| Runtime | pgrep, pmset, crontab, LaunchAgents | Running processes, sleep assertions |
| Cookies | Cookies, Cookies-journal | Presence and permissions |
Key Paths
~/Library/Application Support/Claude/ # Claude Desktop dir
claude_desktop_config.json # Desktop prefs + MCP servers
config.json # App config (network mode, allowlists, device ID)
extensions-installations.json # DXT extensions
extensions-blocklist.json # Extension governance
Claude Extensions Settings/*.json # Per-extension settings
local-agent-mode-sessions/<org>/<user>/ # Session directories
cowork_settings.json # Cowork preferences
scheduled-tasks.json # Scheduled tasks
cowork_plugins/installed_plugins.json # Installed plugins
cowork_plugins/marketplaces/ # Marketplace catalog
cowork_plugins/cache/ # Downloaded plugin cache
remote_cowork_plugins/manifest.json # Org-deployed plugins
local_*.json # Session files with connector state
~/.claude/settings.json # Claude Code settings
~/.claude/skills/<skill>/SKILL.md # Claude Code user skills (manually uploaded)
~/.claude/plugins/marketplaces/<mp>/ # Claude Code marketplace plugin skills
plugins/<plugin>/skills/<skill>/SKILL.md
external_plugins/<plugin>/skills/<skill>/SKILL.md
~/Documents/Claude/Scheduled/<skill>/SKILL.md # Scheduled task skills
Skill scanning paths (collect_skills):
User skills (source: "user"):
~/Documents/Claude/Scheduled/*/SKILL.md # Scheduled tasks
skills-plugin/<uid>/<oid>/skills/*/SKILL.md # Cowork-created skills
~/.skills/skills/*/SKILL.md # Alt skills dir
~/.claude/skills/*/SKILL.md # Claude Code user skills
<session>/local_*/.claude/skills/*/SKILL.md # Session-local skills
Installed plugin skills (source: "plugin"):
<session>/remote_cowork_plugins/*/skills/*/SKILL.md # Org-deployed plugins
<session>/cowork_plugins/cache/<mp>/<plugin>/<ver>/skills/*/ # Cached (installed) plugins
~/.claude/plugins/marketplaces/<mp>/{plugins,external_plugins}/ # Claude Code marketplace
NOT scanned (marketplace catalog, not installed):
<session>/cowork_plugins/marketplaces/ # Full Cowork catalogShell Script (claude_audit.sh)
Zsh Compatibility
The shell script uses #!/bin/zsh for stock macOS compatibility (Apple ships bash 3.2 which lacks associative arrays). Key setopt flags:
| Option | Purpose |
KSH_ARRAYS | 0-based array indexing (bash-compatible) |
BASH_REMATCH | =~ populates BASH_REMATCH array |
TYPESET_SILENT | Prevents local re-declaration from printing values in loops |
NULL_GLOB | Unmatched globs expand to nothing (prevents NOMATCH errors) |
PIPE_FAIL | Pipeline returns rightmost non-zero exit code |
Zsh-Specific Gotchas
Do NOT use these variable names as locals — they are zsh special variables:
path(tied toPATH) — use_pathinsteadstatus(tied to$?) — useperm_statusor similarfpath(function autoload path) — avoid entirelymatch,MATCH,MBEGIN,MEND— regex related
Associative array key iteration: Use ${(k)arr[@]} not ${!arr[@]}
Lowercase expansion: Use ${(L)var} not ${var,,}
Read into array: Use read -rA not read -ra
No printf -v: Use var=$(printf ...) instead
MDM Deployment
When run as root (uid 0) — which is how MDMs like FleetDM, Jamf, Mosyle, and CrowdStrike RTR execute scripts — the script automatically scans all users with Claude data. No flags needed.
- As root (MDM): Auto-discovers users via
dscl, scans all with Claude directories - As user: Scans current user only
--user USERNAME: Scans specific user--all-users: Explicit all-users scan (requires sufficient permissions)
Output Formats
- Default (ASCII): ANSI-colored terminal output with Unicode box-drawing tables
--json: Single JSON object (or array for multi-user) for SIEM ingestion. Sensitive fields auto-redacted.--html [FILE]: Standalone dark-themed HTML report. Created with mode0600. Auto-named per user if scanning multiple users.-q/--quiet: Suppresses INFO-only sections, shows only WARN/CRITICAL findings
Security Properties
- Read-only — never modifies any audited files
- No eval — no dynamic code execution
- All variables quoted — no word-splitting or injection vectors
- Sensitive values redacted —
[REDACTED]in all output formats - MCP env vars — only key names emitted, never values
- MCP args — patterns matching
sk-,key=,token=,secret=,password=are redacted - HTML output — created with
umask 077(mode 0600) - Username validation —
^[a-zA-Z0-9._-]+$with explicit./..rejection
CLI Reference
Usage: claude_audit.sh [OPTIONS]
Options:
--html [FILE] HTML report (auto-named if no FILE given)
--json JSON output for SIEM ingestion
--user USER Scan specific user
--all-users Scan all users with Claude data
-q, --quiet Only show WARN/CRITICAL findings
--version Print version and exit
-h, --help Show usageDevelopment Guidelines
- Single-file constraint: The script must remain a self-contained single file with no external dependencies (except
jq) - Read-only invariant: Never write to, modify, or delete any file being audited
- Findings format:
severity(WARN/INFO/REVIEW),section,message,detail - Sensitive data: Always redact tokens, keys, passwords, secrets in all output formats
- New collectors: Add to the script, update the collector table above
- Testing: Run
zsh claude_audit.sh --jsonand verify finding counts and section coverage
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

