mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-10 16:04:04 +00:00
fix(multiplayer): reject typed claim coercion
This commit is contained in:
@@ -78,6 +78,10 @@ func test_allocated_join_authorisation_is_allowlisted_and_bound_to_server() -> v
|
||||
malformed_claims["ExpiresAt"] = "tomorrow"
|
||||
var malformed_token := Marshalls.raw_to_base64(JSON.stringify({"Authorisation": malformed_claims, "Signature": "trusted-signature"}).to_utf8_buffer())
|
||||
assert_true(not match_net._valid_join_authorisation(malformed_token), "malformed expiry claim is rejected before admission")
|
||||
var string_slot_claims := claims.duplicate()
|
||||
string_slot_claims["Slot"] = "5"
|
||||
var string_slot_token := Marshalls.raw_to_base64(JSON.stringify({"Authorisation": string_slot_claims, "Signature": "trusted-signature"}).to_utf8_buffer())
|
||||
assert_true(not match_net._valid_join_authorisation(string_slot_token), "string slot claim is rejected instead of coerced")
|
||||
assert_true(not match_net._valid_join_authorisation(token + "tampered"), "token mutation is rejected")
|
||||
var wrong_claims := claims.duplicate()
|
||||
wrong_claims["ServerID"] = "other-server"
|
||||
|
||||
Reference in New Issue
Block a user