Harden local CLI IPC against oversized requests and indefinite waits
Author: ecschoyeCreated Jul 17, 2026Updated Jul 17, 2026
Problem
The local CLI protocol uses UDP with several failure modes:
- The CLI uses
assert!when the serialized request exceedsMAX_REQUEST_SIZE, so a long user-controlled query or field can panic the process. - Connection and response reads have no deadline, so a nonresponsive client can block a command indefinitely.
- Large responses are split into UDP datagrams without request IDs, sequence numbers, retries, or an integrity check.
The loopback interface reduces packet-loss risk, but it does not prevent a stalled server, oversized input, or protocol desynchronization.
Expected behavior
CLI commands should either return a valid response or fail with a bounded, actionable error. User input should never trigger an assertion panic.
Suggested approach
A length-prefixed local stream protocol would provide the strongest guarantee. A smaller first step could add request-size errors, read deadlines, request IDs, and sequenced response chunks.
Acceptance criteria
- Oversized requests return a normal error.
- Connection and response waits have configurable or documented deadlines.
- Missing or incomplete response chunks fail cleanly.
- Concurrent CLI clients cannot mix responses.
- Tests cover a missing server, a stalled server, oversized input, and multi-chunk responses.
Source: aome510/spotify-player