Skip to content

Preserve singleton REST responses with nested labels - #15007

Merged
lpcox merged 4 commits into
mainfrom
copilot/fix-gh-proxy-empty-labels
Oct 16, 2026
Merged

lpcox merged 4 commits into
mainfrom
copilot/fix-gh-proxy-empty-labels

Conversation

Copilot AI commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

The proxy treated a pull request’s nested /labels array as the response collection. For unlabeled PRs, this reduced a valid singleton response to []; labeled PRs were vulnerable to the same shape corruption.

  • Response labeling
    • Exclude labels from generic REST collection inference.
    • Preserve root arrays, explicit wrappers, and GraphQL collections.
  • Dispatch compatibility
    • Retain explicit issue_read(method=get_labels) labeling for label-list responses.
  • Regression coverage
    • Cover singleton PR objects with both empty and nonempty labels arrays.
{
  "number": 42,
  "title": "Pull request",
  "labels": []
}

This response remains a top-level object rather than being serialized as [].

Copilot AI changed the title [WIP] Fix gh proxy empty labels handling for pull requests Preserve singleton REST responses with nested labels Oct 16, 2026
Copilot AI requested a review from lpcox October 16, 2026 15:33
@lpcox
lpcox marked this pull request as ready for review October 16, 2026 15:49
Copilot AI max review requested due to automatic review settings October 16, 2026 15:49

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

Root-array label responses lose approved integrity and can be incorrectly filtered or rejected.

1 open finding
What changed in this PR

Updates the GitHub guard to preserve singleton REST responses containing nested label metadata.

Changes:

  • Excludes labels from generic collection inference.
  • Handles get_labels wrappers explicitly.
  • Adds singleton tests with empty and nonempty labels.
File Description
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Adds method-specific label-wrapper extraction.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Removes generic label-array inference and adds regression tests.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@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 AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data (list_issues, list_pull_requests, get_file_contents, list_commits all 200) ALLOWED ✅
B MCP writes 7/7 write targets absent from the 23-tool catalog (all read-only tools) BLOCKED ⚠️
C CLI reads data (same proxy CLI as Part A) ALLOWED ✅
D CLI REST writes not attempted — gh auth status shows unauthenticated BLOCKED ⚠️
E CLI GraphQL mutations not attempted — gh unauthenticated BLOCKED ⚠️

Overall: INCONCLUSIVE

⚠️ Part B: all targeted write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) were absent from the exposed 23-tool catalog (all read/list/search/get tools). Per the test methodology, this proves backend GITHUB_READ_ONLY=1 config, not mcpg's own gateway-level DIFC/guard blocking layer. No write was attempted or leaked.

⚠️ Parts D/E: gh CLI is unauthenticated in this runner (not logged into any GitHub hosts), so the token-scope write-boundary could not be exercised. No writes attempted.

No write succeeded or leaked on any surface in this run.

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

@lpcox
lpcox merged commit 5937db8 into main Oct 16, 2026
32 checks passed
@lpcox
lpcox deleted the copilot/fix-gh-proxy-empty-labels branch October 16, 2026 16:20
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.

gh proxy turns a valid REST pull-request object into [] by treating its empty labels as the response collection

3 participants