Skip to content

Enforce blocked users across PR content, commits, releases, and search - #15984

Merged
lpcox merged 2 commits into
mainfrom
lpcox-blocked-user-bounty-fixes
Nov 5, 2026
Merged

lpcox merged 2 commits into
mainfrom
lpcox-blocked-user-bounty-fixes

Conversation

@lpcox

@lpcox lpcox commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

Addresses the four remaining confirmed MCP Gateway response-labeling gaps described in github/agentic-workflows#559. The already-shipped issue-read envelope fix is unchanged. This PR is proposed remediation, not a claim that the changes have been released or deployed.

  • PR files and diffs: check the parent PR author's GitHub login through the existing backend facts lookup. Blocked authors and unresolved/failed lookups receive blocked integrity when a deny-list is active. Unblocked patches retain their existing none integrity, including for trusted authors and merged PRs.
  • Commit reads: apply the deny-list before integrity promotion, support direct GraphQL author.user.login, and fail closed when account identity is missing under an active deny-list.
  • Releases: check each author's identity before applying the existing merged-level classification, covering lists, latest release, and release-by-tag responses in both labeling formats.
  • Commit search: label individual results using their own author and repository provenance instead of relying solely on query-scope labels. Unblocked results retain writer integrity; conservative defaults prevent unclassified or overflow items from bypassing the deny-list.

The parent PR facts lookup now understands REST objects, pull_request envelopes, and GraphQL singleton shapes. Configuration documentation explains the fail-closed behavior.

Identity limitation

Git commit display names and email addresses are user-controlled and are not mapped to GitHub logins. When blocked-users is nonempty, minimized commits exposing only name/email are denied even if the actual account is not blocked. Permitting those commits requires GitHub-provided account identity. Without a deny-list, existing classification is unchanged.

Regression coverage and validation

  • Added five Rust regression tests covering supported account shapes, unknown identities, parent-author lookup failure, trusted-user precedence, per-result repository scope, and path/legacy consistency; updated the existing unresolved-parent expectation.
  • Added real-WASM gateway regressions for min-integrity: none and approved, filter and propagate modes, mixed allowed/blocked collections, text plus structuredContent, structured-only responses, and raw plaintext diffs. Blocked content must disappear from the rebuilt output while allowed content preserves its existing behavior.
  • cargo test --manifest-path guards/github-guard/rust-guard/Cargo.toml --quiet — 710 tests passed.
  • make -C guards/github-guard build — rebuilt the WASM guard.
  • go test ./internal/proxy -run 'TestBlockedUsersResponseSurfaces|TestPRContentRevisionIntegrity|TestIssueReadTrustedBotApprovedIntegrity' -count=1 — passed.
  • make agent-finished — passed, including build, lint, Go tests, and Rust tests.
  • git diff --check — clean.

Scope is limited to this MCPG bounty; no unrelated bounty changes, credential cleanup, or release/deployment changes are included.

Check parent PR authors for files and diffs, classify release and commit-search authors per item, and fail closed when commit account identity is unavailable under an active deny-list. Add Rust and real-WASM regression coverage and document the limitation.

Co-authored-by: Copilot App <[email protected]>
Copilot AI adaptive review requested due to automatic review settings November 5, 2026 00:31
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — default AWF

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 (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED ✅
B MCP writes (add_issue_comment/star_repository/issue_write/create_branch/create_or_update_file/create_pull_request) all 6 tool names absent from 23-tool read-only catalog BLOCKED ⚠️
C CLI reads (list_issues, list_pull_requests, get_file_contents, list_commits via github proxy) data returned ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment via gh) gh unauthenticated — writes errored before reaching API BLOCKED ⚠️
E CLI GraphQL mutations (addReaction/addStar/createIssue via gh) gh unauthenticated — same as D BLOCKED ⚠️

Overall: INCONCLUSIVE

No write leaked through any surface. Parts A and C fully confirm the read path works. Part B is ⚠️ because the gateway-fronted github CLI only exposes 23 read-only tool names (get_/list_/search_*) — the targeted write tools were never in the catalog, so this run cannot distinguish "gateway blocked it" from "backend never registered it" (per the task's own methodology note: gh-aw's tools.github: always runs the backend with GITHUB_READ_ONLY=1). Parts D/E are ⚠️ because gh auth status showed no credentials in this job — gh api/gh issue create failed immediately with a "set GH_TOKEN" error rather than a GitHub 403/404/422, so the token-scope boundary could not be exercised this run.

Full details: /tmp/gh-aw/agent/readonly-stress-41941944595.txt

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

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

Critical integrity-enforcement gaps allow conflicting PR aliases and unrecognized multi-repository blocked labels to expose content from blocked or unresolved authors.

3 open issues
What changed in this PR

Extends the GitHub guard’s blocked-user response labeling to PR files and diffs, commit reads, releases, and commit search.

Changes:

  • Adds author checks and parent-PR lookups, with fail-closed handling when account identity cannot be established.
  • Labels commit-search results individually while preserving existing integrity levels for allowed content.
  • Adds Rust and real-WASM gateway regressions and documents account-identity limitations.
File Description
internal/​proxy/​blocked_users_guard_test.go Adds gateway regressions for blocked response content across formats and enforcement modes.
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Uses the shared commit-search tool constant.
guards/​github-guard/​rust-guard/​src/​labels/​response_paths.rs Adds path-based author checks and conservative collection defaults.
guards/​github-guard/​rust-guard/​src/​labels/​response_items.rs Adds corresponding checks to legacy item labeling.
guards/​github-guard/​rust-guard/​src/​labels/​mod.rs Tests account shapes, release authors, and per-result commit-search labels.
guards/​github-guard/​rust-guard/​src/​labels/​helpers.rs Centralizes author denial checks and parent-PR content classification.
guards/​github-guard/​rust-guard/​src/​labels/​constants.rs Defines the commit-search tool-name constant.
guards/​github-guard/​rust-guard/​src/​labels/​backend.rs Extracts parent-PR facts from REST, envelope, and GraphQL response shapes.
docs/​CONFIGURATION.md Documents fail-closed behavior and commit identity limitations.

Review effort: Max (auto)

ctx: &PolicyContext,
) -> Vec<String> {
if author_denied(extract_author_login(item), ctx) {
blocked_integrity(repo_full_name, ctx)
Comment on lines +976 to +977
tool_names::SEARCH_COMMITS => {
let (items, items_path) = extract_items_array(&actual_response);
@lpcox

lpcox commented Nov 5, 2026

Copy link
Copy Markdown
Collaborator Author

@copilot address review feedback

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in 7a94300: canonical blocked tags are hard-denied in propagate mode, PR content checks prefer pullNumber, and zero-count commit searches without items fall through to metadata labeling. Targeted tests and make agent-finished passed; CodeQL found no alerts.

@lpcox
lpcox merged commit 28ee134 into main Nov 5, 2026
28 checks passed
@lpcox
lpcox deleted the lpcox-blocked-user-bounty-fixes branch November 5, 2026 05: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.

3 participants