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.
Install
cargo install --path crates/secguard-cliFound in the project README. Check it for setup steps after installing.
git clone https://github.com/random1st/secguard.gitFrom 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,…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.
Details
- Repository
- random1st/secguard
- 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
c0ntextKeeper
61Capnjbrown/c0ntextKeeper
Automatic context preservation for Claude Code. Never lose work to compaction again. 7 hooks, 187 semantic patterns, 3 MCP tools.
Claude Hooks
41gabriel-dehan/claude_hooks
A Ruby DSL for creating Claude Code hooks
Claude Leverage
68Filip-Podstavec/claude-leverage
Make any repo AI-first - write sustainable code from the start, or refactor a legacy codebase to prepare it for agent-driven development.Building blocks for Claude Code: subagents, slash commands, hooks, and workflow patterns. Copy what you need. A working developer's stack for Claude Code.
AI Helpers
39opendatahub-io/ai-helpers
AI Helpers — collections of Skills, Hooks, Agents (compatible with Claude Code, Cursor and other tools) and Gemini Gems
Evc
59SaigonXIII/evc
The open-source marketing agent workspace for Claude Code. 42 commands, 12 hooks, 4 industry starters.
Bad Daves Robot Army
61dgriffith/bad-daves-robot-army
Repository for Claude Code artifacts, including subagents, slash commands, and hooks
Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.