Repository navigation
Conversation
…data Verify EVM TSS tokenApproval intents and ERC-7984 confidentialTransfer payment calldata against raw serialized transaction bytes instead of warning and signing unchecked. - Decode raw txHex via EthTransactionData.fromSerialized (bypassing TransactionBuilder reserialization) in single payment, batch payment, and tokenApproval verification so calldata cannot be altered. - Fail closed on tokenApproval unless to matches the declared token contract, value is 0, calldata is canonical approve(address,uint256), spender matches the network batcher, and amount is MAX_UINT256. Keep assertWrapperApproveIsDeclared running before tokenApproval. - Enforce confidentialTransfer(address,bytes32,bytes) on ERC-7984 payments (canonical ABI, declared token contract, declared recipient, zero native value, non-empty handle and proof) and reject ERC-7984 batches; keep only the encrypted amount as a warning. - Harden Erc7984Token.verifyConfidentialTransfer with zero native value, canonical ABI, and single-recipient checks. - Propagate top-level intent.tokenName in sdk-core resolveEffectiveTxParams so stored tokenApproval intents without caller txParams still verify. Ticket: CECHO-2689 Co-authored-by: Ralph CLI <ralph-cli@bitgo.com> Ralph: 18.13.2-bitgo.13 openrouter/deepseek/deepseek-v4.1-flash-1017@default:high+task:high openrouter/z-ai/glm-5.3-flash@smol:low+commit:high+memory:low openrouter/anthropic/claude-opus-5.5@slow:high+plan:xhigh openrouter/openai/gpt-6.1-terra@vision:low+advisor:medium openrouter/inclusionai/ling-3.1-flash@tiny:low openrouter/moonshotai/kimi-k3.1-pro@designer:high openrouter/google/gemini-3-pro-image@image web/exa@web openrouter/microsoft/mai-transcribe-2@dictation openrouter/typesafe/jev-1.14@judge
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
Contributor
Contributor
|
|
…ytes resolveEffectiveTxParams copied the stored intent's tokenName for every type, so a caller's native payment could be verified as a payment of the stored token. Copy it only for tokenApproval. Erc7984Token's confidential transfer check decoded a rebuilt copy that drops trailing calldata; decode the original bytes with the shared helper. Ticket: CECHO-2689
This branch has not been deployed
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
Hardens EVM TSS transaction verification for
tokenApprovalintents and ERC-7984 confidential payment calldata (transfer/ storedpayment), closing the gaps tracked in CECHO-2689 (including the Nov 19 ERC-7984 payment-calldata addition from Sanket'sv54.4.0retest on CECHO-1905).Raw-bytes verification (no builder reserialization)
AbstractEthLikeNewCoins.decodeRawTssTxFields(modules/abstract-eth/src/abstractEthLikeNewCoins.ts) decodestxPrebuild.txHexdirectly withEthTransactionData.fromSerialized(txHex, common)instead of routing throughTransactionBuilder.from()/.build().to,value, anddatabytes being signed. Used byverifyTssSinglePayment,verifyTssBatchPayment, andverifyTssTokenApproval.tokenApprovalfail-closed verification & wrapper-approve guardverifyTssTokenApprovalfails closed withTxIntentMismatchRecipientErrorunless:txParams.tokenNameresolves to a token contract on the current network,toequals the declared token contract,valueis0,datais canonicalapprove(address,uint256)(0x095ea7b3; rejects trailing bytes / dirty padding),spenderequals the network's configuredbatcherContractAddress,amountequalsMAX_UINT256(2^256 - 1).tokenApprovalis added toTSS_DEDICATED_INTENT_TYPESand runs afterassertWrapperApproveIsDeclared, preserving the ERC-7984 wrapper-approve guard so a relabelledapprove(wrapper, …)still fails with the wrapper-approve error.ERC-7984
confidentialTransferpayment rules & encrypted-amount limitverifyTssSinglePaymentno longer warns and returns on non-ERC-20 calldata when the declared token is anErc7984Coin:resolveTssTokennow returnscontractforErc7984Coin.confidentialTransfer(address,bytes32,bytes)(0x2fb74e62),toequal to the declared token contract, decoded recipient equal torecipient.address,value == 0, non-zero 32-byteencryptedHandle, and non-emptyinputProof. Any other calldata (includingapprove(attacker, MAX_UINT256)) is rejected.euint64ciphertext + input proof), the plaintext amount cannot be compared client-side; only that field stays a warning (encrypted amount cannot be verified against declared plaintext amount).verifyTssBatchPaymentfails closed if any recipient names an ERC-7984 confidential token.Erc7984Token.verifyConfidentialTransfer(modules/sdk-coin-eth/src/erc7984Token.ts, token-coin path not retested in Phase 1) now also enforces zero native value, canonical ABI encoding for both direct andsendMultiSig-wrapped shapes, and single-recipient intents whentxHexis present, with the encrypted-amount verification limit documented on the method.sdk-coretokenNamepropagation for stored approvalsTransactionParams.tokenName(modules/sdk-core/src/bitgo/baseCoin/iBaseCoin.ts) andresolveEffectiveTxParams(modules/sdk-core/src/bitgo/utils/tss/recipientUtils.ts) propagate top-levelintent.tokenNamewhen callertxParamsomits it.tokenApprovalintents storetokenNameat the intent root with norecipients(657/657 rows); pending-approval / stored-intent signing (EcdsaUtils/EcdsaMPCv2Utils) carries no callertxParams, so propagation is required for stored approvals to verify.Overlap & known semantic conflict with open PRs (#10203, #10204)
masterdirectly.modules/sdk-coin-eth/test/unit/eth.ts: direct + semantic conflict. fix(abstract-eth): verify contractCall and customTx EVM TSS intents #10203 moves several wrapper-approve "untouched type" assertions fromcustomTxtotokenApprovalexpectingverifyTransactionto returntruefor arbitrary-spender approvals. With CECHO-2689 enforced, thosetokenApprovalcalls now reject. Whichever PR merges second must rebase and retarget those assertions (this branch moves them totransferToken/customTx).modules/abstract-eth/src/abstractEthLikeNewCoins.ts: overlapping regions nearTSS_DEDICATED_INTENT_TYPESandverifyTssTransactionrouting.modules/sdk-coin-eth/test/unit/tssPaymentVerification.ts: non-overlapping hunks.abstractEthLikeNewCoins.tsand distinct files insdk-core; raw-byte decoding works across bothsignableHexandserializedTxHexroutes.Scope boundaries
v54.4.0.EvmCoinlegacy bypasses remain tracked in CECHO-2683, and multisig (non-TSS)tokenApprovalverification is out of scope for this TSS ticket.Issue Number
CECHO-2689 (related: CECHO-1905)
Type of change
tokenApprovalintents and non-confidentialTransfercalldata on ERC-7984 payments)How Has This Been Tested?
modules/sdk-coin-eth): 44 passing coveringtokenApproval(matching, wrong token contract, wrong spender, finite amount, nonzero value, wrong selector, non-canonical trailing bytes, missing/unresolvable token, retained wrapper-approve guard precedence), ERC-7984 payments (matching with amount-only warning,approve(attacker, MAX)rejection, wrong recipient/token/value/trailing bytes, batch rejection),Erc7984Tokencoin-path checks (direct &sendMultiSigvalue, trailing bytes, multi-recipient), and storedtokenApprovalsigning via bothEcdsaUtils(MPCv1) andEcdsaMPCv2Utils(MPCv2) onsignableHexandserializedTxHex.intent.tokenNamepropagation caused all 6 stored-approval signing tests to fail; restoring it returned all 6 to passing.modules/sdk-core/test/unit/bitgo/utils/tss/recipientUtils.ts: 50 passingmodules/abstract-eth/test/unit/coin.ts: 217 passingmodules/sdk-coin-evm/sdk-coin-bsc/sdk-coin-xdc: 40 / 45 / 65 passingmodules/sdk-coin-ethfull suite: 617 passing, 1 failing — pre-existing unrelated failure intest/unit/ethSafeRecovery.ts(TypeError: Cannot read properties of undefined (reading 'generateVrfDKGKeyShares')from a stale@bitgo/sdk-lib-mpccopy lackingDklsVrfUtilsin this worktree environment; untouched by this PR).MARTS.WALLET_PLATFORM.BITGO2__TRANSACTION_REQUEST,LATEST = TRUE,STATE = 'delivered'):tokenApproval: 17/17 verified across ETH (usdc,usdt,aave,eigen), Polygon (polygon:usdc,polygon:usdcv2), and legacy type-0 BSC (bsc:usdt). Production-derived tamper test (swapping real spender for an attacker address) rejected withtokenApproval transaction spender does not match the network batcher contract.hoodeth:*approvals (unreplayed): 9 sampled rows on chainId4663could not be replayed because@bitgo/staticsexposeshoodethonly as a token prefix with no base coin instance; their calldata matches the sameapprove(batcher, MAX_UINT256)shape with zero value.0x2fb74e62orpaymentintents naming ERC-7984 tokens; verified instead against realTransferBuilderERC7984and Wallet PlatformbuildConfidentialTransferCalldatashapes.lint-staged(prettier --write,eslint --fix) andcommitlintpassed on commit.Checklist: