Skip to content

fix(mcp): escape surrogates in protocol output - #207

Merged
JohnXu22786 merged 1 commit into
mainfrom
bug/c25-06-escape-mcp-lone-surrogate-r1
Sep 29, 2026
Merged

JohnXu22786 merged 1 commit into
mainfrom
bug/c25-06-escape-mcp-lone-surrogate-r1

Conversation

@JohnXu22786

Copy link
Copy Markdown
Owner

What this PR does

Before this PR:

A lone surrogate in an untrusted JSON-RPC method could make strict UTF-8 encoding raise UnicodeEncodeError, terminating the server without a protocol response.

After this PR:

Protocol output escapes lone surrogate code points during UTF-8 encoding, preserving valid JSON-RPC error responses while leaving normal Unicode output as UTF-8.

Type of change

Bug fix

@JohnXu22786
JohnXu22786 marked this pull request as ready for review September 29, 2026 10:02
@JohnXu22786
JohnXu22786 merged commit a92bfcd into main Sep 29, 2026
2 checks passed
@JohnXu22786
JohnXu22786 deleted the bug/c25-06-escape-mcp-lone-surrogate-r1 branch September 29, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant