protect-secrets

A security add-on for Claude Code that checks file access, edits, writes, and shell commands for exposed secrets such as API keys and credentials.

In plain words
What is it for?
Use it to guard environment files, SSH keys, cloud credentials, keystores, and commands that print or upload secret data.
Why use it?
It can block or ask for confirmation before an agent reads or sends sensitive files and values.

Plugin for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Claude Code
/plugin marketplace add karanb192/claude-code-hooks
agentmods
npx agentmods add plugins/karanb192/claude-code-hooks/protect-secrets
Clone the repo
git clone --depth 1 https://github.com/karanb192/claude-code-hooks

Made for: Claude Code.

Per session not measured What this adds to a session before it is invoked.
When invoked not measured Not applicable: nothing here is loaded into a session.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Security

Grade A, and why

protect-secrets scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

"description": "A secrets firewall for Claude Code. A PreToolUse hook screens every Read, Edit, Write, and Bash call against tiered patterns (critical/high/strict): sensitive files like .env, SSH keys, AWS/kube/gcloud/do
plugins/protect-secrets/.claude-plugin/plugin.json · 21 lines

What it actually says

{
  "name": "protect-secrets",
  "description": "A secrets firewall for Claude Code. A PreToolUse hook screens every Read, Edit, Write, and Bash call against tiered patterns (critical/high/strict): sensitive files like .env, SSH keys, AWS/kube/gcloud/docker credentials, and keystores, plus shell commands that expose or exfiltrate them (cat .env, printenv, echo $SECRET_KEY, curl/scp/rsync uploads). Matches are denied, or turned into a prompt via per-level ask mode, with the exact pattern id and reason; .env.example-style templates stay allowed. Safety level is tunable via HOOK_SAFETY_LEVEL, no file edits needed.",
  "version": "1.0.0",
  "author": {
    "name": "Karan Bansal",
    "url": "https://github.com/karanb192"
  },
  "homepage": "https://github.com/karanb192/claude-code-hooks",
  "license": "MIT",
  "keywords": [
    "claude-code",
    "hooks",
    "security",
    "secrets",
    "credentials",
    "guardrails",
    "pretooluse"
  ]
}
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 21 lines scan A e35554687cfb

Subscribe to this mod's changes

protect-secrets is a plugin published in the GitHub repository karanb192/claude-code-hooks (494 stars, last pushed 9d ago), licensed MIT. Its token cost is not measured: this kind of file is read by the harness, not the model. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.