#Is (!IsServer) Check Passable?

1 messages · Page 1 of 1 (latest)

blissful stream
#

The question is pretty self-explanatory. I am using IsServer check as a security measure but is it passable. Like can hackers pass it or modify it? If no, please elaborate, how does it work. If yes, please tell me the ways of making a more robust security check.

fresh dust
#

In newer versions of NGO you can use RpcInvokePermission to prevent clients from calling certain RPCs. From a security standpoint it’s pretty sound.

#

In general you just need to make things server authoritative and do server validation where needed. At a high level this just means that for any sensitive action that needs to be performed the client makes a request to the server. The server then checks if that request makes sense and is okay to carry out. If it is, usually the result is sent back for the client to use to update their game world.

blissful stream
#

but in in game, players just call serverrpc, in the serverrpc, there is an internal method that has (!IsServer) check, after that check server controls if the request sounds reasonable or not

#

my concern is, if hackers pass that request, they could do as they will

#

!code

chrome craterBOT
blissful stream
#
    private void PasClicked()
    {
        PasServerRpc();
    }

    [ServerRpc(RequireOwnership = false)]
    private void PasServerRpc(ServerRpcParams rpcParams = default)
    {
        if (!IsServer) return;

        ulong senderClientId = rpcParams.Receive.SenderClientId;

        PlayerData senderPlayerData = GetPlayerDataByClientId(senderClientId);
        if (senderPlayerData == null)
        {
            Debug.LogWarning($"[PAS] Could not find PlayerData for ClientId: {senderClientId}");
            return;
        }

        if (currentPlayerIndex.Value != senderPlayerData.PlayerIndex.Value)
        {
            Debug.LogWarning($"[PAS] Wrong turn! Current: {currentPlayerIndex.Value}, Sender: {senderPlayerData.PlayerIndex.Value}");
            return;
        }

        Debug.Log($"[PAS] Player {senderPlayerData.PlayerIndex.Value} passed their turn");
        EndTurn();
    }
#

this is an example

#

what would you suggest doing?

blissful stream
#

Is this okay?

#

Sounded pretty logical

loud gyro
blissful stream
#

thanks man, i appreciate it