fix(permissions): hide denied tools from API schema#317
Open
panDing19 wants to merge 1 commit into
Open
Conversation
7bc821f to
d100174
Compare
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
Problem:
permission.denied_toolsonly blocked tools at execution time. The query loop still sent every registered tool schema to the model, so denied tools stayed visible and the model could select tools that would immediately be rejected byPermissionChecker.Change:
ToolRegistry.to_api_schema()now accepts an optionaldenied_toolsfilter,PermissionCheckerexposes its denied tool names as a read-only tuple, andrun_query()applies that filter before sending tool schemas to the API. Execution-time permission checks remain unchanged as the enforcement backstop.Added regression coverage for both the registry filter and the query engine request payload, and added an
Unreleasedchangelog entry for the user-visible permissions behavior change.Validation
uv run ruff check src tests scriptsuv run pytest -q—1155 passed, 6 skippedwhen run with inheritedANTHROPIC_AUTH_TOKEN/ANTHROPIC_BASE_URLcleared so auth tests are not biased by the local Codex session environment.cd frontend/terminal && npx tsc --noEmit— not applicable; no frontend files touched.Notes