Conversation
…in GitHub guard Agent-Logs-Url: https://github.com/github/gh-aw-mcpg/sessions/2b4d0d1c-031e-4164-bfd6-507ba2f3429e Co-authored-by: lpcox <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds missing guard coverage for several GitHub CLI write operations by labeling pin_issue / unpin_issue as repo-scoped writes and enforcing an unconditional deny policy for transfer_repository via a blocked-integrity override in label_resource.
Changes:
- Extend tool classification with
pin_issue,unpin_issue, andtransfer_repository, plus newis_blocked_tool()gating. - Add
apply_tool_labelsrules for pin/unpin (repo visibility secrecy + writer integrity) and transfer_repository (repo visibility secrecy). - Enforce blocked integrity in
label_resourcepost-baseline and add unit/integration tests to prove the override survivesensure_integrity_baseline.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| guards/github-guard/rust-guard/src/tools.rs | Adds new write ops and is_blocked_tool() with unit tests. |
| guards/github-guard/rust-guard/src/lib.rs | Overrides integrity to blocked_integrity for blocked tools after baseline enforcement; adds test. |
| guards/github-guard/rust-guard/src/labels/tool_rules.rs | Labels pin_issue/unpin_issue as writer-integrity repo writes; applies secrecy for transfer_repository. |
| guards/github-guard/rust-guard/src/labels/mod.rs | Adds unit tests for new apply_tool_labels behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| } | ||
| secrecy = apply_repo_visibility_secrecy(&owner, &repo, repo_id, secrecy, ctx); | ||
| integrity = writer_integrity(repo_id, ctx); |
There was a problem hiding this comment.
In the new pin_issue / unpin_issue arm, integrity = writer_integrity(repo_id, ctx) is applied unconditionally. If repo_id is empty (e.g., malformed/missing owner+repo in tool_args), writer_integrity("") produces unscoped base labels including "approved" (see existing test_empty_scope_integrity in labels/mod.rs), which is broader than intended for a repo-scoped operation. Please gate this so writer integrity is only assigned when repo_id is non-empty; otherwise keep/return a conservative integrity (e.g., leave as-is/empty so the baseline becomes none). Adding a regression test for the empty-scope case would help prevent accidental global approval.
| integrity = writer_integrity(repo_id, ctx); | |
| if !repo_id.is_empty() { | |
| integrity = writer_integrity(repo_id, ctx); | |
| } else { | |
| // Malformed or missing repo scope: avoid assigning unscoped writer integrity. | |
| // Use an empty integrity baseline so no global approval is implied. | |
| integrity.clear(); | |
| } |
Three GitHub CLI write operations had no guard coverage.
pin_issueandunpin_issueneeded standard write-op labeling;transfer_repository(irreversible ownership transfer) must never be agent-executable and is unconditionally blocked.Changes
tools.rspin_issue,unpin_issue,transfer_repositorytoWRITE_OPERATIONSis_blocked_tool()function — currently gatestransfer_repositorytool_rules.rs—apply_tool_labelspin_issue/unpin_issue: repo-visibility secrecy +writer_integrity(repo-level cosmetic write)transfer_repository: repo-visibility secrecy only; integrity enforcement delegated tolabel_resourcelib.rs—label_resourceAdded a post-
ensure_integrity_baselineoverride: ifis_blocked_tool()is true, integrity is forced toblocked_integrity. This is necessary becauseensure_integrity_baselinewould otherwise promoteblocked:tags up tonone:.Tests
is_blocked_toolunit tests intools.rsapply_tool_labelstests forpin_issue/unpin_issue(writer integrity) andtransfer_repository(secrecy)lib.rstests that the override survivesensure_integrity_baselineWarning
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-build3725800994/b330/launcher.test /tmp/go-build3725800994/b330/launcher.test -test.testlogfile=/tmp/go-build3725800994/b330/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true g_.a 0JyzvQ--L cal/bin/cc z_oxide-92023c1c/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile 5519 .13/x64/bin/git bash ortc�� 64/src/runtime/c-p v0Q-HlWws ache/go/1.25.8/x-lang=go1.24 k/gh-aw-mcpg/gh-/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet k/gh-aw-mcpg/gh--atomic guard-d6a03f414d-bool 01.o(dns block)/tmp/go-build3217884824/b334/launcher.test /tmp/go-build3217884824/b334/launcher.test -test.testlogfile=/tmp/go-build3217884824/b334/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W 5800994/b228/_pkdebuginfo=2 /tmp/go-build372-C ache/go/1.25.8/xdebug-assertions=on . b/gh-aw-mcpg/int-unsafeptr=false --64 ache/go/1.25.8/x--check-cfg -I 5800994/b315/_pkg_.a -I docker-buildx --gdwarf-5 --64 -o docker-buildx(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build3725800994/b315/config.test /tmp/go-build3725800994/b315/config.test -test.testlogfile=/tmp/go-build3725800994/b315/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -c=4 -nolocalimports -importcfg /tmp/go-build3725800994/b245/importcfg -pack /home/REDACTED/go/pkg/mod/github.com/tetratelabs/[email protected]/builder.go /home/REDACTED/go/pkg/mod/github.com/tetratelabs/[email protected]/cache.go ortc�� g_.a 64/src/internal/coverage/rtcov/r-I ache/go/1.25.8/x64/pkg/tool/linu/tmp/go-build3725800994/b165/ core-10e2da29e93/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile abis stup/toolchains//tmp/go-build3725800994/b196/_pkg_.a ache/go/1.25.8/x-trimpath(dns block)/tmp/go-build3217884824/b319/config.test /tmp/go-build3217884824/b319/config.test -test.testlogfile=/tmp/go-build3217884824/b319/testlog.txt -test.paniconexit0 -test.timeout=10m0s .19a�� .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19a�� .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .19alb25.rcgu.o .0655h1b.rcgu.o .0655h1b.rcgu.o .0655h1b.rcgu.o(dns block)nonexistent.local/tmp/go-build3725800994/b330/launcher.test /tmp/go-build3725800994/b330/launcher.test -test.testlogfile=/tmp/go-build3725800994/b330/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true g_.a 0JyzvQ--L cal/bin/cc z_oxide-92023c1c/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile 5519 .13/x64/bin/git bash ortc�� 64/src/runtime/c-p v0Q-HlWws ache/go/1.25.8/x-lang=go1.24 k/gh-aw-mcpg/gh-/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet k/gh-aw-mcpg/gh--atomic guard-d6a03f414d-bool 01.o(dns block)/tmp/go-build3217884824/b334/launcher.test /tmp/go-build3217884824/b334/launcher.test -test.testlogfile=/tmp/go-build3217884824/b334/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W 5800994/b228/_pkdebuginfo=2 /tmp/go-build372-C ache/go/1.25.8/xdebug-assertions=on . b/gh-aw-mcpg/int-unsafeptr=false --64 ache/go/1.25.8/x--check-cfg -I 5800994/b315/_pkg_.a -I docker-buildx --gdwarf-5 --64 -o docker-buildx(dns block)slow.example.com/tmp/go-build3725800994/b330/launcher.test /tmp/go-build3725800994/b330/launcher.test -test.testlogfile=/tmp/go-build3725800994/b330/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true g_.a 0JyzvQ--L cal/bin/cc z_oxide-92023c1c/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile 5519 .13/x64/bin/git bash ortc�� 64/src/runtime/c-p v0Q-HlWws ache/go/1.25.8/x-lang=go1.24 k/gh-aw-mcpg/gh-/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet k/gh-aw-mcpg/gh--atomic guard-d6a03f414d-bool 01.o(dns block)/tmp/go-build3217884824/b334/launcher.test /tmp/go-build3217884824/b334/launcher.test -test.testlogfile=/tmp/go-build3217884824/b334/testlog.txt -test.paniconexit0 -test.timeout=10m0s -W 5800994/b228/_pkdebuginfo=2 /tmp/go-build372-C ache/go/1.25.8/xdebug-assertions=on . b/gh-aw-mcpg/int-unsafeptr=false --64 ache/go/1.25.8/x--check-cfg -I 5800994/b315/_pkg_.a -I docker-buildx --gdwarf-5 --64 -o docker-buildx(dns block)this-host-does-not-exist-12345.com/tmp/go-build3725800994/b339/mcp.test /tmp/go-build3725800994/b339/mcp.test -test.testlogfile=/tmp/go-build3725800994/b339/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 64/src/runtime/cgo erive-f8a9da973ea849b8.serde_der--64 x_amd64/vet erive-f8a9da973ebash int erive-f8a9da973e--version x_amd64/vet ache�� ternal/sysfs/adapter.go ternal/sysfs/datasync_linux.go x_amd64/compile erive-f8a9da973egrep erive-f8a9da973e-qE -Wl,-Bstatic x_amd64/compile(dns block)/tmp/go-build3217884824/b343/mcp.test /tmp/go-build3217884824/b343/mcp.test -test.testlogfile=/tmp/go-build3217884824/b343/testlog.txt -test.paniconexit0 -test.timeout=10m0s -gua�� -guard/target/debug/deps/github_guard-d6a03f414dc506a0.2j8pqcxyyfybe7nghv8aqe5ar.158bmhb.rcgu.o -guard/target/debug/deps/github_guard-d6a03f414dc506a0.2qy5imqpflz26hi4smzxan76o.158bmhb.rcgu.o ache/go/1.25.8/x64/pkg/tool/linunow ive.291b3f11bb18/opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet ive.291b3f11bb18-V=full x_amd64/compile ache/go/1.25.8/x64/pkg/tool/linu-o -uns�� ithub-guard/rust-guard/target/debug/deps/rustc7pSDMJ/symbols.o ithub-guard/rust-guard/target/debug/deps/github_guard-d6a03f414dc506a0.0bxgpkkxlbr5ndvint8fbouk8/usr/bin/runc ithub-guard/rust-guard/target/debug/deps/github_guard-d6a03f414dc506a0.0jw880073obtnc1lrfavrjkde--version ithub-guard/rustrunc ithub-guard/rust--version ithub-guard/rust-guard/target/de/tmp/go-build1931372066/b003/vet.cfg ithub-guard/rust-guard/target/debug/deps/github_guard-d6a03f414dc506a0.1b9hao6thyobgm5waptlklsec.158bmhb.rcgu.o(dns block)If you need me to access, download, or install something from one of these locations, you can either:
⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.