Skip to content

Tighten DIFC labeling for GitHub read metadata - #15496

Merged
lpcox merged 11 commits into
mainfrom
copilot/guard-coverage-fix
Oct 25, 2026
Merged

lpcox merged 11 commits into
mainfrom
copilot/guard-coverage-fix

Conversation

Copilot AI commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

The coverage report flagged six GitHub read tools for missing DIFC labels. Existing rules already cover most; this change tightens organization-search secrecy and repository-tree descriptions while protecting that coverage.

  • Labeling
    • Treat search_orgs as access-sensitive: private:user secrecy with GitHub-controlled integrity.
    • Give get_repository_tree a repo:owner/repo description, retaining repository-visibility secrecy and writer integrity.
  • Coverage
    • Centralize the six tool-name constants.
    • Add regression cases for public/private repository metadata and authenticated/requested-user starred repositories; retain Copilot Space assertions.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix guard coverage gap for 6 operations Tighten DIFC labeling for GitHub read metadata Oct 25, 2026
Copilot AI requested a review from lpcox October 25, 2026 05:46
@lpcox
lpcox marked this pull request as ready for review October 25, 2026 17:03
Copilot AI max review requested due to automatic review settings October 25, 2026 17:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The organization-search change blocks public search results under strict/filter enforcement, even with repos: "all".

1 open issue
What changed in this PR

Refines GitHub read-metadata labeling in the Rust DIFC guard and protects coverage for the six tools identified in #15490.

Changes:

  • Labels organization search as private-user metadata.
  • Adds repository-scoped descriptions for repository trees while preserving visibility and integrity rules.
  • Centralizes six tool names and extends metadata-label regression tests.
File Description
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Updates labeling rules and adds regression cases.
guards/​github-guard/​rust-guard/​src/​labels/​mod.rs Updates the organization-search secrecy assertion.
guards/​github-guard/​rust-guard/​src/​labels/​constants.rs Defines constants for the six read tools.

Review effort: Max

| "get_copilot_space"
| tool_names::LIST_STARRED_REPOSITORIES
| tool_names::GET_COPILOT_SPACE
| tool_names::SEARCH_ORGS
@lpcox

lpcox commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address review feedback

Addressed in 59d62cd. search_orgs remains publicly searchable, while GraphQL organization(...) now maps to graphql_organization with its separate private:user label.

Comment thread internal/proxy/graphql.go Resolved
Comment thread internal/proxy/graphql.go Resolved
@lpcox

lpcox commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

@copilot address security review feedback

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
lpcox and others added 2 commits October 25, 2026 10:43
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@github-actions

This comment has been minimized.

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
let query = get_string_field(args, field_names::QUERY).unwrap_or_default();

// If query looks repo-scoped, prefer repo-private scoping derived from args.
if query.contains("repository(") || query.contains("repositories(") {
Comment thread internal/proxy/graphql.go Outdated
// Organization queries
{queryPattern: regexp.MustCompile(`(?i)\borganization\s*\(`), toolName: "search_orgs"},
// Organization queries (root-field constrained to reduce misrouting from token injection/mixed queries)
{queryPattern: regexp.MustCompile(`(?is)^\s*(?:query|mutation|subscription)?\s*[A-Za-z0-9_]*\s*(?:\([^)]*\))?\s*(?:@[A-Za-z0-9_]+(?:\([^)]*\))?\s*)*\{\s*organization\s*\(`), toolName: "graphql_organization"},
@github-actions

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) no writes leaked; all 7 targets absent from tool catalog ("unknown tool") BLOCKED ⚠️
C CLI reads data ALLOWED ✅
D CLI REST writes not attempted — gh unauthenticated in this env BLOCKED ⚠️
E CLI GraphQL mutations not attempted — gh unauthenticated in this env BLOCKED ⚠️

Overall: INCONCLUSIVE

Notes:

  • Part A/C: all 4 MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) returned real data via the gateway-backed github CLI proxy.
  • Part B: catalog exposed only 23 read-only tools; no write tool names were registered at all, so add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request all failed with Error [-32602]: unknown tool. This confirms backend GITHUB_READ_ONLY=1 config, not an independent gateway-level DIFC/guard block — hence ⚠️ INCONCLUSIVE per methodology, not a pass of gateway enforcement.
  • Part D/E: gh auth status showed no authenticated host, so REST/GraphQL write probes were skipped rather than producing misleading 401s; ⚠️ INCONCLUSIVE.
  • No reaction, star, issue, comment, branch, file, or PR was created or leaked in this run.

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox

lpcox commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot address security review feedback

Addressed in 00a9c34. GraphQL routing now uses parsed root fields to prevent mixed-query introspection bypass and organization misclassification; the guard adds repository-scoped secrecy for ambiguous organization queries.

Copilot AI and others added 2 commits October 25, 2026 18:04
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot address security review feedback

Addressed in 5b6e2ca. GraphQL routing now parses the selected operation, limits the introspection bypass to a single introspection root, and applies conservative repository secrecy for nested or mixed repository fields.

@copilot fix the failing ci checks https://github.com/github/gh-aw-mcpg/actions/runs/40218232613/job/121243925552?pr=15496 and https://github.com/github/gh-aw-mcpg/actions/runs/40218234714/job/121243...

Fixed in 5b6e2ca. The Rust guard compile errors and GraphQL proxy/race-test failures are resolved; make agent-finished now passes, including full Go and Rust tests.

@lpcox

lpcox commented Oct 25, 2026

Copy link
Copy Markdown
Collaborator

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

Copilot AI commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix the failed linting test https://github.com/github/gh-aw-mcpg/actions/runs/40219631113/job/121252244029?pr=15496

Fixed the lint failure by replacing the field comparison chain with a switch; targeted lint, proxy tests, and make agent-finished pass. Commit: db8ab07.

@lpcox
lpcox merged commit 3a80e06 into main Oct 25, 2026
28 checks passed
@lpcox
lpcox deleted the copilot/guard-coverage-fix branch October 25, 2026 18:55
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: 6 operations from github-mcp-server / GitHub CLI not fully covered

4 participants