fix(sdk): reject updates on terminal checkout sessions - #16
Merged
Conversation
The update handler never consulted the FSM, so a completed (or canceled) session could be rewritten by any caller: items, totals, customer, and fulfillment all changed while the session kept reporting completed, with no additional payment authorized or captured. Add an isTerminal() helper derived from the FSM transition table and guard update after the session lookup, before products.price runs, so terminal sessions cannot trigger merchant-side pricing. The rejected request returns the same 400 invalid_state error shape cancel uses. Fixes VULN-13971 (HackerOne #3948484, CWE-841).
dieDeMiguel
approved these changes
Sep 1, 2026
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.
Reject updates on terminal (
completed/canceled) checkout sessions with a 400invalid_stateerror, and bump to0.0.0-alpha.10.