fix(NetworkServer): Don't disconnect on OnEntityStateMessage for object without authority (#3439)

This commit is contained in:
MrGadget 2023-03-29 11:37:08 -04:00 committed by GitHub
parent b377d765ec
commit 40361f62bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -334,12 +334,12 @@ static void OnEntityStateMessage(NetworkConnectionToClient connection, EntitySta
} }
} }
} }
// an attacker may attempt to modify another connection's entity // An attacker may attempt to modify another connection's entity
// This could also be a race condition of message in flight when
// RemoveClientAuthority is called, so not malicious.
// Don't disconnect, just log the warning.
else else
{ Debug.LogWarning($"EntityStateMessage from {connection} for {identity} without authority.");
Debug.LogWarning($"Connection {connection.connectionId} attempted to modify {identity} which is not owned by the connection. Disconnecting the connection.");
connection.Disconnect();
}
} }
// no warning. don't spam server logs. // no warning. don't spam server logs.
// else Debug.LogWarning($"Did not find target for sync message for {message.netId} . Note: this can be completely normal because UDP messages may arrive out of order, so this message might have arrived after a Destroy message."); // else Debug.LogWarning($"Did not find target for sync message for {message.netId} . Note: this can be completely normal because UDP messages may arrive out of order, so this message might have arrived after a Destroy message.");