Evidence
src/CodeIndex/Lsp/LspServer.cs parses Content-Length into an int and then rents exactly that size:
var buffer = ArrayPool<byte>.Shared.Rent(contentLength);
ReadAsciiLine also builds a List<byte> until newline without a header-line length cap.
Impact
A malformed or hostile LSP peer can advertise a very large Content-Length or send an unbounded header line. Even though LSP is normally local stdio, this can still cause excessive allocation or memory pressure in editor-launched processes.
Expected
Add maximum LSP frame size and header-line limits. Reject frames over the cap with a structured error or close the stream. Prefer clear constants and tests for boundary values.
Evidence
src/CodeIndex/Lsp/LspServer.csparsesContent-Lengthinto anintand then rents exactly that size:ReadAsciiLinealso builds aList<byte>until newline without a header-line length cap.Impact
A malformed or hostile LSP peer can advertise a very large
Content-Lengthor send an unbounded header line. Even though LSP is normally local stdio, this can still cause excessive allocation or memory pressure in editor-launched processes.Expected
Add maximum LSP frame size and header-line limits. Reject frames over the cap with a structured error or close the stream. Prefer clear constants and tests for boundary values.