fix(callbacks): bind RPC responses to their source and use unpredictable ids - #185
Pajt9whauht283as wants to merge 1 commit into
Conversation
…ble ids Pending client-callback responses were stored in a table keyed only by a sequential, shared counter (name .. N), and the response handler never verified that the responding player was the one the request was sent to. Any connected client could therefore resolve another player's pending callback with forged data by guessing ids. - key pending calls with random per-call tokens - record the initiating source alongside each pending callback/promise - reject responses whose source does not match the initiator - dispatch async/sync strictly by what is actually pending Fixes VORPCORE#182
|
Note for reviewers: no API changes \u2014 \TriggerAsync/\TriggerAwait/\Register\ signatures and behavior are identical for legitimate flows; only id generation, source-binding and dispatch safety changed. |
|
Before outsider review it and potentially merge it, could you put the PR in the repo's template format please, and take a pass on a few review points: cleanup for orphaned TriggeredCalls entries (not sure if this is already handled elsewhere in the code, but wanted to flag it), the duplication between TriggerRpcAsync and TriggerRpcAwait, and the promise variable shadowing the module name. |
|
HI, you have failed to use the PR template besides callbacks are not meant to provide security. Security and validation belong in the resource logic. The callback system is not an authentication or anti-tampering layer, and it should not be turned into one. |
Summary
As discussed in #182 — pending client-callback responses were stored keyed only by a sequential, shared counter (
name .. N), and the response handler never verified that the responding player was the one the request was sent to. Any connected client could resolve another player's pending callback with forged data by guessing ids.Changes
callBackIdExecuteRpcrejects responses whosesourcedoes not match the initiatorisSyncon its own responseNo API changes —
TriggerAsync/TriggerAwait/Registersignatures and behavior are unchanged for legitimate flows.Fixes #182