bug(server): replay upload uses client-supplied recorded_at for leaderboard — allows timestamp spoofing #74
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
In
solitaire_server/src/replays.rs(lines 159–181), when a winning replay is uploaded and the mode is"Classic", the leaderboard row'srecorded_atcolumn is updated fromheader.recorded_at— a value supplied by the client:Impact
A client can supply any arbitrary
recorded_atstring (past or future) and it will be stored verbatim in the leaderboard. Players could backdate scores to appear longer-standing, or future-date them.Fix
Use the server-computed
received_attimestamp (already available in the handler) instead of the client-suppliedheader.recorded_atwhen updating the leaderboard row.Fix (commit
7eb1181)The leaderboard
recorded_atupdate inreplays.rsnow uses the server-computedreceived_attimestamp instead of the client-suppliedheader.recorded_at:received_atis already calculated at the top of theuploadhandler viaUtc::now().to_rfc3339()and stored in thereplaystable, so no additional database calls are needed. Clients can no longer backdate or future-date their leaderboard entries by supplying a craftedrecorded_atin the replay JSON.