[Repo Assist] fix: handle bare-string labels from MCP tool path in rust guard - #9389
Merged
lpcox merged 1 commit intoJul 15, 2026
Merged
Conversation
The issue_read MCP tool returns labels as bare strings (e.g. ["approved"]),
while the REST/proxy path returns label objects (e.g. [{"name":"approved"}]).
extract_github_label_names only handled the object shape, so approval-labels
and refusal-labels were silently ignored for items read via MCP tools.
Fix: try as_str() first (bare string), then fall back to get("name")
(object shape). Both approval-label promotion and refusal-label demotion
are now handled correctly on both code paths.
Closes #9382
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes label-policy enforcement for MCP tool responses that return labels as bare strings.
Changes:
- Supports both string and object label formats.
- Adds approval/refusal label regression tests.
Show a summary per file
| File | Description |
|---|---|
guards/github-guard/rust-guard/src/labels/helpers.rs |
Extracts labels from both API shapes and tests MCP behavior. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Medium
lpcox
deleted the
repo-assist/fix-issue-9382-bare-string-labels-049ea4a89b336083
branch
July 15, 2026 15:51
This was referenced Jul 15, 2026
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
Fixes #9382:
approval-labelsandrefusal-labelsare silently ignored when issues are read via MCP tools (e.g.issue_read). The REST/proxy path returns labels as objects ([{"name":"x"}]); the MCP tool path returns bare strings (["x"]). The guard only handled the object shape.Root Cause
extract_github_label_namesinguards/github-guard/rust-guard/src/labels/helpers.rscalled.get("name")on every label element. This returnsNonefor bare strings, so no labels were extracted on the MCP path — meaning approval-label promotion and refusal-label demotion were both silently skipped.Fix
Try
as_str()(bare string) first; fall back toget("name")(object shape). Both shapes are now handled without any behaviour change on the existing REST/proxy path.Impact
This was a security-relevant gap: without this fix, a refusal label on an item read via MCP tools would be ignored and the item would not be demoted to
none. The fix ensures both approval promotion and refusal demotion work correctly on all read paths.Tests Added
3 new unit tests covering the bare-string label shape for approval and refusal paths.
Test Status
cargo test)proxy.golang.orgnetwork-blocked (pre-existing policy, unrelated to this change)Warning
Firewall blocked 2 domains
The following domains were blocked by the firewall during workflow execution:
awmgmcpgproxy.golang.orgSee Network Configuration for more information.
Add this agentic workflow to your repo
To install this agentic workflow, run