Skip to content

fix(git-guards): deny gh api/graphql top-level comment creation - #507

Merged
openbao-service-broker[bot] merged 1 commit into
mainfrom
fix/gh-comment-api-bypass
Sep 15, 2026
Merged

openbao-service-broker[bot] merged 1 commit into
mainfrom
fix/gh-comment-api-bypass

Conversation

@openbao-service-broker

Copy link
Copy Markdown
Contributor

What

Adds a DENY_GH_REGEX entry and a GraphQL mutation check to git-permission-guard.py, extending the existing gh pr comment deny to its gh api and gh api graphql equivalents.

Denied:

Form Matches
gh api ... -X POST ... repos/{owner}/{repo}/issues/{n}/comments, any flag order, --method/-X spelling, relative or absolute URL
gh api graphql ... an addComment(input: ...) mutation

Unaffected (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 comment message cites.

Tests

test_commit_trailer_guard.py rc=0 (13 checks)
test_gh_guard.py             rc=0 (33 checks)
test_graphql_guidance.py     rc=0 (11 checks)
test_hook.py                 rc=0 (12 checks)
test_main_branch_guard.py    rc=0 (6 checks)
test_permission_guard.py     rc=0 (86 checks)
test_shlex_valueerror.py     rc=0 (4 checks)

🤖 Generated with Claude Code

https://claude.ai/code/session_01DnTJjGY6C116W98Hsb9T5q

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
@openbao-service-broker
openbao-service-broker Bot merged commit 7e9aa6f into main Sep 15, 2026
32 checks passed
@openbao-service-broker
openbao-service-broker Bot deleted the fix/gh-comment-api-bypass branch September 15, 2026 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant