Commit 4c7872d
authored
Add pre-emptive guard entries for 3 CLI write operations missing from WRITE_OPERATIONS (#3609)
Three GitHub CLI write operations had no guard coverage — meaning if a
corresponding MCP tool lands in github-mcp-server, it would pass through
unclassified. All three are high/medium risk operations involving repo
settings, PR reversion, and SSH key grants.
### `tools.rs` — WRITE_OPERATIONS additions
- `edit_repository` — `PATCH /repos/{owner}/{repo}`; can flip visibility
private→public
- `revert_pull_request` — GraphQL `revertPullRequest`; creates branch +
PR
- `add_deploy_key` / `delete_deploy_key` — `POST/DELETE
/repos/{owner}/{repo}/keys`; grants persistent SSH access
### `tool_rules.rs` — DIFC label rules
```rust
"edit_repository" => {
secrecy = apply_repo_visibility_secrecy(&owner, &repo, repo_id, secrecy, ctx);
integrity = writer_integrity(repo_id, ctx);
}
"revert_pull_request" => {
secrecy = apply_repo_visibility_secrecy(&owner, &repo, repo_id, secrecy, ctx);
integrity = writer_integrity(repo_id, ctx);
}
"add_deploy_key" | "delete_deploy_key" => {
// Always private regardless of repo visibility — deploy key secrets are sensitive
secrecy = policy_private_scope_label(&owner, &repo, repo_id, ctx);
integrity = writer_integrity(repo_id, ctx);
}
```
Deploy key operations use `policy_private_scope_label` unconditionally
(not `apply_repo_visibility_secrecy`) since the key material itself is
always sensitive regardless of whether the repo is public.
> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `example.com`
> - Triggering command: `/tmp/go-build3092088994/b514/launcher.test
/tmp/go-build3092088994/b514/launcher.test
-test.testlogfile=/tmp/go-build3092088994/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -W .cfg
Bmen/MKrSXkkW-_Q-ifaceassert x_amd64/vet . --gdwarf2 --64 x_amd64/vet
9006�� .cfg olang.org/grpc@v1.80.0/internal/transport/client_stream.go
x_amd64/vet --gdwarf-5 g/grpc/attribute-qE -o x_amd64/vet` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build3092088994/b496/config.test
/tmp/go-build3092088994/b496/config.test
-test.testlogfile=/tmp/go-build3092088994/b496/testlog.txt
-test.paniconexit0 -test.timeout=10m0s
/tmp/go-build3092088994/b323/vet.cfg 5.0/deviceauth.g-errorsas
5.0/oauth2.go x_amd64/vet --gdwarf-5 nal/protolazy -o x_amd64/vet -I
g_.a -I x_amd64/vet --gdwarf-5 go-sdk/auth -o x_amd64/vet` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build3092088994/b514/launcher.test
/tmp/go-build3092088994/b514/launcher.test
-test.testlogfile=/tmp/go-build3092088994/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -W .cfg
Bmen/MKrSXkkW-_Q-ifaceassert x_amd64/vet . --gdwarf2 --64 x_amd64/vet
9006�� .cfg olang.org/grpc@v1.80.0/internal/transport/client_stream.go
x_amd64/vet --gdwarf-5 g/grpc/attribute-qE -o x_amd64/vet` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build3092088994/b514/launcher.test
/tmp/go-build3092088994/b514/launcher.test
-test.testlogfile=/tmp/go-build3092088994/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -W .cfg
Bmen/MKrSXkkW-_Q-ifaceassert x_amd64/vet . --gdwarf2 --64 x_amd64/vet
9006�� .cfg olang.org/grpc@v1.80.0/internal/transport/client_stream.go
x_amd64/vet --gdwarf-5 g/grpc/attribute-qE -o x_amd64/vet` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build3092088994/b523/mcp.test
/tmp/go-build3092088994/b523/mcp.test
-test.testlogfile=/tmp/go-build3092088994/b523/testlog.txt
-test.paniconexit0 -test.timeout=10m0s
/tmp/go-build3092088994/b517/_pkg_.a
elemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.43.0/internal/otlpconfig/envconfig.go/usr/bin/runc.original
elemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp@v1.43.0/internal/otlpconfig/options.go
x_amd64/vet --gdwarf-5 g/grpc/internal -o x_amd64/vet -obj�� .cfg
-importpath x_amd64/vet -ldflags="-O2"
"/usr/libexec/docker/docker-init ecosystem/grpc-g--version -I
x_amd64/vet` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/github/gh-aw-mcpg/settings/copilot/coding_agent)
(admins only)
>
> </details>File tree
3 files changed
+128
-0
lines changed- guards/github-guard/rust-guard/src
- labels
3 files changed
+128
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4712 | 4712 | | |
4713 | 4713 | | |
4714 | 4714 | | |
| 4715 | + | |
| 4716 | + | |
| 4717 | + | |
| 4718 | + | |
| 4719 | + | |
| 4720 | + | |
| 4721 | + | |
| 4722 | + | |
| 4723 | + | |
| 4724 | + | |
| 4725 | + | |
| 4726 | + | |
| 4727 | + | |
| 4728 | + | |
| 4729 | + | |
| 4730 | + | |
| 4731 | + | |
| 4732 | + | |
| 4733 | + | |
| 4734 | + | |
| 4735 | + | |
| 4736 | + | |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
| 4758 | + | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + | |
| 4768 | + | |
| 4769 | + | |
| 4770 | + | |
| 4771 | + | |
| 4772 | + | |
| 4773 | + | |
| 4774 | + | |
| 4775 | + | |
| 4776 | + | |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
| 4781 | + | |
| 4782 | + | |
| 4783 | + | |
| 4784 | + | |
| 4785 | + | |
| 4786 | + | |
| 4787 | + | |
| 4788 | + | |
| 4789 | + | |
| 4790 | + | |
| 4791 | + | |
| 4792 | + | |
| 4793 | + | |
| 4794 | + | |
4715 | 4795 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
644 | 644 | | |
645 | 645 | | |
646 | 646 | | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
647 | 672 | | |
648 | 673 | | |
649 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
210 | 217 | | |
211 | 218 | | |
212 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
213 | 236 | | |
214 | 237 | | |
215 | 238 | | |
| |||
0 commit comments