Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
When a user-defined beforeReadFile hook (hooks.json) denies a file
read, Cursor still writes the full file content to its own local
debug log (%APPDATA%\Roaming\Cursor\logs\...\cursor.hooks.workspaceId-*.log,
Windows path) via the “content” field of the hook’s input payload —
before the hook’s decision is even applied.
This means that even a correctly-configured security hook that blocks
reading a sensitive file (e.g. a real .env with production secrets)
does not prevent the secret from being persisted in plaintext on disk,
in a log file outside the project directory, outside version control,
and with no documented retention/rotation policy.
Steps to Reproduce
- Configure a
beforeReadFilehook in~/.cursor/hooks.jsonthat
returns{"permission": "deny"}for any file matching.env
patterns. - In an Agent chat, ask the agent to read a real
.envfile (e.g.
containingKEY=some-real-secret-value). - Confirm the read is correctly denied in the chat/UI.
- Open Cursor Settings > Hooks (or the “Hooks” Output channel) and
inspect the log for thatbeforeReadFileinvocation. - Observe: the “content” field of the logged INPUT payload contains
the full, real file content — including the secret — in plaintext,
regardless of the hook’s “deny” decision.
Expected Behavior
One of:
- The “content” field should not be included in the persisted debug
log at all (only in the live payload passed to the hook process via
stdin), or - It should be redacted/truncated in the log by default, with an
explicit opt-in setting to show full content for debugging, or - There should be a documented setting to control retention (e.g.
auto-purge after N days) and/or verbosity of this specific log
channel, so users who intentionally deny a read are not left with
the same secret persisted elsewhere on disk.
Operating System
Windows 10/11
Version Information
- Cursor version: 3.14.7 (internal), DisplayVersion 3.21.16
- Hook type affected: beforeReadFile (native hooks.json)
Does this stop you from using Cursor
No - Cursor works, but with this issue