RockteMQ-AI commented on issue #2538:
URL: 
https://github.com/apache/rocketmq-dashboard/issues/2538#issuecomment-5379462375

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   The reported issue has been verified against the current codebase.
   
   **Root Cause:**
   1. `ChatDTO` and `AiCommandDTO` have no validation annotations (`@Size`, 
`@Valid`), and `AiController` does not apply `@Valid` on `@RequestBody` 
parameters. User-controlled fields (`message`, `mode`, `model`, `engine`, 
`conversationId`, tool `input` map) can be arbitrarily large.
   2. `OpenAiCompatibleLlmClient.streamBodyHandler()` uses 
`HttpResponse.BodySubscribers.ofInputStream()` for successful SSE responses 
(status < 400), which is unbounded. The `parseStream()` method reads lines 
without any byte counting or limit.
   3. Non-streaming and error paths correctly enforce `MAX_RESPONSE_BODY_BYTES` 
(5 MiB) via `LimitedBodySubscriber`, creating an inconsistency where only the 
successful streaming path is unprotected.
   
   **Impact:** A malicious or misconfigured provider can cause unbounded memory 
consumption in the dashboard server via the SSE streaming path. Oversized 
request payloads can also consume excessive memory before reaching the provider.
   
   **Severity:** Medium — affects availability (potential OOM) but requires 
either a malicious provider or an authenticated user sending crafted requests.
   
   **Affected components:** `AiController`, `ChatDTO`, `AiCommandDTO`, 
`OpenAiCompatibleLlmClient`, `CliAgentProvider`
   
   An automated fix proposal can be generated. Reply `/approve` to proceed with 
PR generation.
   
   ---
   *Automated evaluation by RockteMQ-AI*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to