fix: escape html in external oauth error message#28091
fix: escape html in external oauth error message#28091whoiskatrin merged 4 commits intoproductionfrom
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Updates documentation to reflect security improvements in OAuth error handling: - Remove MCPClientOAuthResult from customHandler signature (no longer receives error info) - Document new `error` field in MCPServer type that stores connection errors - Update examples to display errors from connection state instead of script alerts - Add note that error messages are automatically escaped to prevent XSS attacks - Simplify customHandler examples to only close popup (errors handled separately) Related to cloudflare/agents#841 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
608009d to
af4ee34
Compare
|
looks good to me. @threepointone to go with the PR |
|
/bonk review |
|
Here's my review: Review SummaryThis PR correctly documents the security fix from cloudflare/agents#841, which eliminates an XSS vulnerability where error messages from external OAuth providers were interpolated directly into Changes look good
Issue: Inconsistent
|
|
/bonk resolve merge conflicts and review |
- Remove result parameter from customHandler in mcp-client-api.mdx to match new SDK API (no longer receives MCPClientOAuthResult) - Fix server.connectionState -> server.state in client-side example - Add missing useState import in React examples in oauth-mcp-client.mdx
SummaryMerge ConflictsNo real merge conflicts on the two files changed by this PR. The branch has an "unrelated histories" issue with production (likely from how the sync bot created the branch), but the two commits since the last merge ( Fixes AppliedThree issues were found and fixed in a single commit:
Review Notes
|
Merge production into sync-docs-pr-841, resolving conflicts in: - oauth-mcp-client.mdx: keep simplified customHandler (no MCPClientOAuthResult param), error handling via server.error field, XSS escaping notes - mcp-client-api.mdx: keep error: string | null type, update configureOAuthCallback API docs to match new simplified handler, retain callbackPath section from production
Summary
This PR syncs documentation changes from cloudflare/agents#841 which fixed an XSS vulnerability in OAuth error handling for MCP clients.
Changes
customHandlerno longer receivesMCPClientOAuthResultwith error information. It now simply closes the popup window, and errors are handled automatically by the SDK.errorfield inMCPServertype, which stores connection errors for UI display.Files Changed
/agents/guides/oauth-mcp-client/- Updated OAuth integration guide with new error handling patterns/agents/model-context-protocol/mcp-client-api/- Addederrorfield to MCPServer type documentationRelated