fix(git-guards): deny gh api/graphql top-level comment creation - #507
Merged
Merged
Conversation
DENY_GH blocks `gh pr comment` because top-level issue/PR comments cannot
be resolved or tracked, but the REST and GraphQL equivalents were not
covered: `gh api .../issues/{n}/comments -X POST` and a `gh api graphql`
addComment mutation both create the same unresolvable comment.
Add a DENY_GH_REGEX entry matching a POST (any flag order/spelling,
relative or absolute URL) to repos/{owner}/{repo}/issues/{n}/comments,
while leaving GET reads and the sanctioned pulls/{n}/comments and
pulls/comments/{id} review-thread endpoints untouched. Deny the GraphQL
addComment(input: ...) mutation outright in the existing graphql
inspection path, pointing at the same resolve-pr-threads workflows.
Assisted-by: Claude:claude-opus-5
Claude-Session: https://claude.ai/code/session_01DnTJjGY6C116W98Hsb9T5q
Merged
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.
What
Adds a
DENY_GH_REGEXentry and a GraphQL mutation check togit-permission-guard.py, extending the existinggh pr commentdeny to itsgh apiandgh api graphqlequivalents.Denied:
gh api ... -X POST ...repos/{owner}/{repo}/issues/{n}/comments, any flag order,--method/-Xspelling, relative or absolute URLgh api graphql ...addComment(input: ...)mutationUnaffected (still allowed): a GET of the same REST path, and the
pulls/{n}/comments/pulls/comments/{id}review-thread endpoints, which are the sanctioned path.Both denials point at the same resolve-pr-threads workflow docs the existing
pr commentmessage cites.Tests
🤖 Generated with Claude Code
https://claude.ai/code/session_01DnTJjGY6C116W98Hsb9T5q