fix: escape html in external oauth error message#28091
Open
agents-git-bot[bot] wants to merge 1 commit intoproductionfrom
Open
fix: escape html in external oauth error message#28091agents-git-bot[bot] wants to merge 1 commit intoproductionfrom
agents-git-bot[bot] wants to merge 1 commit intoproductionfrom
Conversation
Contributor
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
Contributor
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
Contributor
|
looks good to me. @threepointone to go with the PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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