Currently, the server has no limit on incoming request size. An attacker can send infinite data and crash the server through memory exhaustion.
Tasks:
Files to modify:
src/httpServer.ts - data event handler
References:
- RFC 7230 Section 3.3.2 (Message Body Length)
- OWASP: Denial of Service via resource exhaustion
Currently, the server has no limit on incoming request size. An attacker can send infinite data and crash the server through memory exhaustion.
Tasks:
MAX_REQUEST_SIZEconstant (recommend 1MB = 1024 * 1024 bytes)totalBytesin the data event handlertotalBytes > MAX_REQUEST_SIZEbefore processingHTTP/1.1 413 Payload Too Largewhen limit exceededFiles to modify:
src/httpServer.ts- data event handlerReferences: