Docs / Security mechanisms & rules
Three layers, all deterministic
Rule packs evaluate a single tool call. Hooks decide when each rule pack (and every token-saving advisor) runs in the Claude Code lifecycle. The MCP scan pipeline, built but not running as a hosted service, evaluates a server before you add it. None of the three is a model call — same input, same verdict, every time, which is what makes a false-positive override and an audit trail both possible.
Rule packs (8)
Every rule id is <prefix>.<name>. Full illustrative examples live on the
rule reference page; this table adds
the source module each pack actually runs from.
-
Secrets rules::secretsAPI keys, tokens, credentials — matched by real provider formats, not a generic 32-char-string guess.
-
PII rules::piiEmails, phone numbers, national IDs, payment cards — cards checked with a real Luhn digit, not just length.
-
Entropy rules::entropyHigh-randomness strings that don't match a known credential format but still look secret-shaped.
-
Dangerous commands rules::dangerous_commandsDestructive/irreversible shell commands: recursive deletes, force-pushes, disk operations.
-
Injection rules::injectionContent shaped like an attempt to override the running agent's own instructions.
-
Package check rules::package_checkTyposquat and known-malicious-package patterns in a dependency addition.
-
Malicious URLs rules::malicious_urlKnown-bad and structurally suspicious URLs a tool call is about to fetch or write.
-
Input anomaly rules::input_anomalyStructurally unusual tool-call input — a lighter-weight signal than the pattern-matched packs above.
Enforcement points: hooks
Rule packs need somewhere to run: the engine's hooks, each wired to a Claude Code lifecycle event. On a fresh
install 9 security guards run there, out of 23 mechanisms in all;
every other security guard, including the PII, malicious-URL and input-anomaly rule packs above, waits behind
security.experimental. See
Hooks for the lifecycle events and
the default-on list.
Before it's even added: MCP Scan & Verify
A separate pipeline, the MCP scan service, evaluates an MCP server itself, not a tool call it makes. It exists in the codebase but no hosted scan runs it, so it is not something you can use today: MCP Scan & Verify is not available.
- Static analysis Tool-description/metadata analysis for prompt-injection and tool-poisoning shape, plus AST-based source SAST.
- Fingerprint & provenance Deterministic RFC 8785 JCS + SHA-256 version fingerprint, release-integrity/code-signing checks.
- Dependency & secrets CVE/reachability/SBOM, license compliance, and secrets-in-source static scanning.
- Behavioral & data-flow Toxic-flow/exfiltration-risk analysis; sandboxed dynamic testing doesn't exist yet — see Limitations.
Shadow mode vs. enforce
Every rule and every hook has two states: shadow (logs a would-be verdict, never blocks) and enforce (can
actually deny or ask). New installs start entirely in shadow mode. The
rules browser shows both states
per rule, and pinkyai profile switches between coarse strict/standard/relaxed baselines.
Next: Token savings →