fix: Harden lambda-durable-saga-python-sam — security & correctness fixes - #3270
Open
awsTest1992 wants to merge 1 commit into
Open
fix: Harden lambda-durable-saga-python-sam — security & correctness fixes#3270awsTest1992 wants to merge 1 commit into
awsTest1992 wants to merge 1 commit into
Conversation
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
Follow-up to #3187. Addresses security and correctness findings from code review of the merged saga pattern.
High severity
_validate_event) — rejects missing fields, non-positive quantities, NaN/negative amounts, and unbounded item listsconfirm_orderwith a singleTransactWriteItemsto preventorder=CONFIRMED / payment=RESERVEDsplit-brainConditionExpressiontocompensate_paymentso it can only refund a RESERVED payment (not an already-CAPTURED one)Medium severity
order_idgeneration into a@durable_stepso it's checkpointed and stable across replaysorders_table.put_iteminto a@durable_step(record_failed_order) — was a raw write in the orchestrator body, re-executed on every replaysuccessful_compensationsvsfailed_compensationsseparately; publish to SQS DLQ on compensation failure instead of silently returning successLow severity
arn:aws:witharn:${AWS::Partition}:for GovCloud portabilitySagaCompensationDLQ(SQS) for compensation failure alerting, wired viaCOMPENSATION_DLQ_URLenv varRetryPresets.none()onreserve_inventoryandprocess_paymentsteps — deterministic business failures (InsufficientInventoryError,PaymentDeclinedError) were retrying 6× by default, adding ~60s unnecessary delayREADME
lambda-durable-saga-*table/function names with${STACK_NAME}-*variable patternAll fixes verified via live deployment to us-east-1 — happy path and compensation path both tested end-to-end.