Fail closed on unknown toolsets in strict mode#2184
Open
macarronesc wants to merge 2 commits intogithub:mainfrom
Open
Fail closed on unknown toolsets in strict mode#2184macarronesc wants to merge 2 commits intogithub:mainfrom
macarronesc wants to merge 2 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a strict validation mode to the local (stdio) server startup path so misconfigured/unknown toolset names fail closed instead of only logging warnings, strengthening allow-list based deployments.
Changes:
- Add strict toolset validation to
pkg/inventorybuilder (error on unknown toolsets when enabled). - Thread strict validation configuration from CLI (
--strict-toolsets) throughghmcpinto inventory building. - Add unit/integration tests covering strict vs non-strict behavior and document the new mode in the server configuration guide.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/inventory/builder.go | Adds strict mode option and returns an error when unknown toolsets are configured under strict validation. |
| pkg/inventory/registry_test.go | Adds tests ensuring strict mode errors and non-strict mode records unknown toolsets. |
| pkg/github/server.go | Extends MCPServerConfig with StrictToolsetValidation to carry config through server creation. |
| internal/ghmcp/server.go | Passes strict validation setting into the inventory builder during stdio server creation. |
| internal/ghmcp/server_test.go | Adds coverage for stdio server strict vs non-strict startup behavior. |
| cmd/github-mcp-server/main.go | Introduces --strict-toolsets flag and wires it via viper into stdio config. |
| docs/server-configuration.md | Documents strict toolset validation behavior and provides a local-server config example. |
Author
|
Implemented, thanks for the feedback. Added strict toolset validation docs in README Tool Configuration with both --strict-toolsets and GITHUB_STRICT_TOOLSETS. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2117
Summary
This change adds explicit fail-closed validation for unknown toolset names when strict validation is enabled.
Unknown toolset names were already detected during inventory construction, but only surfaced as warnings. In stricter deployments that rely on explicit allow-lists, that can hide configuration mistakes and weaken the intended permission boundary.
Changes
Validation
Manual verification
Without strict validation:
With strict validation: