π‘οΈ Sentinel: Enforce concurrency limit on daemon socket#92
π‘οΈ Sentinel: Enforce concurrency limit on daemon socket#92
Conversation
β¦ DoS - Introduced `maxConcurrentConnections` (50) to limit active socket handlers. - Implemented semaphore pattern in `startSocketListener` to apply backpressure. - Fixed shutdown loop to exit cleanly on `net.ErrClosed`. - Added `cmd/security_concurrency_test.go` to verify the fix and prevent regressions. Co-authored-by: minibota <1483356+minibota@users.noreply.github.com>
|
π 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. |
π Issue: The daemon's socket listener (
Acceptloop) spawned a new goroutine for every incoming connection without limit. A local attacker could rapidly open thousands of connections, causing the daemon to spawn thousands of goroutines (Unbounded Concurrency), leading to resource exhaustion (DoS).π§ Risk: High. A local user (even unprivileged, depending on socket permissions) could crash the daemon or make the system unresponsive by flooding the socket.
π οΈ Fix:
chan struct{}) with a limit of 50 concurrent connections.Acceptloop blocks, relying on the OS socket backlog to queue further connections.net.ErrClosedto ensure the listener loop exits cleanly during shutdown.π§ͺ Tests:
cmd/security_concurrency_test.go:go test ./cmd/...to ensure no regressions.π Notes: This change makes the daemon robust against connection floods while maintaining sufficient concurrency for legitimate execution reports.
This PR was created by an automated nightly security task.
PR created automatically by Jules for task 1744658072634750238 started by @minibota