clockworklabs / clockworklabs/SpacetimeDB
server side client WS message rate limit
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
i know that the maincloud has DDOS protection but ironically it doesn't have DOS protection from one client.
right now a single client can call a reducer so fast that it fills the reducer queue of 16k requests in an instance. right now the client get's disconnected but the server still runs ~7k of these requests before that happens (stdb is too fast for it's own good in this case)
i did it with a rust client that just has this
loop{
if !conn.is_active(){
sleep(Duration::from_millis(100));
} else {
match conn.reducers.transfer_money(1, 2, 1u64){
Ok(_) => {}
Err(e) => { println!("{}",e) }
}
}
}
now if i make the client wait a fraction so that the queue barely doesn't fill up, the perfect and simple DOS machine is created that the server doesn't detect on it's own.
i would say that creating a global rate limit of 300 requests/s per client is more than generaous enough for games and i would go even further to have a rate limit of 100 requests/s per reducer per client as even fast pase movement should never take more than 60 requests/s (normally probably not even 10 requests/s as the client only needs to send changes in the input and not realtime position updates).
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No server file or test is named. Start by tracing server-side WebSocket message handling, client identification, and the reducer queue behavior; use the Rust client loop as a reproduction. Done should include enforced per-client and per-reducer request limits that prevent queue-filling abuse without breaking the stated game-traffic rates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100