fix(core): pin ethereumjs-util to 7.1.5 for correct personal_sign behavior#11216
fix(core): pin ethereumjs-util to 7.1.5 for correct personal_sign behavior#11216originalix merged 1 commit intoxfrom
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Summary
ethereumjs-utilto version7.1.5in@onekeyhq/corepackage to fix referral code binding signature verification failureIntent & Context
User reported "Invalid signature" error when binding referral codes via HD wallet. The issue only appeared on local builds after v6.1.0, while production App worked correctly. Investigation revealed a dependency hoisting issue causing incorrect signature generation.
Root Cause
PR #10996 (
f45b62fdc3- "add OneKey CLI") introduced a new package that changed yarn's dependency hoisting strategy:node_modules/ethereumjs-utilwas7.1.5node_modules/ethereumjs-utilbecame5.1.0(from@starcoin/starcoin)The behavioral difference between versions:
ethereumjs-util@7.1.5:toBuffer()throws error for hex strings without0xprefixethereumjs-util@5.1.0:toBuffer()silently treats them as UTF-8 stringsThe
autoFixPersonalSignMessage()function relies ontoBuffer()throwing an error to detect raw hex and add the0xprefix. WhentoBuffer()doesn't throw, the raw hex string gets signed as plain text instead of decoded bytes, causing signature verification to fail on the server.Design Decisions
ethereumjs-util@7.1.5dependency to@onekeyhq/corepackage@starcoin/starcoinuses5.1.0)package.json- rejected because it would force all packages to use the same versionChanges Detail
packages/core/package.json: Added"ethereumjs-util": "7.1.5"to dependenciesyarn.lock: Updated to reflect the new dependencyRisk Assessment
Test plan
node_modules/ethereumjs-utilversion is7.1.5afteryarn install