Claude Code hook

Secguard

3-level security toolkit for AI agents: regex patterns, heuristic rules, ML classification. Claude Code hooks, git pre-commit, CI/CD scanner.

61 stars 5 forksHooks Source

Install

Install
cargo install --path crates/secguard-cli

Found in the project README. Check it for setup steps after installing.

From source
git clone https://github.com/random1st/secguard.git

From the README

⚠️ Synced from Diana monolith — do not edit here. Canonical sources live at https://github.com/random1st/diana under rust/crates/diana-{guard,secrets,secguard-brain}/. Published via tools/release-secguard.sh from the monolith. PRs against this repo for code changes will be redirected upstream.
Active hardening: RAN-411 secguard v2.
secguard

3-level security guard for AI coding agents. Catches leaked credentials and blocks destructive shell commands before they execute.

Built for Claude Code, Gemini CLI, and Codex workflows. Also works anywhere: CI pipelines, git pre-commit, standalone CLI.

What it does

Two guards, three levels of detection each.

Secrets scanning. Catches credentials before they leak into logs, tool output, or cloud APIs. 150+ regex patterns: AWS access keys (AKIA*), Stripe (sk_live_*, pk_live_*), GitHub PATs (ghp_*, github_pat_*), Anthropic/OpenAI API keys, Slack tokens, JWTs, private key blocks, database connection strings (postgres, mysql, mongodb, redis), SendGrid, Twilio, npm/PyPI tokens, generic password=/secret= assignments. Keyword pre-filter skips regex when no relevant substring exists (fast on large inputs). High-entropy token detection (Shannon entropy >= 3.5 bits/char, 16+ chars) picks up things regex misses. Optional ML classifier as final pass.

Destructive command guard. Blocks commands that delete data, rewrite history, or bypass safety checks. Three phases run in order; first match wins:

*Phase 0: Policy allowlist.* Some operations are always safe. Configured process cleanup (pkill/killall targets from safe_kill_targets), git push without --force, and read-only kubectl (get, describe, logs) can pass here. Compound commands (&&, ||, ;, |) are split and every part must pass independently.

*Phase 1: Heuristic rules.* 40+ patterns,…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
Rust
Last updated
10 October 2026

FAQ

What is Secguard?

3-level security toolkit for AI agents: regex patterns, heuristic rules, ML classification. Claude Code hooks, git pre-commit, CI/CD scanner. It is a hook for Claude Code, from random1st/secguard on GitHub.

How do I install Secguard?

Run cargo install --path crates/secguard-cli, then follow the setup in the README.

Is Secguard popular?

random1st/secguard has 61 GitHub stars and 5 forks. It was last updated on 10 October 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.