LiamKarlMitchell / InfiniteSky

InfiniteSky is an open-source mmorpg project, It is written in Node.JS
GNU General Public License v3.0
33 stars 42 forks source link

Investigate potential DDOS in CachedBuffer / Packet Receiving #172

Open LiamKarlMitchell opened 9 years ago

LiamKarlMitchell commented 9 years ago

The way the packet receiving works it gets as much data as it can from the stream.

It then loops checking for packets. If there is a full packet then it is processed.

Now if someone were to make their client / a client that sends a bunch of 1 byte packet id (or even bigger) to the server that are valid packets.

It may be possible for them to negatively impact the experience for other players / lag the server.

We should possibly process 1 packet per iteration always. (Even though we might get more than 1 packet)

Or we could agree upon a nice amount of packets to process in this loop and then continue to allow other sockets to have their packets processed.

This problem may be non-existent due to async design, providing none of our functions block or loops slow/blocking in the functions that handle each specific packet action.

But I thought I should log it as something to look into in the future in the interest of having a stable fast server :).