fix(gateway): bound per-connection send queue to prevent memory DoS #98
No reviewers
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom!98
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/81-bounded-ws-queue"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes #81. Each WebSocket connection used an unbounded
mpscchannel for outbound messages. A client that connects, authenticates, then stops reading grows its queue without bound as server activity continues — one idle socket per attacker can exhaust memory.Fix
gateway.send_queue_capacity(default 256; validated> 0).broadcast_to_channel/send_to_user/broadcast_allnowtry_sendand collect connections whose queue is full or closed, then drop those senders in a short write-locked pass.Tests
full_queue_drops_the_slow_connection: capacity-1 queue, second send with no reader → connection dropped.send_queue_capacity = 0.Full server suite green (116 tests);
clippy -D warningsclean.Closes #81