feat: guard tool coverage for GitHub MCP server + proxy router expansion#2291
Merged
feat: guard tool coverage for GitHub MCP server + proxy router expansion#2291
Conversation
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>
Contributor
There was a problem hiding this comment.
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_labelbehind#[cfg(test)]so it’s only compiled for unit tests. - Update
labels::modre-exports to only exposehas_approval_labelin 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.
This was referenced Mar 21, 2026
4 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
Cross-referencing all tool names from
github/github-mcp-serversource against the guard'stool_rules.rsrevealed 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 anymin-integritythreshold 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_contentsfallback (wrong security labels) or were blocked entirely.Changes
Guard: New tool coverage in
tool_rules.rs(22 read tools)get_job_logssecretget_meprivate:userget_teams,get_team_membersprivate:userlist_discussions,get_discussionget_discussion_commentslist_discussion_categorieslist_gists,get_gistprivate:userget_repository_treelist_labellist_notifications,get_notification_detailsprivate:userprojects_list,projects_get[]list_starred_repositoriesprivate:usersearch_orgs[]list_global_security_advisories,get_global_security_advisory[]list_repository_security_advisories,list_org_repository_security_advisoriesprivate:repoAlso updated
tools.rs: addedactions_run_trigger,projects_write,add_reply_to_pull_request_commentto write operations.Guard: Unit tests (37 new tests)
Every new tool has corresponding tests for
label_resourceandlabel_response.Guard: Compiler warning fix
Gated
has_approval_labelwith#[cfg(test)](only used in tests).Proxy: 22 new REST routes + 5 GraphQL patterns
/user,/user/keys|ssh_signing_keys|gpg_keys(REST),viewer {}(GraphQL)/notifications/commits/{sha}/check-runs|check-suites/orgs/{org}/actions/secrets|variablesorganization()GraphQLValid integrity levels:
merged>approved>unapproved>none>blocked