cx-hook-deny

cx-hook-deny is a cursor rule for coding agents from Checkmarx/cx-agentic-ai. It costs 2,337 tokens per session, scanned A, original, Apache-2.0.

A rule for handling a denied tool call from a Checkmarx security hook. A hook is an automated check that can stop an action and return instructions for what must happen next.

In plain words
What is it for?
Interpreting Checkmarx deny messages from writes, shell commands, MCP calls, or stop hooks, and following their required instructions.
Why use it?
It prevents the agent from bypassing a security block or retrying an unsafe change without following the reported remediation steps.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/checkmarx/cx-agentic-ai/cx-hook-deny
Clone the repo
git clone --depth 1 https://github.com/Checkmarx/cx-agentic-ai

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cx-hook-deny

README.md
[![agentmods](https://agentmods.dev/badge/rules/checkmarx/cx-agentic-ai/cx-hook-deny.svg)](https://agentmods.dev/rules/checkmarx/cx-agentic-ai/cx-hook-deny)
Your own site
<a href="https://agentmods.dev/rules/checkmarx/cx-agentic-ai/cx-hook-deny"><img src="https://agentmods.dev/badge/rules/checkmarx/cx-agentic-ai/cx-hook-deny.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,337 This file is loaded in full into every session.
When invoked 2,337 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02337 $0.02337
Opus 5 $0.01169 $0.01169
Sonnet 5 $0.00467 $0.00467
Haiku 4.5 $0.00234 $0.00234

Measured 5d ago against content hash c38c4f817c58, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

cx-hook-deny scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/cursor-devassist/rules/cx-hook-deny.mdc · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Checkmarx Hook Deny Compliance

When any Checkmarx security hook returns a deny"permission": "deny", "permissionDecision": "deny", or equivalent — the agent_message field is the sole authoritative instruction set for what you do next.

This rule applies on every Cursor session where the cx-devassist-cursor plugin is installed.

How to recognize a hook deny (mandatory parsing)

A hook deny may arrive in any of these shapes. All of them require the same response:

Signal Where it appears What to treat as agent_message
Structured JSON Hook stdout The agent_message field verbatim
Tool block error Write/StrReplace/Shell/MCP failure Text after CHECKMARX_HOOK_DENY — MANDATORY agent_message
ASCA block Tool block error Everything from CHECKMARX_HOOK_DENY through remediation steps (includes findings + instructions)
Findings-only block ASCA security scan detected vulnerabilities + Findings: The full block is the deny; remediation steps follow the findings list
Stop hook Session end followup_message — same authority as agent_message for remediation

If you see CHECKMARX_HOOK_DENY anywhere in a tool error, that entire message (from that marker onward) IS the agent_message. Follow it exactly.

If you see Agent note: Do not suggest workarounds to the blocked tool — that is a constraint, NOT the full instruction set. The remediation steps above or below it ARE the instruction set.

Mandatory behavior (never skip)

  1. STOP immediately. Do not continue unrelated work.
  2. Read agent_message first (see parsing table above). It contains the precise recovery steps, commands, and constraints.
  3. Do not substitute your own plan. Do not infer shortcuts, skip steps, or pick a different approach because user_message is shorter or the user's original request seems more important.
  4. Treat user_message as developer-facing only. It summarizes why the action was blocked; it is not a replacement for agent_message.
  5. Run commands from agent_message verbatim when they appear there (bootstrap install/upgrade, cx auth/cx configure, cx ignore-vulnerability, MCP calls). Do not rewrite paths with ${CURSOR_PLUGIN_ROOT} — that variable is empty in the agent shell.
    • When a command is listed per shell (PowerShell: / bash / sh: / cmd.exe: under "Run the line for YOUR shell"), pick the line matching your shell and run that line unchanged. Do not translate a line into another shell's syntax, and do not merge lines. All listed forms are allowed by the gate, so a correct copy is never blocked.
    • When agent_message lists more than one ignore-vulnerability command (multiple findings), run each one as its OWN separate Shell tool call — never join two or more with ;, &&, or || on one line. This matters most on PowerShell with --%: --% makes PowerShell stop parsing for the rest of that entire line, so a ; after it is not treated as a statement separator — it and everything after it (including a second & "cx.exe" --% ... invocation) get swallowed as literal trailing arguments of the FIRST command. Only one process ever runs; cx's own argument parser then chokes on the second command's stray --% token and reports unknown flag: --%, and the second finding is never actually suppressed. The gate's carve-out for this command does not catch it either, since it deliberately never inspects anything after --% (that region isn't shell-executable, so it isn't a security concern — but it also means the gate can't warn you here). One ignore-vulnerability call per Shell tool call, always.
    • A quoted absolute path needs PowerShell's & call operator to execute at all; without it PowerShell just prints the path. Syntax table: skills/cx-cli-setup/references/shells.md.
    • A cx ignore-vulnerability --data <json> command on PowerShell should use --% stop-parsing (preferred form in skills/cx-cli-setup/references/shells.md) — but --% only stops PowerShell from reparsing the remainder; it still reaches cx.exe's own Windows argv parser, which only keeps an embedded " when it's backslash-escaped inside one outer quoted region (--data "{\"FileName\":...}"). A bare, unquoted JSON value gets every " stripped by that parser and sends cx invalid JSON — always wrap it, even under --%. On cmd/bash, double-quote the JSON value and escape every inner " (doubled for cmd, backslash-escaped for bash/sh) — never single-quote it. Cursor's own command-execution layer can reformat a single-quoted argument into a double-quoted one before the real shell runs it, which strips the embedded " around the JSON keys and sends cx invalid JSON. See skills/cx-cli-setup/references/shells.md ("JSON arguments") for the exact per-shell forms.
    • If a command from agent_message still fails, do not improvise an alternate escaping or wrapping — do not backtick-escape it, do not re-wrap it in bash -c '...' or cmd /c "...", and do not retry it with a different quoting style you invent yourself. Those forms are more likely to be blocked by the security gate (its wrapper/chaining checks specifically scrutinize bash -c/cmd /c/backtick-laden commands) than to fix a quoting problem. Stop and report the exact failure to the user instead.
  6. Do not bypass the gate. Do not hand-place cx binaries, edit PATH, clear caches, use shell echo/redirect to write blocked files, use shell ! prefix tricks, or retry the same blocked tool call hoping it will pass.
  7. Do not deliver blocked content as a workaround. Never paste the blocked code in chat, suggest manual file creation, or tell the user to copy-paste what the hook rejected.
  8. Wait for explicit developer direction before writing intentionally vulnerable code that the scanner blocked — the hook deny overrides the original user request until resolved. "The developer originally asked for this vulnerability" is a reason to ask them whether to suppress it, never a reason to suppress it for them without asking.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 80 lines · 2,337 tokens per session scan A c38c4f817c58

Subscribe to this mod's changes

cx-hook-deny is a cursor rule published in the GitHub repository Checkmarx/cx-agentic-ai (0 stars, last pushed 2d ago), licensed Apache-2.0. It adds 2,337 tokens to every session, about $0.0117 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.