Tool-name shadowing across aggregated servers
Description
When aggregating multiple backend servers, tool names share a flat namespace with no per-server scoping or collision check, so one server can shadow another's tool name (last-writer-wins).
Details
Tool names are built from each backend server's tools/list response. The name prefix is empty unless a per-server prefix is set or the gateway-level tool-name-prefix feature is enabled (off by default). The aggregation loop (reload.go) registers every server's tools into one flat map (toolRegistrations) keyed by raw tool name with no collision check, so two servers advertising the same name resolve last-writer-wins. An untrusted aggregated server can shadow a trusted server's tool name; subsequent calls (and their arguments, which may include credentials) are silently dispatched to the shadowing server.
Impact
Arguments or secrets passed to a shadowed tool are delivered to the shadowing server instead of the intended one, with no error or warning. Aggregating an untrusted server alongside a trusted one is enough to leak credentials.
Preconditions
- The gateway aggregates an untrusted server alongside a trusted one, with no per-server tool-name prefix configured.
Workarounds
- Set a per-server tool-name prefix for aggregated servers (or enable the tool-name-prefix feature).
- Only aggregate trusted servers.