Skip to content

Harden Rust guard visibility logging tests - #10733

Merged
lpcox merged 2 commits into
mainfrom
copilot/rust-guard-dedupe-visibility-ternary
Aug 5, 2026
Merged

Harden Rust guard visibility logging tests#10733
lpcox merged 2 commits into
mainfrom
copilot/rust-guard-dedupe-visibility-ternary

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Visibility log formatting was duplicated, and poisoned cache-test mutexes could cascade unrelated test failures.

  • Visibility logging

    • Add visibility_str(bool) for consistent private/public log values.
    • Use it for cache-hit and rate-limit fallback logs.
  • Test lock resilience

    • Recover the shared cache test mutex with PoisonError::into_inner().
    • Route direct test lock acquisitions through the recovery helper.
CACHE_TEST_LOCK
    .lock()
    .unwrap_or_else(|poisoned| poisoned.into_inner())

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Add helper for visibility ternary in backend.rs Harden Rust guard visibility logging tests Aug 5, 2026
Copilot AI requested a review from lpcox August 5, 2026 19:05
@lpcox
lpcox marked this pull request as ready for review August 5, 2026 20:33
Copilot AI balanced review requested due to automatic review settings August 5, 2026 20:33

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.

Pull request overview

Hardens Rust guard visibility logging and cache-test synchronization, resolving #10711.

Changes:

  • Centralizes visibility formatting with visibility_str.
  • Recovers poisoned cache-test mutexes and routes direct locking through the helper.
  • Adds visibility formatting tests.
Show a summary per file
File Description
guards/github-guard/rust-guard/src/labels/backend.rs Deduplicates visibility logs and improves test-lock resilience.

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: Balanced

@github-actions

github-actions Bot commented Aug 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 (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) unknown tool [-32602] BLOCKED
C MCP CLI reads (list_issues/get_file via github bridge) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh: GH_TOKEN not set BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh: GH_TOKEN not set BLOCKED

Overall: PASS

Full Report

Part B detail

Gateway enforces read-only by removing write tools from the MCP registry. All 7 write attempts returned Error [-32602]: unknown tool — tool absent at protocol level, not merely backend config.

Part D/E detail

gh CLI is unauthenticated (no GH_TOKEN). All REST/GraphQL write attempts rejected at auth layer.

References: §31037453881

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — gVisor

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: gVisor (runsc) kernel-level isolation

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool (gateway-level) BLOCKED
C CLI reads (list_issues/get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) rejected (gh unauthenticated) BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) rejected (gh unauthenticated) BLOCKED

Note on Part B: Gateway returns MCP status=200 with JSON-RPC error -32602 for all write tools — gateway-level tool filtering confirmed.

Note on Parts D/E: gh CLI carries no token in this workflow; all REST/GraphQL writes rejected before reaching GitHub.

Overall: PASS

References: §31037453628

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

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool BLOCKED
C CLI reads (list_issues/get_file_contents) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh unauthenticated — rejected BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh unauthenticated — rejected BLOCKED

Overall: PASS

Notes:

  • Part B: All 7 write tools absent from gateway-filtered tool list (Error [-32602]: unknown tool). Gateway enforces read-only by removing write tools entirely.
  • Part D/E: gh CLI has no token in this environment; all REST/GraphQL write attempts fail at auth. This is the expected security boundary (mcpg read-only + token scopes).

References: §31037452170

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[rust-guard] Rust Guard: dedupe visibility ternary and fix poisonable test lock in backend.rs

3 participants