Skip to content

fix(sdk-coin-xrp): enforce destination tag in verifyTransaction#9110

Draft
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/CSHLD-1115-xrp-destination-tag-verify
Draft

fix(sdk-coin-xrp): enforce destination tag in verifyTransaction#9110
bitgo-ai-agent-dev[bot] wants to merge 1 commit into
masterfrom
fix/CSHLD-1115-xrp-destination-tag-verify

Conversation

@bitgo-ai-agent-dev

Copy link
Copy Markdown

What

  • In Xrp.verifyTransaction, the address comparator was only checking the base XRP address and ignoring the destination tag (?dt=N). A prebuild targeting rXXXX?dt=0 would pass verification even if txParams.recipients[0].address was rXXXX?dt=123 (or no tag at all).
  • Fix: extract getAddressDetails results for both recipients and compare destinationTag in addition to the base address.
  • Added 5 unit tests covering: matching tags, no tags, dt=0 vs no-tag, no-tag vs dt=0, and mismatched non-zero tags.

Why

  • XRP destination tags route funds within a shared address (e.g. exchanges, custodians). A transaction sent to the wrong destination tag lands at an unintended account subdivision. The original recipient never receives the funds, causing "XRP transaction confirmed on-chain but not found in BitGo" from the user's perspective — the prebuild was silently approved with the wrong tag.

Test plan

  • cd modules/sdk-coin-xrp && BITGOJS_TEST_PASSWORD=test npx mocha 'test/unit/xrp.ts' — 136 tests pass including 5 new destination-tag enforcement tests
  • No lint errors from eslint src/xrp.ts test/unit/xrp.ts

Ticket: CSHLD-1115

The verifyTransaction comparator was only checking the base address
(stripping ?dt=N), allowing transactions with a different destination
tag to pass verification silently. A payment built for rXXXX?dt=123
would verify successfully even if the prebuild targeted rXXXX?dt=0,
causing the transaction to land at the wrong account subdivision and
never appear for the intended recipient.

Compare r1Details.destinationTag against r2Details.destinationTag so
that a mismatch between the intended and actual destination tag is
caught before the transaction is signed and submitted.

Ticket: CSHLD-1115

Co-Authored-By: Claude <noreply@anthropic.com>
Session-Id: 1cceafce-d4d3-4c86-a796-8e300680dc18
Task-Id: fa37dd24-b008-4d0e-b331-5db8f5e1371d
@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

CSHLD-1115

@bitgo-ai-agent-dev bitgo-ai-agent-dev Bot force-pushed the fix/CSHLD-1115-xrp-destination-tag-verify branch from 34f3ee1 to 447e960 Compare June 24, 2026 19:29
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.

0 participants