Repository navigation
Deduplicate per-server allowlist membership checks - #17013
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE
No writes leaked on any surface that was reachable; the inconclusive rows are coverage gaps, not failures.
|
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change centralizing per-server allowlist checks.
No open issues 🎉
What changed in this PR
Centralizes per-server allowlist checks in MCP Gateway, addressing #16982 without changing tool or prompt enforcement or block logging.
Changes:
- Adds a shared helper that allows missing or nil sets and checks boolean membership for non-nil sets.
- Updates tool and prompt checks to use the helper while retaining separate allowlists and log messages.
- Adds regression tests for default behavior, empty sets, false entries, and server/allowlist isolation.
| File | Description |
|---|---|
| internal/server/tool_registry_helpers.go | Adds the shared allowlist lookup helper. |
| internal/server/prompt_call.go | Delegates prompt checks to the helper. |
| internal/server/backend_call.go | Delegates tool checks to the helper. |
| internal/server/allowed_sets_test.go | Covers lookup semantics and allowlist isolation. |
Review effort: Max (adaptive)
isToolAllowedandisPromptAllowedduplicate the same lookup policy. This refactor centralizes that policy without changing enforcement or block logs.allowedByServerSetalongside the allowlist builders. Missing or nil sets allow all; non-nil sets use boolean membership, so empty sets deny all.