Skip to content

feat: guard tool coverage for GitHub MCP server + proxy router expansion#2291

Merged
lpcox merged 1 commit intomainfrom
feat/guard-tool-coverage
Mar 21, 2026
Merged

feat: guard tool coverage for GitHub MCP server + proxy router expansion#2291
lpcox merged 1 commit intomainfrom
feat/guard-tool-coverage

Conversation

@lpcox
Copy link
Collaborator

@lpcox lpcox commented Mar 21, 2026

Problem

Cross-referencing all tool names from github/github-mcp-server source against the guard's tool_rules.rs revealed 22 read tools falling through to the default _ => case, which inherits empty labels. This means these tools had no integrity or secrecy labeling, causing them to either be filtered at any min-integrity threshold or leak private data without secrecy tags.

Additionally, the proxy router had gaps where Actions, discussions, user, and notification endpoints either fell through to a generic get_file_contents fallback (wrong security labels) or were blocked entirely.

Changes

Guard: New tool coverage in tool_rules.rs (22 read tools)

Category Tools Secrecy Integrity Rationale
Actions get_job_logs secret approved Logs may contain leaked env vars/tokens
Context get_me private:user project:github User PII (email, profile)
Context get_teams, get_team_members private:user project:github Org structure is sensitive
Discussions list_discussions, get_discussion repo visibility approved User content, similar to issues
Discussions get_discussion_comments repo visibility approved User content, similar to issue comments
Discussions list_discussion_categories repo visibility approved Maintainer-managed metadata
Gists list_gists, get_gist private:user unapproved User content, no repo-level trust signal
Git get_repository_tree repo visibility approved Repo metadata
Labels list_label repo visibility approved Maintainer-managed metadata
Notifications list_notifications, get_notification_details private:user none (empty) References external content of unknown trust
Projects projects_list, projects_get [] approved:owner New canonical project tool names
Repos list_starred_repositories private:user project:github Reveals user preferences/interests
Search search_orgs [] project:github Public GitHub-controlled metadata
Security list_global_security_advisories, get_global_security_advisory [] project:github Published GHSA CVE data
Security list_repository_security_advisories, list_org_repository_security_advisories private:repo approved May contain embargoed vulnerability info

Also updated tools.rs: added actions_run_trigger, projects_write, add_reply_to_pull_request_comment to write operations.

Guard: Unit tests (37 new tests)

Every new tool has corresponding tests for label_resource and label_response.

Guard: Compiler warning fix

Gated has_approval_label with #[cfg(test)] (only used in tests).

Proxy: 22 new REST routes + 5 GraphQL patterns

  • Actions: get workflow/run/job, workflow-specific runs, attempt jobs/logs, artifacts, caches, secrets, variables, environment config
  • Discussions: list, single, comments (REST + GraphQL)
  • User: /user, /user/keys|ssh_signing_keys|gpg_keys (REST), viewer {} (GraphQL)
  • Notifications: /notifications
  • Check runs: /commits/{sha}/check-runs|check-suites
  • Org-scoped: /orgs/{org}/actions/secrets|variables
  • Organization: organization() GraphQL

Valid integrity levels: merged > approved > unapproved > none > blocked

Gate has_approval_label with #[cfg(test)] since it is currently only
used in tests. The underlying first_matching_approval_label remains
available for production code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 21, 2026 22:55
@lpcox lpcox merged commit 68537a8 into main Mar 21, 2026
10 checks passed
@lpcox lpcox deleted the feat/guard-tool-coverage branch March 21, 2026 22:55
Copy link
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 adjusts the guard label helper API surface so that has_approval_label is only compiled and re-exported in test builds, addressing a compiler warning from non-test builds.

Changes:

  • Gate helpers::has_approval_label behind #[cfg(test)] so it’s only compiled for unit tests.
  • Update labels::mod re-exports to only expose has_approval_label in test builds.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
guards/github-guard/rust-guard/src/labels/mod.rs Removes unconditional re-export and re-exports has_approval_label only under #[cfg(test)].
guards/github-guard/rust-guard/src/labels/helpers.rs Marks has_approval_label as #[cfg(test)] to prevent non-test compilation.

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

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.

2 participants