fix: respect --allowedTools when building disallowed tools list#1033
Open
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
Open
fix: respect --allowedTools when building disallowed tools list#1033MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
MaxwellCalkin wants to merge 1 commit intoanthropics:mainfrom
Conversation
In agent mode, WebSearch and WebFetch are now properly disabled by default via --disallowedTools, consistent with tag mode's security posture. When users explicitly allow these tools via --allowedTools in claude_args, they are removed from the disallowed list. Fixes anthropics#690 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
Fixes #690
WebSearchandWebFetchwere not being explicitly disabled via--disallowedTools, inconsistent with tag mode's security behavior--allowedTools WebSearchinclaude_args, it had no effect on the disallowed tools list becausebuildDisallowedToolsString()was never called in agent modebuildDisallowedToolsString([], allowedTools)inprepareAgentMode()so that WebSearch/WebFetch are disabled by default, but respected when the user explicitly allows themChanges
src/modes/agent/index.ts: Import and callbuildDisallowedToolsString()with the parsedallowedToolsfromclaude_args, adding--disallowedToolstoclaudeArgswhen tools need to be disabledtest/modes/agent.test.ts: Updated existing test and added two new tests:--allowedTools WebSearchremoves only WebSearch from the disallowed list (WebFetch remains)--allowedTools WebSearch,WebFetchremoves both, resulting in no--disallowedToolsflagTest plan
--allowedTools WebSearchremoves WebSearch from disallowed list--allowedTools WebSearch,WebFetchremoves both from disallowed listclaude_args: '--allowedTools "WebSearch"'and confirm WebSearch is available🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com