Security-sensitive behavior must be enforced from trusted inputs and with validated permission logic; do not rely on mechanisms that an untrusted repository can change or that are known to be ineffective as access control.
Apply these rules:
1) Don’t treat “ignore/filter” files as security boundaries
2) Don’t rely on repo-provided hooks for enforcement
3) Validate tool permission inputs by shape
4) Use minimal, trust-aware allowlists for commands
5) Prevent committing sensitive cached configuration
Example patterns:
# ~/.cline/hooks/PreToolUse (example logic)
# Cancel run_commands unless it matches your allowlist.
# Read hook JSON from stdin, inspect tool_call.name + input shape, and exit/emit a cancel signal.
function approve(request: { toolName: string; input: unknown; }): { approved: boolean } { const input = request.input as RunCommandsInput; const allow = new Set([“ls”, “git status”]);
if (request.toolName !== “run_commands”) return { approved: false }; if (!Array.isArray(input.commands)) return { approved: false };
const ok = input.commands.every( (c) => typeof c === “string” && allow.has(c.trim()) ); return { approved: ok }; }
- Secret hygiene:
```gitignore
**/.cline/enterprise/
**/.cline/remote-config/