Skip to content

User-installed hook gate does not hold - a pre-execution security hook is bypassed, disarmed by repo-scoped config, or fails open

coding-agent-hook-gate-integrity is a high severity check in the ai category, written in shell. Its source is templates/ai/coding-agent/coding-agent-hook-gate-integrity.sh in cert-x-gen-templates.

Treats a coding agent’s pre-execution hook (PreToolUse / PermissionRequest / beforeShellExecution / beforeMCPExecution) as a security control that must hold, and drives the host through four arms plus an ungated control. Arm 0 (control, no hook) must achieve the gated action, or nothing that follows is attributable. Arm 1 installs a user-scope DENY-ALL hook: the action must be blocked. Arm 2 leaves that hook installed and plants a repo-scoped settings file redefining hooks.PreToolUse with an allow-all entry: a repository must not be able to disarm the operator’s own control. Arms 3 and 4 make the hook exit non-zero and hang past the host’s timeout: a gate that did not answer must fail CLOSED. Every arm is judged by a nonce marker this template planted the path for and reads itself, never by the host’s ledger. CONFIRMED when any gated arm produces the marker (bypass, repo override, or fail-open). REFUTED when all four block and the control arm achieved. SKIP on Windows, when the host ships no hook gate, or when the ungated control achieves nothing.

Field Value
Id coding-agent-hook-gate-integrity
Severity high
Language shell
Category ai
Author CERT-X-GEN Security Team
Template version not recorded
Confidence 90
CVSS not recorded
Weakness CWE-693
Tags ai, coding-agent, cli, agent-posture, hooks, security-control, fail-open, bypass, policy-enforcement, cwe-693, cwe-754, cwe-1188
Target kind cli
Oracle property

Declared in the header. cxg parses @references and then discards it, and nothing at scan time reads it, so this is the only place the links a template cites are surfaced.

To see what the copy on your machine says about itself, and to confirm it is installed at all:

Terminal window
cxg template info coding-agent-hook-gate-integrity

The id it prints is the one to pass anywhere a template is selected. See cxg template for the rest of the subcommand, Scan a target for running a scan, and A match is not a finding for how to read what comes back.