fix(multiplayer): validate allocated config ids

This commit is contained in:
Josh Creek
2026-09-01 22:44:12 +01:00
parent 75f9026ea1
commit 56e8e2554c
3 changed files with 20 additions and 0 deletions
+11
View File
@@ -276,6 +276,10 @@ func _validate() -> void:
for key in ["match-id", "server-id", "playlist-version", "playlist", "client-build", "assignment-expiry-unix", "server-image-digest", "transport", "region"]:
if str(values[key]).is_empty():
errors.append("--allocated-mode requires --%s" % key)
if not _is_opaque_id(String(values["match-id"])):
errors.append("--match-id must be an opaque ID of 16-128 safe characters")
if not _is_opaque_id(String(values["server-id"])):
errors.append("--server-id must be an opaque ID of 16-128 safe characters")
if int(values["assignment-expiry-unix"]) <= int(Time.get_unix_time_from_system()):
errors.append("--assignment-expiry-unix must be in the future")
if String(values["join-authorisations-file"]).is_empty():
@@ -307,6 +311,13 @@ static func _is_sha256_digest(value: String) -> bool:
return true
static func _is_opaque_id(value: String) -> bool:
if value.length() < 16 or value.length() > 128:
return false
var resource_pattern := RegEx.create_from_string("^[A-Za-z0-9_-]+$")
return resource_pattern.search(value) != null
static func _kind_name(kind: int) -> String:
match kind:
Kind.BOOL: return "bool"