Repository navigation
Close GitHub guard coverage gaps for pull-request artifacts - #17147
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
Critical artifact-response flaws allow integrity and blocked-user policy bypasses, while response labeling breaks expected list and write-result response shapes.
3 open issues
What changed in this PR
This PR extends the MCP Gateway’s Rust GitHub guard to cover pull-request artifact operations, addressing the coverage gaps identified in #17138.
Changes:
- Classifies artifact mutations as read-write operations.
- Adds repository-visibility secrecy labels, writer integrity for mutations, and
noneintegrity for reads and returned content. - Adds regression tests for classification, public/private visibility, mutation methods, and raw/MCP-wrapped responses.
| File | Description |
|---|---|
guards/github-guard/rust-guard/src/tools.rs |
Registers artifact writes as read-write and tests classification. |
guards/github-guard/rust-guard/src/labels/tool_rules.rs |
Adds explicit artifact request-label rules and tests. |
guards/github-guard/rust-guard/src/labels/response_items.rs |
Labels artifact responses as untrusted and tests response envelopes. |
guards/github-guard/rust-guard/src/labels/constants.rs |
Defines shared names for both artifact tools. |
Review effort: Max (adaptive)
|
|
||
| tool_names::PULL_REQUEST_ARTIFACT_READ | tool_names::PULL_REQUEST_ARTIFACT_WRITE => { | ||
| let (repo_full, secrecy) = repo_full_with_secrecy(tool_args, ctx); | ||
| let integrity: SharedLabels = none_integrity(&repo_full, ctx).into(); |
| tool_names::PULL_REQUEST_ARTIFACT_READ | tool_names::PULL_REQUEST_ARTIFACT_WRITE => { | ||
| let (repo_full, secrecy) = repo_full_with_secrecy(tool_args, ctx); | ||
| let integrity: SharedLabels = none_integrity(&repo_full, ctx).into(); | ||
| let items = extract_items_slice(&actual_response, "artifacts"); |
| "manage_notification_subscription", | ||
| "manage_repository_notification_subscription", | ||
| "merge_pull_request", | ||
| tool_names::PULL_REQUEST_ARTIFACT_WRITE, // upserts or deletes PR artifacts and returns untrusted content |
|
@copilot address review feedback |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Addressed in |
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write leaked on any surface. Part B gap: all 6 write tools (add_issue_comment, star_repository, issue_write, create_branch, create_or_update_file, create_pull_request) were absent from the exposed tool catalog entirely (23 read-only tools total), so refusal reflects backend
|

pull_request_artifact_writelacked mutation classification, and both artifact tools fell through default DIFC handling.noneintegrity—even in private repositories—without promoting content based on creator or PR provenance.