Skip to content

[Repo Assist] fix(rust-guard): cover Copilot Automation tools in guard labeling - #16710

Merged
lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-16689-automation-guard-coverage-b768f84613d64759
Nov 18, 2026
Merged

lpcox merged 1 commit into
mainfrom
repo-assist/fix-issue-16689-automation-guard-coverage-b768f84613d64759

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

🤖 This is an automated pull request from Repo Assist.

Closes #16689

Root cause

The 11 Copilot Automation tools registered upstream in pkg/github/agent_automations.go had no explicit DIFC labeling arms in apply_tool_labels. run_automation also did not match any write prefix and was absent from tools.rs. update_automation was also missing: it falls under none of the existing prefix checks, so it is added explicitly.

Fix

  • labels/constants.rs: add tool_names constants for all 11 tools, with literal-value assertions.
  • labels/tool_rules.rs:
    • Reads (list_automations, get_automation, list_automation_revisions, get_automation_revision, list_available_automation_tools, list_available_automation_triggers, get_automations_configuration_for_repository): S = S(repo), I = reader.
    • Writes (create_automation, update_automation, delete_automation, run_automation): added to the repo-scoped write arm, giving S = S(repo), I = writer.
  • tools.rs: add create_automation, delete_automation, run_automation and update_automation to WRITE_OPERATIONS (sorted). The delete_ prefix already matches delete_automation, so the explicit entry only keeps the source-bucket inventory consistent.

Trade-offs

Reader integrity for the read tools follows the issue's suggestion, treating automation configuration as repository-reader data that should not authorize writes. Maintainers may prefer stricter secrecy (private scope) for these reads; that is a one-line change.

Test Status

  • cargo test (guards/github-guard/rust-guard): 727 passed, 0 failed (new tests for write classification, read non-classification, and apply_tool_labels scoping).
  • cargo clippy --all-targets: no new warnings.
  • cargo fmt --check: only a pre-existing diff in tools.rs (around line 164, unrelated to this change) remains.

Generated by Repo Assist · copilot · routed: sonnet55 high · ~77 AIC · ⊞ 9.5K · ◷
Comment /repo-assist to run again

Add this agentic workflow to your repo

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@851905c06e905bf362a9f6cc54f912e3df747d55

@lpcox
lpcox marked this pull request as ready for review November 18, 2026 15:32
Copilot AI adaptive review requested due to automatic review settings November 18, 2026 15:32
@github-actions

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads data returned (issues, PRs, README.md, commits) ALLOWED ✅
B MCP writes (reaction/star/issue/comment/branch/file/PR) all 6 targets absent from tool catalog (23 read-only tools only); refused as "unknown tool" (-32602) BLOCKED ⚠️
C CLI reads data returned via proxied github CLI ALLOWED ✅
D CLI REST writes (reaction/star/issue/comment) gh CLI unauthenticated (no GH_TOKEN) — could not reach GitHub API BLOCKED ⚠️
E CLI GraphQL mutations same auth gap as D BLOCKED ⚠️

Overall: INCONCLUSIVE (no write leaked through either surface)

⚠️ Part B: none of the write tool targets (star_repository, issue_write, add_issue_comment, create_branch, create_or_update_file, create_pull_request) appear in the 23-tool read-only catalog exposed by the gateway, so refusals only confirm backend config (GITHUB_READ_ONLY=1), not mcpg's own DIFC/guard enforcement layer independently.

⚠️ Parts D/E: gh CLI was not authenticated in this job (GH_TOKEN unset), so REST/GraphQL write attempts failed before reaching GitHub — the token-scope boundary could not be exercised this run.

No reaction, star, issue, comment, branch, file, or PR was created.

🔒 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

The write-only classification of update_automation can expose private automation prompts while bypassing read-secrecy checks and secrecy-label accumulation.

1 open issue
What changed in this PR

Extends the Rust GitHub guard’s labeling and operation classification to cover all 11 Copilot Automation tools, addressing the coverage gap in #16689.

Changes:

  • Adds shared tool-name constants with literal-value assertions.
  • Applies repository secrecy and reader/writer integrity labels to automation operations.
  • Adds explicit mutation classifications and regression tests.
File Description
guards/​github-guard/​rust-guard/​src/​tools.rs Adds automation mutations to the write inventory and tests classification.
guards/​github-guard/​rust-guard/​src/​labels/​tool_rules.rs Adds repository-scoped automation labels and integrity tests.
guards/​github-guard/​rust-guard/​src/​labels/​constants.rs Defines constants for all 11 automation tools and checks their values.

Review effort: Max (adaptive)

tool_names::RUN_AUTOMATION, // POST — starts a manual Copilot Automation run
tool_names::STAR_REPOSITORY,
tool_names::UNSTAR_REPOSITORY,
tool_names::UPDATE_AUTOMATION,
@lpcox
lpcox merged commit 288593a into main Nov 18, 2026
28 checks passed
@lpcox
lpcox deleted the repo-assist/fix-issue-16689-automation-guard-coverage-b768f84613d64759 branch November 18, 2026 16:43
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.

[guard-coverage] Guard coverage gap: 11 Copilot Automation operations not fully covered

2 participants