Commit Graph

12 Commits

Author SHA1 Message Date
Dani a9c36fc852 feat: add 3 subagent hooks components (security theme)
- hooks/security/ai-bash-guard: PreToolUse with type:agent — AI-powered bash security guard using haiku subagent
- settings/hooks/subagent-lifecycle-logger: SubagentStart/SubagentStop audit trail to .claude/agent-log.jsonl
- agents/security/read-only-auditor: security auditor with frontmatter hooks blocking Write/Edit/Bash while active
2026-05-08 20:27:16 -04:00
yurukusa aa977104c9 fix: address P1 review issues from cubic-dev-ai
1. Python one-liner: detect version-suffixed executables (python3.11, python3.12)
   Pattern: python[23]? → python[23]?(\.[0-9]+)?
2. Pipe-to-shell: detect shell invocations with arguments (| sh -s, | bash -c)
   Pattern: \|\s*(sh|bash|zsh)\s*$ → (\s|$)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 20:44:36 +09:00
yurukusa 5299c0c18d Add shell-wrapper-guard hook to security category
Detects destructive commands hidden in shell wrappers (sh -c, bash -c,
python3 -c, node -e, etc). Complements dangerous-command-blocker by
catching 8 bypass vectors that evade direct command checks.
From cc-safe-setup (667 hooks, 9,200+ tests, 800hrs autonomous operation).
https://github.com/yurukusa/cc-safe-setup
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 17:45:08 +09:00
Dani 36fa6dbd5d feat: Add supply-chain-guard skill, worktree commands, security hooks, and updated catalog
New components:
- supply-chain-guard skill (security): npm/PyPI/CI supply chain scanner with IOC database
- worktree-guide skill: parallel development with git worktrees
- dependabot-review skill: automated Dependabot PR management
- worktree-check/cleanup/deliver/init commands (git-workflow)
- edit-audit-log hook (development-tools)
- env-file-protection and force-push-blocker hooks (security)

Also includes:
- Regenerated components.json catalog (docs + dashboard)
- TinyFish featured page updates and logo
- .vercelignore and dashboard .gitignore updates
2026-03-31 21:13:20 -04:00
Moiri Gamboni a0b4da050c fix: dangerous-command-blocker hook references wrong script path (#367)
The installer (`installIndividualHook` in index.js) places companion
Python scripts in `.claude/hooks/`, but the hook config referenced
`.claude/scripts/`. This meant the hook would always fail with a
"file not found" error at runtime, silently rendering it non-functional.

Also removed the `2>&1` stderr redirect which masked the error by
merging stderr into stdout, causing the hook runner to report the
unhelpful "No stderr output" message instead of the actual cause.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:17:44 -08:00
Dani d3ce23847f feat: improve secret-scanner hook with stdin JSON parsing
- Update description to list 30+ supported providers
- Simplify hook command by removing git commit grep filter
- Parse Claude Code JSON input from stdin to detect git commit
- Handle git commit -a and chained git add && git commit scenarios

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 20:21:52 -05:00
Dani b5c377ae6c feat: expand secret scanner patterns and add skills support
- Add 25+ new secret detection patterns to secret-scanner.py (Anthropic,
  Google OAuth, GitLab, Vercel, Supabase, Hugging Face, Replicate, Groq,
  Databricks, Azure, Cloudflare, DigitalOcean, Linear, Notion, Figma,
  npm, PyPI tokens)
- Fix regex escaping in security-scanner.json (single quote matching)
- Add skills component type to Discord bot interactions
- Add Linear MCP server to .mcp.json
- Update .gitignore for opsx commands, skills, and openspec dirs
- Regenerate components.json catalog

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-28 19:13:48 -05:00
Daniel Avila 2f667130ad feat: Add secret-scanner hook for detecting hardcoded credentials (#304)
Added new security hook that automatically scans staged files before git commits to detect:
- API keys (AWS, OpenAI, Stripe, Google, GitHub, SendGrid, Twilio, Mailgun)
- Authentication tokens and passwords
- Private keys (RSA, SSH, OpenSSH)
- Database connection strings (MySQL, PostgreSQL, MongoDB, SQL Server)
- JWT tokens, Slack tokens, Telegram bot tokens, Discord webhooks

Features:
- Multi-pattern regex detection with severity levels (critical, high, medium, low)
- Excludes false positives from comments with "example" or "placeholder"
- Skips binary files, lock files, and excluded directories
- Provides clear error messages with fix suggestions
- Suggests environment variables and secrets management services

Files:
- cli-tool/components/hooks/security/secret-scanner.json
- cli-tool/components/hooks/security/secret-scanner.py

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-24 18:07:22 -05:00
Daniel Avila ceb3a9e40c feat(hooks): enhance dangerous-command-blocker with multi-level security (#281)
Enhanced the dangerous-command-blocker hook with comprehensive protection:

## Features:
- **3-Level Security System:**
  - Level 1: Block catastrophic commands (rm -rf /, dd, mkfs, fork bombs)
  - Level 2: Protect critical paths (.claude/, .git/, node_modules/, .env, etc.)
  - Level 3: Warn about suspicious patterns (wildcards, chained commands)

- **Python Script Architecture:**
  - Moved from inline Python to dedicated script for better maintainability
  - Script auto-installed to .claude/scripts/dangerous-command-blocker.py
  - Clear regex patterns and detailed error messages

- **Protected Resources:**
  - Claude Code configuration (.claude/)
  - Git repository (.git/)
  - Node.js dependencies (node_modules/, package.json, package-lock.json)
  - Environment files (.env, .env.local, etc.)
  - Language manifests (Cargo.toml, go.mod, requirements.txt, Gemfile, composer.json)

## Testing:
- 16/16 test cases passing (100%)
- Blocks catastrophic operations
- Protects critical project files
- Warns on suspicious patterns
- Allows safe operations

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-17 23:10:35 -05:00
Daniel Avila 5d4f4f1ac0 feat(hooks): add dangerous-command-blocker security hook (#279)
Add new security hook to prevent accidental execution of dangerous shell
commands like rm -rf, dd, mkfs, and other destructive operations.

Features:
- Blocks rm with dangerous flags (recursive, force) on critical paths
- Detects wildcards and system directory targets (/, ~, *)
- Prevents disk operations (dd, mkfs, format)
- Blocks fork bombs and direct disk device access
- Provides clear safety guidelines in error messages
- Allows safe operations (e.g., rm -rf /tmp/specific-folder)

Reviewed by component-reviewer agent.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-17 22:37:14 -05:00
daniel c98ce4ec6e 🔧 Fix hook JSON structure for Claude Code compatibility
- Update all 14 hooks to use proper Claude Code array/matcher format
- Fix CLI merge logic to handle new hook structure correctly
- Add support for both old and new hook formats during migration
- Remove conflict detection for hooks (Claude Code arrays support multiple entries)
- Ensure hooks follow proper structure:
  {
    "hooks": {
      "EventName": [
        {
          "matcher": "ToolPattern",
          "hooks": [
            {"type": "command", "command": "bash-command"}
          ]
        }
      ]
    }
  }

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 07:52:08 -04:00
daniel bea1cd00d4 🪝 Reorganize hooks into thematic categories
- Restructure hooks to match component categories (development-tools, git-workflow, testing, automation, security, performance)
- Create 14 new hooks organized by practical use cases:
  • Development tools: command logging, file backup, change tracking, formatting, linting
  • Git workflow: auto-staging, smart commits
  • Testing: automated test running
  • Automation: build triggers, notifications, dependency checking
  • Security: file protection, vulnerability scanning
  • Performance: system monitoring
- Update components.json with new hook structure
- Improve frontend filter consistency across all component types

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 22:51:15 -04:00