Skip to content

fix(transfer): enforce transfer quote binding and request key idempot… - #1691

Merged
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
Appsoft1000:fix/transfer-quote-idempotency-1652
Aug 30, 2026
Merged

fix(transfer): enforce transfer quote binding and request key idempot…#1691
Baskarayelu merged 2 commits into
Remitwise-Org:mainfrom
Appsoft1000:fix/transfer-quote-idempotency-1652

Conversation

@Appsoft1000

Copy link
Copy Markdown

Description

Resolves #1652 by implementing transfer quote binding and request key idempotency within the emergency transfer subsystem (meridian-web).

Key Implementation Details

  1. Quote & Request Key Binding:

    • Extended EmergencyTransferConfig and ConfirmationPayload to include quoteId, quoteHash, requestKey, and nonce.
    • Updated deriveBindingKey() to incorporate all entropy sources into the deterministic binding key (bk_<hash>).
  2. Idempotency & Replay Protection:

    • useEmergencyTransfer tracks completed operations in an internal operations registry (completedOperationsRef).
    • Safe Retry: Re-submitting with the exact same request key and payload parameters returns the cached txHash deterministically without re-executing the transaction provider.
    • Conflict Protection: Re-using a request key with altered payload parameters (e.g. modified amount or recipient) triggers a CONFLICTING_KEY_REUSED event and halts execution.
  3. Payload Immutability & Validation:

    • bindConfirmation() freezes the derived ConfirmationPayload using Object.freeze() and validates it against ConfirmationPayloadSchema.
    • Prevents runtime property tampering prior to transaction submission.
  4. UI Audit Trail:

    • Updated EmergencyTransferReviewPanel to display Quote ID, Request Key, and Nonce metadata.
    • Handled config_changed and idempotency failure states gracefully in EmergencyTransferDialog.

Testing Strategy

  • Unit test suite expanded to 76 tests covering happy path, payload immutability, expiry, config drift, duplicate submission, provider rejections, safe retries, and conflicting key reuse.
  • All vitest tests pass cleanly (76 passed).

Closes #1652

Aycode01 and others added 2 commits August 29, 2026 13:20
…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
@Baskarayelu
Baskarayelu merged commit 40a7dc0 into Remitwise-Org:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Quality][High] transfer composition and quotes: replay and idempotency — QE-2026-08

3 participants