| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
[Server] Validate Host and Origin independently (#589) * Validate Host and Origin independently * Normalize allowedOrigins entries and clarify wildcard hosts --------- Co-authored-by: Christopher Hertel <mail@christopher-hertel.de> | 18 天前 | |
[Server] Narrow authorization to the resource server role (#532) * [Server] Narrow authorization to the resource server role * Remove OAuthProxyMiddleware, ClientRegistrationMiddleware and their interfaces (ADR 0002) * Replace OAuthRequestMetaMiddleware with RequestContext::getAccessToken() * Add ScopePolicy to AuthorizationMiddleware for 403 insufficient_scope step-up * JwtTokenValidator: final, CachedKeySet with refetch on unknown kid, alg allowlist, token type, leeway * ProtectedResourceMetadata: require resource, derive metadata path and challenge URL from it, enforce https * Expose WWW-Authenticate via CORS * [Server] Answer unresolvable token signing keys with 401 * [Server] Reject access tokens without exp * [Server] Discover issuer keys lazily, one key set per algorithm Keys without alg are tagged with the token's algorithm instead of the first allowed one. * [Server] Document the access token parameter BC breaks * [Server] Dedupe scopes on insert in ScopePolicy * [Server] Hand on implied scopes with the access token * [Server] Challenge other authorization schemes without error code * [Server] Explain bearer parsing and header escaping * [Server] Keep the resource query in the protected resource metadata URL * [Server] Cover SecureUrl and forbidden batch requests * [Docs] Document the AccessToken request attribute as integration seam * [Examples] Note that Entra step-up needs the prefixed scope * [Server] Require a numeric exp in access tokens * [Server] Expand the scope hierarchy once per request * [Server] Share scope validation between policy and metadata * [Server] Back off briefly after a failed OIDC discovery * [Server] Note the global leeway swap in JwtTokenValidator * [Server] Accept only https, or http on loopback hosts, in SecureUrl * [Server] Serve metadata of a queryless resource only without query * [Server] Restrict scopes to the RFC 6749 scope-token grammar * [Server] Keep the resource path verbatim in the metadata URL * [Server] Resolve the signing key before swapping the JWT leeway | 24 天前 | |
[Server] Compose StreamableHttpTransport security middleware via defaultMiddleware() factory (#307) * [Server] Add CORS, DNS rebinding and protocol version middleware Introduce three PSR-15 middleware for `StreamableHttpTransport` exposed through a public `StreamableHttpTransport::defaultMiddleware()` factory composed automatically when no middleware is passed. - `CorsMiddleware`: secure-by-default (no `Access-Control-Allow-Origin`), configurable allowlist, reflects matching origin with `Vary: Origin` to protect shared caches. - `DnsRebindingProtectionMiddleware`: validates `Origin`/`Host` against a hostname allowlist (localhost-only by default). - `ProtocolVersionMiddleware`: rejects requests carrying an unsupported `Mcp-Protocol-Version` header with `400 Bad Request`. The transport no longer applies CORS via an `instanceof + array_unshift` post-hook; the middleware parameter is nullable — `null` installs the secure defaults, `[]` disables them, and users compose by spreading `StreamableHttpTransport::defaultMiddleware()`. `SESSION_HEADER` and `PROTOCOL_VERSION_HEADER` are promoted to public constants so middleware can reuse them. BC breaks: - The `corsHeaders` constructor parameter is removed; the `middleware` parameter shifts one position. Positional callers passing the old `corsHeaders` argument must switch to named arguments or drop it. - Default `Access-Control-Allow-Origin` is no longer `*`. Addresses #260 (DNS rebinding), #277 (CORS extraction) and #306 (protocol version validation). * [Server] Address review feedback on middleware defaults - CorsMiddleware: emit Access-Control-Allow-Methods/Headers only on preflight per CORS spec; tokenize Vary header to avoid substring false-positives; add allowCredentials flag that emits Access-Control-Allow-Credentials and throws when combined with wildcard origin. - DnsRebindingProtectionMiddleware: return plain-text 403 body (HTTP-level rejection, not JSON-RPC); use parse_url(..., PHP_URL_HOST) for origin parsing; drop redundant unbracketed '::1' from default allowlist. - ProtocolVersionMiddleware: use Error::forInvalidParams instead of forInvalidRequest -- JSON-RPC -32602 fits header-value rejection better. - JsonRpcErrorResponse::create now accepts a JsonRpc\Error so callers choose the error code. - StreamableHttpTransport: emit a warning log when an explicit empty middleware list is passed, so operators can spot accidental bypass of the default security stack. * [Server] Fix CI: switch warning-log tests to PHPUnit mocks Replace the anonymous AbstractLogger fixture in StreamableHttpTransportTest with `$this->createMock(LoggerInterface::class)` so the test does not declare a `log()` signature at all. That sidesteps both the psr/log v1 LSP incompatibility (untyped parameter) and the phpstan `missingType.parameter` complaint in one move, and matches how the rest of the suite (CallToolHandlerTest etc.) fakes loggers. * Update src/Server/Transport/Http/Middleware/CorsMiddleware.php Co-authored-by: Antoine Bluchet <soyuka@users.noreply.github.com> --------- Co-authored-by: Antoine Bluchet <soyuka@users.noreply.github.com> | 5 个月前 | |
Improve middleware pipeline consistency (#262) - Make MiddlewareRequestHandler final and use index counter instead of array_shift to avoid mutating internal state - Make OAuthProxyMiddleware factory discovery consistently lazy via getter methods, matching httpClient and requestFactory pattern Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> | 7 个月前 | |
[Server] Flush output buffers on stateless SSE streams (#520) * [Server] Flush output buffers on stateless SSE streams StatelessResponder called only flush(), which does not empty PHP's own output buffer. With output_buffering enabled, as php.ini-production and php.ini-development ship it, the frames of a subscriptions/listen stream (starting with the acknowledgement) stayed buffered until the stream closed, so clients waiting for the acknowledgement timed out. Call @ob_flush() before flush(), as StreamableHttpTransport already does. Fixes #516 * Add changelog entry --------- Co-authored-by: Christopher Hertel <mail@christopher-hertel.de> | 26 天前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 18 天前 | ||
| 24 天前 | ||
| 5 个月前 | ||
| 7 个月前 | ||
| 26 天前 |