Commit 24416ef
authored
Support wildcard
`buildAllowedToolSets()` treats every entry in the `Tools` list as a
literal tool name. When the gh-aw compiler emits `tools: ["*"]`, no tool
matches the literal string `"*"`, so all tools get filtered out.
### Changes
- **`internal/server/unified.go`**: `buildAllowedToolSets` now detects
`"*"` anywhere in the tools list via a `hasWildcard()` helper. Wildcard
servers are skipped (not added to the filter map), same as servers with
no `Tools` config. Logs `[allowed-tools] Wildcard "*" configured for
<serverID>: allowing all tools` when triggered.
- **Tests**: Wildcard cases added to `TestIsToolAllowed` table, plus new
`TestBuildAllowedToolSets_WildcardStar`,
`TestBuildAllowedToolSets_WildcardMixed`, `TestIsToolAllowed_Wildcard`,
and `TestRegisterToolsFromBackend_WildcardAllowsAll`.
```go
// Before: ["*"] builds a set with literal "*" key — nothing matches
// After:
if hasWildcard(serverCfg.Tools) {
logger.LogInfo("backend", "[allowed-tools] Wildcard \"*\" configured for %s: allowing all tools", serverID)
continue
}
```
> [!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-build1981761529/b514/launcher.test
/tmp/go-build1981761529/b514/launcher.test
-test.testlogfile=/tmp/go-build1981761529/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s 9420�� 9420830/b336/_pkg_.a
pkg/mod/github.com/tetratelabs/wazero@v1.11.0/in-ifaceassert x_amd64/vet
--gdwarf-5 .io/otel/sdk/res-V=full -o x_amd64/vet` (dns block)
> - `invalid-host-that-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build1981761529/b496/config.test
/tmp/go-build1981761529/b496/config.test
-test.testlogfile=/tmp/go-build1981761529/b496/testlog.txt
-test.paniconexit0 -test.timeout=10m0s -w PXs3z5Xin .cfg
64/pkg/tool/linux_amd64/vet -c
.io/otel/attribu/tmp/go-build2334098856/b305/vet.cfg
/tmp/go-build3709420830/b148/ 64/pkg/tool/linux_amd64/vet ache��
olang.org/grpc@v1.80.0/channelz/channelz.go .cfg
64/pkg/tool/linux_amd64/vet --gdwarf-5 --64 -o
64/pkg/tool/linux_amd64/vet` (dns block)
> - `nonexistent.local`
> - Triggering command: `/tmp/go-build1981761529/b514/launcher.test
/tmp/go-build1981761529/b514/launcher.test
-test.testlogfile=/tmp/go-build1981761529/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s 9420�� 9420830/b336/_pkg_.a
pkg/mod/github.com/tetratelabs/wazero@v1.11.0/in-ifaceassert x_amd64/vet
--gdwarf-5 .io/otel/sdk/res-V=full -o x_amd64/vet` (dns block)
> - `slow.example.com`
> - Triggering command: `/tmp/go-build1981761529/b514/launcher.test
/tmp/go-build1981761529/b514/launcher.test
-test.testlogfile=/tmp/go-build1981761529/b514/testlog.txt
-test.paniconexit0 -test.timeout=10m0s 9420�� 9420830/b336/_pkg_.a
pkg/mod/github.com/tetratelabs/wazero@v1.11.0/in-ifaceassert x_amd64/vet
--gdwarf-5 .io/otel/sdk/res-V=full -o x_amd64/vet` (dns block)
> - `this-host-does-not-exist-12345.com`
> - Triggering command: `/tmp/go-build1981761529/b523/mcp.test
/tmp/go-build1981761529/b523/mcp.test
-test.testlogfile=/tmp/go-build1981761529/b523/testlog.txt
-test.paniconexit0 -test.timeout=10m0s` (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>["*"] in allowed-tools filtering (#3445)File tree
3 files changed
+101
-1
lines changed- internal/server
3 files changed
+101
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
466 | 548 | | |
467 | 549 | | |
468 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| 402 | + | |
| 403 | + | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
381 | | - | |
| 381 | + | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
385 | 386 | | |
386 | 387 | | |
387 | 388 | | |
388 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
389 | 395 | | |
390 | 396 | | |
391 | 397 | | |
| |||
396 | 402 | | |
397 | 403 | | |
398 | 404 | | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
399 | 415 | | |
400 | 416 | | |
401 | 417 | | |
| |||
0 commit comments