fix(hooks): prompt on every exec write, including flagged calls - #232
Draft
christiaan-ph wants to merge 3 commits into
Draft
christiaan-ph wants to merge 3 commits into
christiaan-ph wants to merge 3 commits into
Conversation
`call` accepts `--json`, `--confirm` and `--no-skills` before the tool name. The gate only skipped `--json`, so any other leading flag was read as the tool name and the call never prompted. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The gate decided whether a call was a write from a hardcoded verb regex, and the deny globs only applied to tools that regex matched. Tools such as `survey-stop`, `workflows-publish` and `opt-outs-add` never prompted, even with POSTHOG_MCP_EXEC_GATE_DENY="*". `hooks/write-tools.txt` lists every registry tool with readOnlyHint=false. A tool on that list is a write; the verb regex stays as the fallback when the list is missing or a tool is newer than the list. The skill sync workflow regenerates the list with scripts/generate-write-tools.sh. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
mcp__posthog__execand rely on the plugin's write gate get no approval prompt on many PostHog writes.POSTHOG_MCP_EXEC_GATE_DENY="*", documented as "prompt on every write",survey-stop,workflows-publish,cdp-functions-publish,opt-outs-addand 61 other unflagged write tools run silently. 15 of them carrydestructiveHint: true.call --confirm insight-delete {}andcall --no-skills insight-delete {}run silently, whilecall insight-delete {}prompts.DENYcould narrow that set but never widen it.--json, so any other leading flag was read as the tool name.Changes
hooks/write-tools.txtor its name carries a write verb.DENY="*"now covers every write.callwith leading flags (--json,--confirm,--no-skills, in any order) now prompts the same as the bare call.hooks/write-tools.txtlists the 457 registry tools withreadOnlyHint: false.scripts/generate-write-tools.shbuilds it fromservices/mcp/schema/tool-definitions-all.jsononPostHog/posthogmaster with curl and jq, and refuses to write a list under 100 entries.marketplace.json.Note
Default installs change only for flagged calls: no list-only tool matches the default deny globs. Users who set
POSTHOG_MCP_EXEC_GATE_DENYto a broad glob will see prompts on writes that ran silently before.How did you test this code?
./tests/test_gate_exec_write.shpasses under macOS/bin/bash3.2 as well as bash 5.3. CI covers Ubuntu only.call --confirm insight-delete {}prompts. Catches the parser regression.deny="*"now usessurvey-stop, a write with no regex verb, so it exercises the list path. The previous case usedexperiment-update, which the regex already matched, and passed without reaching the deny check.made-up-tool-deleteprompts, so the regex fallback survives the list.cdp-functions-publish,organization-enforce-2fa-execute,--no-skills insight-deleteand--json --confirm insight-deletethrough the hook withDENY="*": all prompt.insight-getand--json insight-getstay silent.🤖 Agent context
feature-flags-test-evaluation-createis read-only but has a write verb, andbatch-export-deleteis destructive but a read-verb list would pass it onexport.🤖 Generated with Claude Code