Skip to content

SessionIdentityInterceptor

Rasuvaeff\Yii3McpRbacBridge\SessionIdentityInterceptor

ClassRasuvaeff\Yii3McpRbacBridgeSource

Binds the MCP session to the identity that first used it and rejects any request presenting the same Mcp-Session-Id with a different identity — without this, a leaked session id plus the attacker's own valid token rides the victim's session.

The binding happens on the first intercepted tools/call (the core interceptor chain does not see initialize); a guest binds as a guest. Run this OUTERMOST — before RBAC and anything that trusts the session.

Methods

intercept()

php
intercept(Interceptor\ToolCallContext $context, callable $next): mixed