Skip to content

fix(guard): classify discussion_comment_write; add list_repository_collaborators DIFC rules#5818

Merged
lpcox merged 6 commits into
mainfrom
copilot/guard-coverage-fix-missing-tool
May 16, 2026
Merged

fix(guard): classify discussion_comment_write; add list_repository_collaborators DIFC rules#5818
lpcox merged 6 commits into
mainfrom
copilot/guard-coverage-fix-missing-tool

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 16, 2026

The upstream github-mcp-server added discussion_comment_write without a corresponding entry in the guard, allowing agents to create/edit Discussion comments without triggering DIFC write-path checks. list_repository_collaborators also lacked an explicit label rule despite returning access-sensitive data.

tools.rs

  • Add discussion_comment_write to WRITE_OPERATIONS — closes the guard coverage gap

tool_rules.rs — two new match arms

  • discussion_comment_write: S=S(repo), I=writer — mirrors issue_write / add_issue_comment since it produces repo-scoped, agent-authored content
  • list_repository_collaborators: S=S(repo), I=reader — uses reader-level integrity (one level below writer) because the response reveals who holds write/admin access, making it access-sensitive relative to other repo metadata reads

…_collaborators DIFC rules

- Add `discussion_comment_write` to WRITE_OPERATIONS in tools.rs so
  agents cannot create/edit Discussion comments without triggering
  DIFC write-path checks (fixes the guard coverage gap reported in the issue).

- Add a dedicated match arm for `discussion_comment_write` in
  tool_rules.rs: S=S(repo), I=writer — mirrors issue_write / add_issue_comment.

- Add a match arm for `list_repository_collaborators` in tool_rules.rs:
  S=S(repo), I=reader — conservatively lower integrity because the
  response reveals who holds write/admin access to the repository.

- Add unit tests for both new rules in tools.rs and tool_rules.rs.
Copilot AI changed the title [WIP] Add missing discussion_comment_write operation to guard coverage fix(guard): classify discussion_comment_write; add list_repository_collaborators DIFC rules May 16, 2026
Copilot finished work on behalf of lpcox May 16, 2026 16:45
Copilot AI requested a review from lpcox May 16, 2026 16:45
@lpcox lpcox marked this pull request as ready for review May 16, 2026 16:52
Copilot AI review requested due to automatic review settings May 16, 2026 16:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR closes DIFC guard coverage gaps for new/previously-unlabeled GitHub MCP tools by (1) classifying a new discussion comment mutation tool as write-capable and (2) adding explicit DIFC label rules for collaborator listing and discussion comment writes.

Changes:

  • Add discussion_comment_write to WRITE_OPERATIONS and test that it’s treated as a write (not read-write).
  • Add apply_tool_labels match arms for discussion_comment_write and list_repository_collaborators.
  • Add unit tests for both new apply_tool_labels rules.
Show a summary per file
File Description
guards/github-guard/rust-guard/src/tools.rs Classifies discussion_comment_write as a write operation and adds a classification test.
guards/github-guard/rust-guard/src/labels/tool_rules.rs Adds explicit DIFC secrecy/integrity rules and tests for discussion_comment_write and list_repository_collaborators.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment thread guards/github-guard/rust-guard/src/labels/tool_rules.rs Outdated
Comment thread guards/github-guard/rust-guard/src/labels/tool_rules.rs Outdated
Comment thread guards/github-guard/rust-guard/src/labels/tool_rules.rs Outdated
lpcox and others added 3 commits May 16, 2026 09:59
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@lpcox
Copy link
Copy Markdown
Collaborator

lpcox commented May 16, 2026

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 16, 2026

@copilot fix this failed ci check https://github.com/github/gh-aw-mcpg/actions/runs/25967718884/job/76334061789?pr=5818

Fixed in 648096a. I reproduced the rust-guard-test failure, corrected the policy_private_scope_label usage/signature mismatch, aligned the collaborator integrity test expectation, and verified with cargo test labels::tool_rules and make agent-finished.

Copilot finished work on behalf of lpcox May 16, 2026 17:48
@lpcox lpcox merged commit 96b1b5a into main May 16, 2026
14 checks passed
@lpcox lpcox deleted the copilot/guard-coverage-fix-missing-tool branch May 16, 2026 17:54
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.

[guard-coverage] Guard coverage gap: 1 write operation from github-mcp-server not classified

3 participants