Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix unbounded WebSocket buffer leading to DoS - #44

Closed
pakorn269 wants to merge 1 commit into
mainfrom
sentinel-websocket-dos-fix-12912013842099499680
Closed

pakorn269 wants to merge 1 commit into
mainfrom
sentinel-websocket-dos-fix-12912013842099499680

Conversation

@pakorn269

Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: The local WebSocket server (skills/brainstorming/scripts/server.js) continually appended incoming network chunks into a local buffer. Without proper formatting to extract frames, the buffer would never be cleared and could grow indefinitely, leading to memory exhaustion (OOM) and a Denial of Service (DoS) state.
🎯 Impact: Any connected client (malicious or malfunctioning) could continuously send arbitrary bytes and crash the server, making the brainstorming skill completely unavailable.
πŸ”§ Fix: Enforced a 10MB maximum payload limit directly after attempting to decode frames. If the internal buffer size exceeds this limit, the server securely drops the connection (socket.destroy()) and terminates it with a 1009 WebSocket status code.
βœ… Verification: Created a test script verifying that streaming more than 10MB of un-framed chunks explicitly triggers the new limit check and closes the connection without crashing the Node.js server. Tests in tests/brainstorm-server/ continue to pass. The .jules/sentinel.md journal has also been updated with this learning.


PR created automatically by Jules for task 12912013842099499680 started by @pakorn269

Enforce a 10MB limit on the incoming un-framed chunks buffer in the WebSocket data listener. Without this, an attacker streaming unbounded chunks could exhaust memory resources leading to an OOM crash.

Co-authored-by: pakorn269 <[email protected]>
@google-labs-jules

Copy link
Copy Markdown

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@pakorn269

Copy link
Copy Markdown
Owner Author

Closing β€” conflicts due to server.js β†’ server.cjs rename. The fix is being applied directly to server.cjs.

@pakorn269 pakorn269 closed this Mar 24, 2026
@google-labs-jules

Copy link
Copy Markdown

Closing β€” conflicts due to server.js β†’ server.cjs rename. The fix is being applied directly to server.cjs.

Understood. Acknowledging that this work is now obsolete and stopping work on this task.

pakorn269 added a commit that referenced this pull request Mar 24, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant