Event Hooks
Community

gatekeeper

2 events · 2 hooks

Install
1
Install the plugin
$
npx claudepluginhub pleaseai/claude-code-plugins --plugin gatekeeper

Want just this hook?

Then install: npx claudepluginhub u/[userId]/[slug]

Risk Indicators
Executes bash commands
Source

Defined in hooks/hooks.json

Configuration
{
  "PreToolUse": [
    {
      "hooks": [
        {
          "type": "command",
          "command": "node ${CLAUDE_PLUGIN_ROOT}/dist/pre-tool-use.js",
          "timeout": 5
        }
      ],
      "matcher": "Bash"
    }
  ],
  "PermissionRequest": [
    {
      "hooks": [
        {
          "type": "agent",
          "model": "sonnet",
          "prompt": "You are a security analyst. This command was NOT matched by pattern-based rules (Layer 1) and needs your judgment.\n\nCommand context:\n$ARGUMENTS\n\nCheck for these attack patterns:\n1. Data destruction (rm -rf /, truncate, dd if=/dev/zero, etc.)\n2. System modification (chmod 777, chown, modifying /etc/, etc.)\n3. Network attacks (curl piping to bash, wget suspicious scripts, reverse shells)\n4. Credential exposure (cat .env, echo $API_KEY, etc.)\n5. Supply chain attacks (npm install from suspicious sources, pip install --extra-index-url)\n6. Privilege escalation (sudo without clear purpose, setuid)\n7. Command chaining hiding destructive intent — analyze ALL parts of chained commands (;, &&, ||, |, $(), backticks), not just the first\n\nScope guidance:\n- Project-scoped operations (./build, ./dist, node_modules) are generally safe\n- System-scoped operations (/etc, /usr, ~/) require careful scrutiny\n- Standard dev tools (docker run, curl localhost, ssh) are generally safe unless combined with attack patterns above\n\nYou have access to Read, Grep, Glob tools. Use them if:\n- The command references a script file (verify its contents)\n- The command uses variables that might be dangerous\n- You need to check if a path exists and what it contains\n\nAfter your analysis, respond with ONLY one of:\n{\"ok\": true}\n{\"ok\": false, \"reason\": \"Brief explanation of the specific risk\"}",
          "timeout": 30
        }
      ],
      "matcher": "Bash"
    }
  ]
}
Summary
{
  "riskFlags": {
    "touchesBash": true,
    "matchAllTools": false,
    "touchesFileWrites": false
  },
  "typeStats": {
    "agent": 1,
    "command": 1
  },
  "eventStats": {
    "PreToolUse": 1,
    "PermissionRequest": 1
  },
  "originCounts": {
    "absolutePaths": 0,
    "pluginScripts": 1,
    "projectScripts": 0
  },
  "timeoutStats": {
    "commandsWithoutTimeout": 0
  }
}
Stats
Stars5
Forks1
Last CommitFeb 24, 2026

Similar Hooks