fix(ttx): enforce recipient data registration on external withdrawal path#1923
Open
adecaro wants to merge 1 commit into
Open
fix(ttx): enforce recipient data registration on external withdrawal path#1923adecaro wants to merge 1 commit into
adecaro wants to merge 1 commit into
Conversation
3c7daff to
9fe6d6e
Compare
…path getRecipientIdentity accepted caller-supplied RecipientData as-is when driving a withdrawal for an external wallet, with no check that the identity/audit-info pair was ever registered against the local wallet. Resolve the wallet and call RegisterRecipient before using the data, so a mismatched pair is rejected instead of silently accepted. Remove the now-redundant manual RegisterRecipient call in the integration caller. Fixes #1922 Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
9fe6d6e to
92d866c
Compare
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
RequestWithdrawalView.getRecipientIdentityaccepted caller-suppliedRecipientDatafor the external-wallet withdrawal path as-is, with no check that the identity/audit-info pair was ever registered against the local wallet.w.RegisterRecipient(ctx, r.RecipientData)before using the data to drive the withdrawal handshake, so a mismatched identity/audit-info pair is rejected instead of silently accepted (AnonymousOwnerWallet.RegisterRecipientrunsDeserializer.MatchIdentitybefore registering/binding).RegisterRecipientcall inintegration/token/fungible/views/withdraw.go, since the library now enforces it.docs/services/ttx.mdto document the new enforcement point and its scope (full protection requires anAnonymousOwnerWallet-backed local wallet;LongTermOwnerWalletvalidation was addressed separately in LongTermOwnerWallet.RegisterRecipient was an unconditional no-op, bypassing recipient validation #1917).Fixes #1922
Test plan
go build ./...and(cd integration && go build ./...)succeedtoken/services/ttx/withdrawal_test.gocover: registration succeeds (external flag set, nil wallet returned), registration fails (error bubbles up, external flag not set), and the unchanged local-wallet fallback path (noRecipientDatasupplied)go test ./token/services/ttx/...passesmake checkspasses