-
-
Notifications
You must be signed in to change notification settings - Fork 93
deps: Replace eth-sig-util@^2 with @metamask/eth-sig-util@^6 #157
Conversation
1b3e758
to
6ec437d
Compare
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. Ignoring: Next stepsTake a deeper look at the dependencyTake a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev. Remove the packageIf you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency. Mark a package as acceptable riskTo ignore an alert, reply with a comment starting with |
@SocketSecurity ignore @ethereumjs/[email protected] [email protected] (these are both packages we use throughout are dependency graph that we trust) |
@adonesky1 Are you still intending to pick this up? FYI |
Removed dependencies detected. Learn more about Socket for GitHub ↗︎ 🚮 Removed packages: @lavamoat/[email protected], @types/[email protected] |
070eb91
to
4c032c5
Compare
network access ok |
SocketSecurity alerts addressed in: |
|
@adonesky1 I bumped this to |
jest.mock('@metamask/eth-sig-util', () => { | ||
return { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
__esModule: true, | ||
...jest.requireActual('@metamask/eth-sig-util'), | ||
}; | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@legobeat is this necessary. Don't understand what, if anything, this is doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in order to mock the new version (see error this is addressing here:
FAIL src/ledger-keyring.test.ts (14.651 s)
● LedgerKeyring › signPersonalMessage › should call create a listener waiting for the iframe response
Cannot spyOn on a primitive value; undefined given
616 |
617 | jest
> 618 | .spyOn(sigUtil, 'recoverPersonalSignature')
| ^
619 | .mockReturnValue(fakeAccounts[0]);
620 |
621 | await keyring.signPersonalMessage(fakeAccounts[0], 'some message');
at ModuleMocker.spyOn (node_modules/jest-mock/build/index.js:774:13)
at Object.<anonymous> (src/ledger-keyring.test.ts:618:10)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a common approach when bundling all exports from an import into one variable and then spying on an individual export. Basically we're making a copy of sigUtil
so that all properties are writable (jest.spyOn
reassigns the property you spy on).
@legobeat this looks good to me. I can't approve since I opened the PR |
f709645
to
88625cd
Compare
jest.mock('@metamask/eth-sig-util', () => { | ||
return { | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
__esModule: true, | ||
...jest.requireActual('@metamask/eth-sig-util'), | ||
}; | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is a common approach when bundling all exports from an import into one variable and then spying on an individual export. Basically we're making a copy of sigUtil
so that all properties are writable (jest.spyOn
reassigns the property you spy on).
"hdkey": "0.8.0" | ||
}, | ||
"devDependencies": { | ||
"@ethereumjs/common": "^3.1.1", | ||
"@lavamoat/allow-scripts": "^2.3.0", | ||
"@ledgerhq/hw-app-eth": "^6.32.0", | ||
"@ledgerhq/types-cryptoassets": "^7.6.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these extra dependencies necessary? I don't see them being used in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're used by sibling modules: https://github.com/MetaMask/eth-ledger-bridge-keyring/actions/runs/6577714417/job/17869959528?pr=201
Error: node_modules/@ledgerhq/domain-service/lib/types.d.ts(1,26): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: node_modules/@ledgerhq/types-live/lib/account.d.ts(2,58): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: node_modules/@ledgerhq/types-live/lib/bridge.d.ts(3,37): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: node_modules/@ledgerhq/types-live/lib/manager.d.ts(3,37): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: node_modules/@ledgerhq/types-live/lib/portfolio.d.ts(2,52): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: node_modules/@ledgerhq/types-live/lib/transaction.d.ts(2,27): error TS2307: Cannot find module '@ledgerhq/types-cryptoassets' or its corresponding type declarations.
Error: Process completed with exit code 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
TODO:
recoverPersonalSignature
with this update.