fix(transfer): enforce transfer quote binding and request key idempot… - #1691
Merged
Baskarayelu merged 2 commits intoAug 30, 2026
Merged
Conversation
…ency - Incorporate quoteId, quoteHash, requestKey, and nonce into EmergencyTransferConfig schema, validation, and binding key derivation. - Add payload immutability enforcement using Object.freeze and runtime validation via Zod schemas. - Implement completed operations tracking in useEmergencyTransfer to guarantee idempotent replay and detect conflicting request key re-use. - Add explicit event tracking for CONFLICTING_KEY_REUSED, REVIEW_STARTED, CONFIRMATION_BOUND, SUBMIT_ATTEMPTED, SUBMIT_SUCCEEDED, SUBMIT_FAILED, DUPLICATE_BLOCKED, EXPIRED, CONFIG_CHANGED, and UNAUTHORIZED. - Update EmergencyTransferReviewPanel and EmergencyTransferDialog UI components to present quote ID, quote hash, request key, and nonce details cleanly. - Expand unit test suite with 76 comprehensive test cases covering idempotency, replay safety, payload immutability, config drift, and error handling. Closes Remitwise-Org#1652
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.
Description
Resolves #1652 by implementing transfer quote binding and request key idempotency within the emergency transfer subsystem (
meridian-web).Key Implementation Details
Quote & Request Key Binding:
EmergencyTransferConfigandConfirmationPayloadto includequoteId,quoteHash,requestKey, andnonce.deriveBindingKey()to incorporate all entropy sources into the deterministic binding key (bk_<hash>).Idempotency & Replay Protection:
useEmergencyTransfertracks completed operations in an internal operations registry (completedOperationsRef).txHashdeterministically without re-executing the transaction provider.CONFLICTING_KEY_REUSEDevent and halts execution.Payload Immutability & Validation:
bindConfirmation()freezes the derivedConfirmationPayloadusingObject.freeze()and validates it againstConfirmationPayloadSchema.UI Audit Trail:
EmergencyTransferReviewPanelto display Quote ID, Request Key, and Nonce metadata.config_changedand idempotency failure states gracefully inEmergencyTransferDialog.Testing Strategy
76 passed).Closes #1652