Repository navigation
feat(server): add support for restricting sources and tools via env vars - #4409
Draft
AlexTalreja wants to merge 3 commits into
Draft
AlexTalreja wants to merge 3 commits into
AlexTalreja wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces configuration restrictions based on environment variables (TOOLBOX_ALLOWED_SOURCES and TOOLBOX_DISALLOWED_TOOLS) to validate source and tool types before any connections are initialized. It includes a new restrictions.go file, comprehensive unit tests in restrictions_test.go, and integrates the validation check into InitializeConfigs in server.go. The feedback recommends normalizing parsed types to lowercase to ensure case-insensitive matching, along with updating the corresponding test cases to verify this behavior.
AlexTalreja
force-pushed
the
restrict-sources-and-tools
branch
from
November 4, 2026 20:49
7dca979 to
53856a2
Compare
AlexTalreja
force-pushed
the
restrict-sources-and-tools
branch
3 times, most recently
from
November 5, 2026 21:29
fea3dac to
f512730
Compare
AlexTalreja
force-pushed
the
restrict-sources-and-tools
branch
from
November 5, 2026 22:24
f512730 to
1c78faa
Compare
This branch has not been deployed
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.
Description
Adds two opt-in environment variables that limit which source and tool types Toolbox will load:
TOOLBOX_ALLOWED_SOURCES: comma-separated allowlist of source typesTOOLBOX_DISALLOWED_TOOLS: comma-separated denylist of tool typesThe check runs in
InitializeConfigs()before any source opens a connection. If the config uses a disallowed type, Toolbox fails to start with one error that lists every violation. Because the check is in InitializeConfigs(), it covers startup,--prebuilt, hot reload andinvoke. When neither variable is set, nothing is restricted.