Add DIFC labeling rule for create_pull_request_with_copilot#3651
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/d979a196-eae6-4b3f-bee9-f88ecbcfe8ae Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
create_pull_request_with_copilot
There was a problem hiding this comment.
Pull request overview
This PR updates the GitHub DIFC guard’s tool labeling rules so create_pull_request_with_copilot is treated like other Issue/PR write operations, receiving repo-scoped secrecy and writer-level integrity labels.
Changes:
- Add
create_pull_request_with_copilotto the Issue/PR write-operation match arm inapply_tool_labels. - Ensure the tool gets
S(repo)secrecy (via repo visibility) and writer integrity, matchingcreate_pull_request.
Show a summary per file
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Adds explicit labeling for create_pull_request_with_copilot under repo-scoped Issue/PR write operations. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
guards/github-guard/rust-guard/src/labels/tool_rules.rs:575
- There are unit tests covering writer-integrity for
create_pull_request, but none for the newly addedcreate_pull_request_with_copilot. Add a correspondingapply_tool_labelstest to ensure this tool consistently gets writer integrity (and repo-visibility secrecy behavior) the same way ascreate_pull_request.
"create_issue" | "issue_write" | "sub_issue_write" | "add_issue_comment"
| "create_pull_request" | "create_pull_request_with_copilot"
| "update_pull_request" | "merge_pull_request"
| "pull_request_review_write" | "add_comment_to_pending_review"
| "add_reply_to_pull_request_comment" => {
- Files reviewed: 1/1 changed files
- Comments generated: 1
| "create_issue" | "issue_write" | "sub_issue_write" | "add_issue_comment" | ||
| | "create_pull_request" | "update_pull_request" | "merge_pull_request" | ||
| | "create_pull_request" | "create_pull_request_with_copilot" | ||
| | "update_pull_request" | "merge_pull_request" |
There was a problem hiding this comment.
create_pull_request_with_copilot is now labeled as a repo-scoped write here, but it still won’t be classified as a write operation by tools::is_write_operation (see guards/github-guard/rust-guard/src/tools.rs: it’s not in WRITE_OPERATIONS, and there’s no create_* prefix handling). That means label_resource will emit operation="read" for this tool, which can weaken DIFC enforcement (read checks don’t apply write-integrity constraints). Add this tool to WRITE_OPERATIONS (or otherwise ensure it’s treated as a write op) so operation is correct end-to-end.
This issue also appears on line 571 of the same file.
Address review feedback: - Add create_pull_request_with_copilot to WRITE_OPERATIONS in tools.rs so label_resource emits operation="write", matching DIFC enforcement for other PR creation tools. - Add unit test for create_pull_request_with_copilot writer integrity in tool_rules, mirroring the existing create_pull_request test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
create_pull_request_with_copilot(remote-only tool) was covered by thecreate_*prefix pattern intools.rsfor write classification, but had no explicit match arm inapply_tool_labels, causing it to fall through to the default catch-all with no repo-scoped secrecy or writer integrity labels applied.Changes
guards/github-guard/rust-guard/src/labels/tool_rules.rs: Addcreate_pull_request_with_copilotto the existing Issue/PR write operations match arm alongsidecreate_pull_request, applyingS(repo)secrecy and writer-level integrity — identical labeling to the standard PR creation tool.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build2069436726/b514/launcher.test /tmp/go-build2069436726/b514/launcher.test -test.testlogfile=/tmp/go-build2069436726/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 8221058/b288/ x_amd64/vet . --gdwarf2(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build2069436726/b496/config.test /tmp/go-build2069436726/b496/config.test -test.testlogfile=/tmp/go-build2069436726/b496/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2069436726/b379/vet.cfg @v1.1.3/cpu/cpu.go1.25.8 om/tetratelabs/w-c=4 x_amd64/vet -I nal/encoding/def-atomic -I x_amd64/vet -I hB8eipdrZ -I x_amd64/vet --gdwarf-5 telabs/wazero/in-atomic -o x_amd64/vet(dns block)nonexistent.local/tmp/go-build2069436726/b514/launcher.test /tmp/go-build2069436726/b514/launcher.test -test.testlogfile=/tmp/go-build2069436726/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 8221058/b288/ x_amd64/vet . --gdwarf2(dns block)slow.example.com/tmp/go-build2069436726/b514/launcher.test /tmp/go-build2069436726/b514/launcher.test -test.testlogfile=/tmp/go-build2069436726/b514/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W .cfg 8221058/b288/ x_amd64/vet . --gdwarf2(dns block)this-host-does-not-exist-12345.com/tmp/go-build2069436726/b523/mcp.test /tmp/go-build2069436726/b523/mcp.test -test.testlogfile=/tmp/go-build2069436726/b523/testlog.txt -test.paniconexit0 -test.timeout=10m0s 8221�� .cfg ache/go/1.25.8/x64/src/database/sql/driver/driver.go x_amd64/vet --gdwarf-5 g/grpc/credentia/usr/bin/runc -o x_amd64/vet .cfg�� k3QZ/k0KRG1xFvJtggzT2k3QZ -trimpath x_amd64/vet -p 8221058/b468/ -lang=go1.16 x_amd64/vet(dns block)If you need me to access, download, or install something from one of these locations, you can either: