MCP: upgrade mcp/sdk 0.8.1 to 0.9+ (GHSA-f4rf-6ghj-mhr6; breaking auth API) #138

Open
opened 2026-11-29 00:17:13 -05:00 by jared · 0 comments
Owner

composer audit (being added to CI in #136) flags mcp/sdk 0.8.1 with GHSA-f4rf-6ghj-mhr6 (low): "OAuth middleware endpoints bypass request body limits and allow unauthenticated memory exhaustion". It affects 0.8.0 to 0.8.1 and is fixed in 0.9.0.

Is Tinker exposed?

No, as far as I can tell. The advisory is about the SDK's /token endpoint (OAuthProxyMiddleware) and /register endpoint (ClientRegistrationMiddleware) reading request bodies without the transport's 4 MiB limit. mcp/server.php uses neither. Its middleware is:

  • ProtectedResourceMetadataMiddleware
  • AuthorizationMiddleware, with JwtTokenValidator, JwksProvider and OidcDiscovery against Authelia
  • CorsMiddleware
  • DnsRebindingProtectionMiddleware

Tokens come from Authelia, never from Tinker. Until the upgrade, CI's composer audit ignores this one advisory, with that reason recorded in composer.json.

Why it isn't a one-line bump

0.9.0 narrows authorization to the resource-server role, with several BC breaks in exactly the classes Tinker uses (from the 0.9.0 release notes):

  • JwksProvider, JwksProviderInterface and OidcDiscoveryInterface are removed, and OidcDiscovery becomes internal.
  • JwtTokenValidator becomes final:
    • it takes a single issuer and a key set, or JwtTokenValidator::fromIssuer(), which caches keys in a PSR-6 pool;
    • requireScopes() is replaced by ScopePolicy.
  • AuthorizationMiddleware takes a ScopePolicy, which answers 403 insufficient_scope per method and tool. This replaces the read/write split in ToolCatalog.
  • ProtectedResourceMetadata requires $resource and serves at the RFC 9728 path derived from it.
  • DnsRebindingProtectionMiddleware gets a separate allowedOrigins, which is empty by default.
  • OAuthRequestMetaMiddleware is replaced by RequestContext::getAccessToken(), which affects how McpIdentity gets the user.
  • 0.10.0 also moves namespaces: Mcp\Server becomes Mcp\Server\Server, and Mcp\Capability\* moves to Mcp\Server\Capability\*.

What to do

  • Upgrade to 0.9.x, or straight to 0.10.x, and port mcp/server.php, mcp/src/Auth/* and ToolCatalog:
    • express the read/write tool split as a ScopePolicy (tickets:read / tickets:write);
    • get the user from RequestContext::getAccessToken().
  • Keep the discovery document identical: same resource, authorization_servers and scopes_supported at /.well-known/oauth-protected-resource/mcp, so existing Claude Code logins keep working.
  • Tests:
    • tests/api/mcp_test.php (#136) for the tools;
    • an HTTP-level check of /mcp: no token gives 401 with a resource_metadata challenge; an unknown kid gives 401 invalid_token; a read-scope token calling a write tool gives 403.
  • Remove the audit.ignore entry from composer.json.
  • Update the wiki MCP pages (see the docs-sync list).

Related: #136 (CI standard), #137 (the symfony/http-client advisories, a patch bump).

🤖 Generated with Claude Code

`composer audit` (being added to CI in #136) flags `mcp/sdk` 0.8.1 with **GHSA-f4rf-6ghj-mhr6** (low): "OAuth middleware endpoints bypass request body limits and allow unauthenticated memory exhaustion". It affects 0.8.0 to 0.8.1 and is fixed in 0.9.0. ## Is Tinker exposed? **No, as far as I can tell.** The advisory is about the SDK's `/token` endpoint (`OAuthProxyMiddleware`) and `/register` endpoint (`ClientRegistrationMiddleware`) reading request bodies without the transport's 4 MiB limit. `mcp/server.php` uses neither. Its middleware is: - `ProtectedResourceMetadataMiddleware` - `AuthorizationMiddleware`, with `JwtTokenValidator`, `JwksProvider` and `OidcDiscovery` against Authelia - `CorsMiddleware` - `DnsRebindingProtectionMiddleware` Tokens come from Authelia, never from Tinker. Until the upgrade, CI's `composer audit` ignores this one advisory, with that reason recorded in `composer.json`. ## Why it isn't a one-line bump 0.9.0 narrows authorization to the resource-server role, with several BC breaks in exactly the classes Tinker uses (from the 0.9.0 release notes): - `JwksProvider`, `JwksProviderInterface` and `OidcDiscoveryInterface` are removed, and `OidcDiscovery` becomes internal. - `JwtTokenValidator` becomes final: - it takes a single issuer and a key set, or `JwtTokenValidator::fromIssuer()`, which caches keys in a PSR-6 pool; - `requireScopes()` is replaced by `ScopePolicy`. - `AuthorizationMiddleware` takes a `ScopePolicy`, which answers `403 insufficient_scope` per method and tool. This replaces the read/write split in `ToolCatalog`. - `ProtectedResourceMetadata` requires `$resource` and serves at the RFC 9728 path derived from it. - `DnsRebindingProtectionMiddleware` gets a separate `allowedOrigins`, which is empty by default. - `OAuthRequestMetaMiddleware` is replaced by `RequestContext::getAccessToken()`, which affects how `McpIdentity` gets the user. - 0.10.0 also moves namespaces: `Mcp\Server` becomes `Mcp\Server\Server`, and `Mcp\Capability\*` moves to `Mcp\Server\Capability\*`. ## What to do - [ ] Upgrade to 0.9.x, or straight to 0.10.x, and port `mcp/server.php`, `mcp/src/Auth/*` and `ToolCatalog`: - express the read/write tool split as a `ScopePolicy` (`tickets:read` / `tickets:write`); - get the user from `RequestContext::getAccessToken()`. - [ ] Keep the discovery document identical: same `resource`, `authorization_servers` and `scopes_supported` at `/.well-known/oauth-protected-resource/mcp`, so existing Claude Code logins keep working. - [ ] **Tests:** - `tests/api/mcp_test.php` (#136) for the tools; - an HTTP-level check of `/mcp`: no token gives 401 with a `resource_metadata` challenge; an unknown `kid` gives 401 `invalid_token`; a read-scope token calling a write tool gives 403. - [ ] Remove the `audit.ignore` entry from `composer.json`. - [ ] Update the wiki MCP pages (see the docs-sync list). Related: #136 (CI standard), #137 (the symfony/http-client advisories, a patch bump). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/tinker_tickets#138