feat(security): per-tool blocking for unsafe tools (#1623) - #1719
Open
vrindabhandari wants to merge 8 commits into
Open
feat(security): per-tool blocking for unsafe tools (#1623)#1719vrindabhandari wants to merge 8 commits into
vrindabhandari wants to merge 8 commits into
Conversation
…blocking # Conflicts: # auth_server/server.py # tests/unit/api/test_server_routes.py
vrindabhandari
marked this pull request as ready for review
September 2, 2026 23:52
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
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 #1623 (backend enforcement; UI to follow)
What this does
Implements opt-in per-tool blocking per the behavior model in the issue. When
allow_unsafe_serversis enabled, a server with HIGH/CRITICAL findings registers as enabled with its unsafe tools individually blocked, rather than the whole server being disabled. Default-off, so existing deployments are unaffected.ToolOverrideschemaset_tool_blockedservice method with Mongo key validationPOST /toggle-tool/{service_path}admin routetools/call(403 for blocked tools)Scope
Backend enforcement only. Agreed with @aarora79 to land this first and do the UI as a separate PR. Deliberately left for that follow-up:
include_blockedflagging onGET /api/toolsKnown limitation: rename evasion
Blocks are keyed on tool name. A server that renames a blocked tool presents a name that isn't in the blocklist, so it passes both the
tools/listfilter andtools/callenforcement until the next scan reconciles. Auto-blocks self-heal onrescan; admin-set blocks are the exposed case.
Raised by @Santoshkumarpuppala on the issue. His content-hash suggestion includes the tool name in the hash, which a rename also changes — so it matches on neither name nor hash. The stronger version is his second point: treat an unrecognized tool name on a server that already has scan state as unscanned and fail closed. The tool then doesn't need to match a block, it needs to have been scanned, which closes the rename path regardless of the tool body. Consistent with the fail-closed posture already in
validate_server_tool_access.Testing
TestToggleToolandTestReconcileSecurityBlockscover the route and the reconciliation matrix (auto-block applied, stale auto-block cleared, admin block survives clean rescan, admin unblock not re-blocked). Merged current main; full suite green (7389 passed, 31 skipped).