mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 16:02:27 +00:00
fix(multiplayer): validate allocated roster shape
This commit is contained in:
@@ -89,6 +89,19 @@ func test_allocated_join_authorisation_rejects_inconsistent_team_and_slot() -> v
|
||||
assert_true(not match_net._valid_join_authorisation(token), "a slot assigned to team 1 cannot claim team 0")
|
||||
|
||||
|
||||
func test_assigned_roster_rejects_duplicate_identity_or_slot_shape() -> void:
|
||||
var claims := {
|
||||
"MatchID": "match-1", "ServerID": "server-1", "PlayerID": "player-1",
|
||||
"SteamID": "steam-1", "Slot": 0, "Team": 0, "Protocol": "1",
|
||||
"Generation": 1, "ExpiresAt": "2099-08-31T12:00:00Z",
|
||||
}
|
||||
var first := Marshalls.raw_to_base64(JSON.stringify({"Authorisation": claims, "Signature": "one"}).to_utf8_buffer())
|
||||
var duplicate := Marshalls.raw_to_base64(JSON.stringify({"Authorisation": claims, "Signature": "two"}).to_utf8_buffer())
|
||||
var match_net := MatchNet.new()
|
||||
assert_true(match_net.configure_join_authorisations([first, duplicate], {"match_id": "match-1", "server_id": "server-1", "protocol": "1", "protocol_version": 1}), "duplicate fixture configures for structural inspection")
|
||||
assert_eq(match_net.assigned_player_slots().size(), 0, "duplicate identity/slot roster fails closed")
|
||||
|
||||
|
||||
func test_allocated_join_authorisation_verifies_canonical_hmac() -> void:
|
||||
# This envelope is generated from server/domain.JoinAuthorisationBytes with
|
||||
# HMAC-SHA256(test-key), proving the Godot verifier agrees with the Go
|
||||
|
||||
Reference in New Issue
Block a user