fix: visibility and admin scope hardening and behavior consistency h-batch-4#3111
Merged
crivetimihai merged 5 commits intomainfrom Feb 23, 2026
Merged
fix: visibility and admin scope hardening and behavior consistency h-batch-4#3111crivetimihai merged 5 commits intomainfrom
crivetimihai merged 5 commits intomainfrom
Conversation
…-22 C-24 C-27 C-32 C-23) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
…C-24) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
…paths Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
vishu-bh
pushed a commit
that referenced
this pull request
Feb 24, 2026
…3111) * fix: visibility and admin scope hardening and behavior consistency (C-22 C-24 C-27 C-32 C-23) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * chore: docstring completeness hardening and behavior consistency Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * test: scope regression coverage hardening and behavior consistency Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * fix: streamable completion scope hardening and behavior consistency (C-24) Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> * test: completion scope branch coverage hardening in rpc and protocol paths Signed-off-by: Mihai Criveti <crivetimihai@gmail.com> --------- Signed-off-by: Mihai Criveti <crivetimihai@gmail.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
This PR delivers Batch 4 hardening for scope/permission consistency and includes a small follow-up for docstring lint compliance.
Issue Breakdown
C-22: Tag discovery scope consistency
C-24: Completion scope consistency
/protocol/completion/completeand RPCcompletion/completeto pass scoped caller context into completion service.C-27: Admin middleware token-scope enforcement
teams=[]) as restricted for/admin/*.C-32: Granular admin token-scoping permissions
/admin/*routes.C-23: Verification and guard coverage
team_idin fallback auth path.Flake8 follow-up: DAR docstring completeness
Key Files Updated
mcpgateway/main.pymcpgateway/admin.pymcpgateway/middleware/token_scoping.pymcpgateway/services/completion_service.pymcpgateway/services/tag_service.pytests/unit/mcpgateway/test_main.pytests/unit/mcpgateway/test_main_extended.pytests/unit/mcpgateway/test_admin.pytests/unit/mcpgateway/test_auth.pytests/unit/mcpgateway/middleware/test_token_scoping.pytests/unit/mcpgateway/services/test_completion_service.pytests/unit/mcpgateway/services/test_tag_service.pyValidation
uv run pytest tests/unit/mcpgateway/test_main.py tests/unit/mcpgateway/test_main_extended.py tests/unit/mcpgateway/test_admin.py tests/unit/mcpgateway/test_auth.py tests/unit/mcpgateway/middleware/test_token_scoping.py tests/unit/mcpgateway/services/test_completion_service.py tests/unit/mcpgateway/services/test_tag_service.pyuv run pytest tests/unit/mcpgateway/services/test_tag_service.py tests/unit/mcpgateway/test_main.py::TestTagEndpoints tests/unit/mcpgateway/test_admin.py::test_admin_list_tags tests/unit/mcpgateway/test_admin.py::test_admin_list_tags_admin_bypass_contextuv run pytest tests/unit/mcpgateway/services/test_completion_service.py tests/unit/mcpgateway/test_main.py::TestProtocolEndpoints::test_handle_completion_endpoint tests/unit/mcpgateway/test_main.py::TestProtocolEndpoints::test_handle_completion_endpoint_admin_bypass tests/unit/mcpgateway/test_main.py::TestRPCEndpoints::test_rpc_completion_completeuv run pytest tests/unit/mcpgateway/test_main_extended.py::TestAdminAuthMiddleware::test_admin_auth_public_only_admin_token_denied tests/unit/mcpgateway/test_main_extended.py::TestAdminAuthMiddleware::test_admin_auth_explicit_null_teams_admin_bypass_alloweduv run pytest tests/unit/mcpgateway/middleware/test_token_scoping.py -k "admin_permissions_use_canonical_constants or regex_pattern_precision_admin"uv run pytest tests/unit/mcpgateway/test_auth.py::TestFallbackPathWithRequest::test_fallback_multi_team_api_token_does_not_set_single_team_idmake flake8