N9: Server-side cheat and abuse protection
- A hostile test client crafts INPUT packets byte by byte and sends them through NetGame.take_input() into a real match: extreme axes, the same tick claimed repeatedly, the whole lead window at once, past, far-future and maximum ticks, fire toggled every tick with slot swaps, builds aimed anywhere with junk kinds and materials and no materials, and pickup/drop/select tricks. Speed stays within sprint speed per tick, shots within the weapon's rate, pieces within build reach and paid for, and every item is conserved. - Fix: a command tick beyond the simulation's lead window no longer moves NetGame's dedupe marker, so one bogus far-future tick can't lock out a player's real commands. - Connections are rate-limited per address (32 per 10 s, 8 handshakes in progress) with a new REASON_BUSY and a message for it. - ParserFuzz mutates real messages from a bot match and random bytes and feeds them to every network decoder, the snapshot receiver and the list server. 20,000 per make check; make fuzz runs 1,000,000 (about 40 s): no errors, 2.9 KB of memory growth. - ARCHITECTURE.md: "Trusting nothing from clients". Closes #40 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Tidewall build entry points. Everything runs headless with the repo-local engine.
|
||||
GODOT := tools/godot.sh
|
||||
|
||||
.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures client-check client-captures discovery-check
|
||||
.PHONY: check import parse test test-selfcheck smoke capture-test terrain-capture binaries verify-engine bot-matches match match-captures client-check client-captures discovery-check fuzz
|
||||
|
||||
## Everything that must pass before a push.
|
||||
check: verify-engine binaries parse test test-selfcheck smoke
|
||||
@@ -51,6 +51,12 @@ match-captures: import
|
||||
client-check: import
|
||||
@tools/client_check.sh
|
||||
|
||||
## Feeds FUZZ_MESSAGES (default 1,000,000) malformed messages to every network parser.
|
||||
FUZZ_MESSAGES ?= 1000000
|
||||
FUZZ_SEED ?= 1
|
||||
fuzz: import
|
||||
@nice -n 15 $(GODOT) --script res://tools/fuzz_parsers.gd -- --messages=$(FUZZ_MESSAGES) --seed=$(FUZZ_SEED)
|
||||
|
||||
## Finds a real game server on the LAN (over loopback) and through a real list server.
|
||||
discovery-check: import
|
||||
@tools/discovery_check.sh
|
||||
|
||||
Reference in New Issue
Block a user