Skip to content

fix(guard): cover deprecated tool aliases, enable_toolset DIFC rule, and pre-emptive CLI entries#3762

Merged
lpcox merged 2 commits intomainfrom
fix/guard-coverage-deprecated-aliases-3720
Apr 14, 2026
Merged

fix(guard): cover deprecated tool aliases, enable_toolset DIFC rule, and pre-emptive CLI entries#3762
lpcox merged 2 commits intomainfrom
fix/guard-coverage-deprecated-aliases-3720

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Apr 14, 2026

Fixes #3720

Problem

The guard has 6 coverage gaps:

  • 5 deprecated MCP tool aliases (run_workflow, delete_workflow_run_logs, add_project_item, update_project_item, delete_project_item) that map to write operations are not classified as writes. The guard sees the alias name before the backend resolves it, so the tools bypass write-level integrity checks.
  • enable_toolset has no explicit DIFC labeling rule and falls through to the default arm, receiving only baseline labels instead of writer-level integrity.

Changes

tools.rs — Write classification

  • Added 4 deprecated aliases to WRITE_OPERATIONS: run_workflow, delete_workflow_run_logs, add_project_item, delete_project_item
  • Added 1 deprecated alias to READ_WRITE_OPERATIONS: update_project_item
  • Added 6 pre-emptive CLI entries: update_issue_comment, delete_issue_comment, create_release, edit_release, delete_release, delete_gist

tool_rules.rs — DIFC labeling

  • Extended projects_write match arm with deprecated aliases
  • Extended actions_run_trigger match arm with deprecated aliases
  • Added explicit enable_toolset rule with writer-level integrity
  • Added rules for all pre-emptive CLI entries

Tests

  • Added tests for deprecated alias write classification
  • Added tests for deprecated alias read-write classification
  • Added tests for pre-emptive CLI write classification

…and pre-emptive CLI entries

- Add 5 deprecated MCP tool aliases to write classification:
  run_workflow, delete_workflow_run_logs, add_project_item,
  delete_project_item (WRITE_OPERATIONS), update_project_item
  (READ_WRITE_OPERATIONS)
- Add DIFC labeling rules for deprecated aliases by extending
  existing match arms (projects_write, actions_run_trigger)
- Add explicit enable_toolset DIFC rule with writer-level integrity
  to prevent low-trust agents from self-escalating
- Add 6 pre-emptive CLI entries: update_issue_comment,
  delete_issue_comment, create_release, edit_release,
  delete_release, delete_gist
- Add DIFC labeling rules for all pre-emptive CLI entries
- Add tests for new classifications

Fixes #3720

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Closes guard coverage gaps by ensuring deprecated MCP tool aliases and anticipated CLI-only tool names are classified as writes/read-writes and receive appropriate DIFC labeling, including adding an explicit rule for enable_toolset.

Changes:

  • Extend write/read-write classification lists to cover deprecated aliases and pre-emptive CLI tool names.
  • Expand DIFC labeling rules to include deprecated aliases, enable_toolset, and pre-emptive CLI entries.
  • Add unit tests for the new tool classification entries in tools.rs.
Show a summary per file
File Description
guards/github-guard/rust-guard/src/tools.rs Adds deprecated alias + pre-emptive CLI entries to write/read-write classification and tests them.
guards/github-guard/rust-guard/src/labels/tool_rules.rs Adds explicit DIFC match arms for deprecated aliases, enable_toolset, and pre-emptive CLI tool names.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 2

Comment thread guards/github-guard/rust-guard/src/labels/tool_rules.rs Outdated
Comment on lines +677 to +685
// === Dynamic toolset enablement (capability expansion) ===
"enable_toolset" => {
// Enabling a toolset expands the agent's runtime capability set.
// Requires writer-level integrity to prevent low-trust agents from
// self-escalating by enabling additional tool groups.
// S = public (empty — no repository-scoped data); I = writer (global)
baseline_scope = "github".to_string();
integrity = writer_integrity("github", ctx);
}
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New DIFC rule for enable_toolset isn’t covered by existing apply_tool_labels tests. Since this tool controls runtime capability expansion, add a unit test (in labels/mod.rs test suite) asserting it returns writer-level integrity on the intended scope (and public secrecy) to prevent regressions.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI added a commit that referenced this pull request Apr 14, 2026
Resolves review comment r3080468796: adds a test asserting that
enable_toolset returns writer-level integrity on the github scope
and empty (public) secrecy, preventing regressions on this
capability-expansion guard rule.

Also cherry-picks the underlying code changes from PR #3762 (commits
5110c2a and 0b4c9ba) which add the enable_toolset rule plus
deprecated alias coverage to tool_rules.rs and tools.rs.

Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/2b9cfc07-0be9-489a-afaf-cbe535fc52b8

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@lpcox lpcox merged commit 6d23345 into main Apr 14, 2026
16 checks passed
@lpcox lpcox deleted the fix/guard-coverage-deprecated-aliases-3720 branch April 14, 2026 15:56
lpcox added a commit that referenced this pull request Apr 14, 2026
…nges from #3762 (#3768)

`enable_toolset` had no `apply_tool_labels` test coverage despite being
a capability-expansion tool that requires writer-level integrity to
prevent low-trust agent self-escalation.

## Changes

- **Cherry-picked PR #3762 code changes** (`tool_rules.rs`, `tools.rs`):
- Extended `projects_write` and `actions_run_trigger` match arms with
deprecated aliases (`add_project_item`, `update_project_item`,
`delete_project_item`, `run_workflow`, `delete_workflow_run_logs`)
- Added explicit `enable_toolset` rule: `S = public (empty)`, `I =
writer:github`
- Added pre-emptive CLI rules for `update_issue_comment`,
`delete_issue_comment`, `create_release`, `edit_release`,
`delete_release`, `delete_gist`
- Classified all of the above in `WRITE_OPERATIONS` /
`READ_WRITE_OPERATIONS`

- **Added unit test** (`labels/mod.rs`) for the `enable_toolset` rule:

```rust
let (secrecy, integrity, _) = apply_tool_labels("enable_toolset", &tool_args, "", vec![], vec![], String::new(), &ctx);

assert!(secrecy.is_empty());  // public — no repo-scoped data
assert_eq!(integrity, writer_integrity("github", &ctx));  // writer:github scope
```
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.

[guard-coverage] Guard coverage gap: 6 operations from deprecated MCP tool aliases not fully covered

2 participants