apache / apache/shenyu

[BUG] SseEventFormatter uses default-charset getBytes() for SSE

Closed
#6,752 2 comments 0 reactions 1 assignee Claimed by @yykaue View on GitHub
feature: plugin priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

- severity: Medium
- files: `shenyu-plugin/shenyu-plugin-mcp-server/src/main/java/org/apache/shenyu/plugin/mcp/server/transport/SseEventFormatter.java:76,89`
- description: `formatEvent`/`formatComment` build the SSE frame then `exchange.getResponse().bufferFactory().wrap(formattedEvent.getBytes())` — platform default charset. SSE is a UTF-8 text stream; MCP JSON payloads frequently contain non-ASCII.
- impact: Non-ASCII SSE event data is corrupted on non-UTF-8 default charsets.
- suggested_fix: Use `formattedEvent.getBytes(StandardCharsets.UTF_8)`.
- confidence: High
- related_existing: none

---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.