fix(callbacks): bind RPC responses to their source and use unpredictable ids - #185
Open
Pajt9whauht283as wants to merge 1 commit into
Open
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
Author
|
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. |
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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