Repository navigation
Conversation
β¦ocket server Co-authored-by: pakorn269 <[email protected]>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Closing β conflicts due to |
Understood. Acknowledging that this work is closed due to conflicts with the rename to |
Security: add 10MB MAX_BUFFER_SIZE cap on WebSocket buffer to prevent memory exhaustion DoS (closes duplicate PRs #24 #28 #32 #33 #37 #41 #44). Performance: replace String.prototype.replace() with lastIndexOf+slice in both wrapInFrame and handleRequest for multi-megabyte HTML payloads (closes duplicate PRs #19 #22 #26 #29 #30 #35 #38 #39 #42). Update .jules/sentinel.md and .jules/bolt.md with learnings. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
π¨ Severity: HIGH
π‘ Vulnerability:
The zero-dependency WebSocket server implementation (
skills/brainstorming/scripts/server.js) lacked bounds checking on incoming payloads and accumulated buffers in thesocket.on('data')handler. This allowed a malicious client to exhaust the server's memory by sending a continuously large payload or an incomplete frame with an artificially large length marker, causing the server to buffer data indefinitely.π― Impact:
A malicious actor could easily perform a Denial of Service (DoS) attack by exhausting available system memory, causing the Node process (and potentially dependent services) to crash.
π§ Fix:
MAX_PAYLOAD_SIZElimit of 10MB.decodeFrameto explicitly reject any frame claiming a payload size larger thanMAX_PAYLOAD_SIZE.dataevent handler. If the remaining incomplete buffer exceeds the allowed max payload size plus headers, the connection is forcefully closed. This prevents unbounded buffer accumulation while correctly handling legitimate streams that contain multiple valid frames in a single chunk.β Verification:
Verified that the existing WebSocket test suite (
tests/brainstorm-server/ws-protocol.test.jsandserver.test.js) still passes correctly, demonstrating that normal protocol functionality (including large legal payloads up to the limit and boundary conditions) remains intact. Added a new entry to the security journal (.jules/sentinel.md) detailing the vulnerability and the fix.PR created automatically by Jules for task 14483067199891393425 started by @pakorn269