Repository navigation
fix(sdk-core): skip ECDH keychain lookup in bulkAcceptShare when unneeded (WCN-3735) - #10024
Conversation
|
|
a917aff to
918423e
Compare
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
|
@claude review |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
…eded (Refs: WCN-3735) bulkAcceptShare always fetched and decrypted the user's ECDH sharing keychain, even for batches made only of userMultiKeyRotationRequired shares (Go Account / OFC). Those shares carry no keychain and generate a fresh keypair encrypted with the login password, so they never use the ECDH key. A user without an ECDH keychain could therefore not accept them and saw "encryptedXprv was not found on sharing keychain". Fetch the keychain only when at least one selected share has a keychain, as bulkUpdateWalletShare already does, and assert the decrypted key exists before deriving the shared secret, with a client-readable message. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…WCN-3735) getECDHKeychain returned an Error object instead of throwing it when the user's settings had no ecdhKeychain. Callers read encryptedXprv off the result, so they reported "encryptedXprv was not found on sharing keychain" instead of the real cause. The error now tells the client the account is missing its sharing key and to contact support@bitgo.com so it can be set up. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
918423e to
41375d2
Compare
|
@claude review |
f2cd3fc to
12675b8
Compare
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
There was a problem hiding this comment.
The latest commit fixes the wrong-password issue I raised earlier, and I found no new bugs. A code owner should still look, because this changes how keys are handled when accepting wallet shares.
What was reviewed:
bulkAcceptSharenow always fetches the ECDH keychain. When the user has one, it still decrypts it withuserLoginPassword, so a mistyped password is rejected for batches that contain only Go Account/OFC shares.- When the keychain is missing, the per-share
assertstops a share that has a keychain before any ECDH derivation runs. - The other callers (wallets.ts:1283 and :1560, v1 wallets.ts:250,
getECDHKeypairPrivate) now get an error thrown earlier with a clearer message. Before, they hitencryptedXprvon a returnedError, so their behavior is otherwise unchanged.
Extended reasoning...
The change touches getECDHKeychain in sdk-api, the BitGoBase interface, and Wallets.bulkAcceptShare in sdk-core, plus unit tests. It handles the decryption of the ECDH sharing key and the check on the login password used to encrypt new wallet keys, which is crypto-sensitive. CODEOWNERS assigns sdk-core and sdk-api to the wallet-core teams. One known limit remains: if a user has no ECDH keychain, a batch of only multi-key rotation shares has nothing to check the password against. Before this change, those users could not accept such shares at all.
PR Review: #10024 — skip the ECDH keychain for bulk multi-key share acceptanceAuthor: Zahin Mohammad · Changes: +125/−12 across 5 files · Ticket: WCN-3735 TL;DR
Finding[P1] Validate the password when the ECDH keychain is missingVERIFIED. When Trigger: a user with no Elliptic Curve Diffie-Hellman (ECDH) sharing key accepts only user multi-key rotation (UMKR) shares, omits Use a server-backed password check before creating the encryption session or key when no ECDH key is available. ASSUMED / human check: another application may validate the password before calling this public Software Development Kit (SDK) method. That is not visible in this repository and would not protect direct SDK callers, so it should not be the method's safety boundary. Summary and data flowThis change makes The implemented flow is: list incoming shares; detect whether any conventional share needs ECDH; call Ticket alignment
Database index analysisNo new database query is introduced; this change only performs existing HTTP client operations. Type safety[P3] No added VerificationFocused tests were run in a temporary detached worktree at commit Commands and real outputThe current GitHub checks are also green on Node.js 22, 24, and 26: BitGo SDK run. Alternatives considered
Glossary
Generated by the |
Creating a login password also creates the Elliptic Curve Diffie-Hellman (ECDH) sharing key. The affected account authenticated with a passkey and, per CUS-2179, had skipped both one-time password setup and ECDH creation. In the missing-ECDH branch there is therefore no login password to verify; adding Follow-up #10069 keeps that behavior and addresses the valid type-safety/documentation finding by giving |
Ticket: WCN-3735 (follow-up to support ticket CUS-2174)
Problem
Wallets.bulkAcceptSharealways fetched and decrypted the user's ECDH sharing keychain, even when every selected share is a multi-key rotation share (userMultiKeyRotationRequired: true, e.g. Go Account / OFC). Those shares carry no keychain and generate a fresh keypair encrypted with the login password, so they never use the ECDH key.For a user whose settings have
ecdhKeychain: null(confirmed on prod for the CUS-2174 user),getECDHKeychain()returned anErrorobject instead of throwing.bulkAcceptShareread.encryptedXprvoff it, gotundefined, and surfacedencryptedXprv was not found on sharing keychainin the Accept Keys modal.Changes
sdk-core:bulkAcceptSharefetches and decrypts the ECDH keychain only when at least one selected share has a keychain (same idea ashasSharesRequiringDecryptioninbulkUpdateWalletShare), and asserts the decrypted key exists before deriving the shared secret.sdk-api:getECDHKeychainnow throwsecdh keychain not found for userinstead of returning theError. All in-repo callers readencryptedXprvoff the result, so none relied on the returned value.Tests
getECDHKeychain(fails without the fix).encryptedXprv was not found on sharing keychain.getECDHKeychainrejects when the user has noecdhKeychain(fails without the fix).walletsEncryptionVersion.ts(13 passing) andmodules/sdk-api/test/unit/bitgoAPI.ts(75 passing);tsc --noEmiton sdk-core clean. The largermodules/bitgowallets suite was not run.Not covered
@bitgo-beta/sdk-corebump after release before users see the fix.🤖 Generated with Claude Code