Notice this should be pretty common in the Conquer environment and especially at the auth state, but yet I've never seen anyone do it.
It's not much of a security problem, but it could be one.
Normally the client will disconnect after authentication, because there is only one packet to handle authentication, but what if the end-user is using a proxy and keeps spamming packets (dos?). That could be a problem and you would most likely want to avoid that.
After authentication you do not want to receive anymore packets.
There is two ways to get around this.
Never call your receive method after handling the first packet received (Unless co added more packets then after last packet.) at the auth server.
Or you can simply disconnect the client, but I am not sure if last one is allowed and will cause problem for the regular client. Never tested that.
Let's rely on the first one.
I assume most people uses a receive event like this: (Or something similar.)
Where BufferEvent is a delegate. However in public sources I've noticed it's usually a delegate void. You want to change to that a bool.
Now in your receive's async callback you can do something like this:
Now in your receive handler you can do something like this:
Notice that it returns a boolean. Whatever it returns also defines whether the server should still receive packets.
Not much of a security fix, but it should still be used.
This is all pseudo codes, so you have to use commonsense to actually implement something like this.
It's not much of a security problem, but it could be one.
Normally the client will disconnect after authentication, because there is only one packet to handle authentication, but what if the end-user is using a proxy and keeps spamming packets (dos?). That could be a problem and you would most likely want to avoid that.
After authentication you do not want to receive anymore packets.
There is two ways to get around this.
Never call your receive method after handling the first packet received (Unless co added more packets then after last packet.) at the auth server.
Or you can simply disconnect the client, but I am not sure if last one is allowed and will cause problem for the regular client. Never tested that.
Let's rely on the first one.
I assume most people uses a receive event like this: (Or something similar.)
Code:
public static BufferEvent OnReceive;
Code:
public delegate bool BufferEvent(SocketClient sClient, DataPacket Packet);
Code:
if (SocketEvents.OnReceive.Invoke(this, receiveData))
{
Receive(); // BeginReceive
}
Code:
static bool SocketEvents_OnReceive(SocketClient sClient, DataPacket Packet)
{
// handle packets here
return false; // return true if more packets should be received
}
Not much of a security fix, but it should still be used.
This is all pseudo codes, so you have to use commonsense to actually implement something like this.