Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace @metamask/ethjs-{contract,query} packages with @ethersproject for EIP1193 compatibility #155

Merged

Conversation

cryptodev-2s
Copy link
Contributor

@cryptodev-2s cryptodev-2s commented Jan 16, 2025

This PR replaces @metamask/ethjs-contract and @metamask/ethjs-query, which lack EIP-1193 compatibility, with their respective alternatives from @ethersproject.

Fixes: #156

@cryptodev-2s cryptodev-2s requested a review from a team as a code owner January 16, 2025 14:04
Copy link

socket-security bot commented Jan 16, 2025

New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@ethersproject/[email protected] None 0 498 kB ricmoo
npm/@ethersproject/[email protected] None 0 61 kB ricmoo
npm/@ethersproject/[email protected] None 0 82.2 kB ricmoo
npm/@ethersproject/[email protected] None 0 33.1 kB ricmoo
npm/@ethersproject/[email protected] None 0 11.3 kB ricmoo
npm/@ethersproject/[email protected] None 0 30.1 kB ricmoo
npm/@ethersproject/[email protected] None 0 143 kB ricmoo
npm/@ethersproject/[email protected] None 0 80.9 kB ricmoo
npm/@ethersproject/[email protected] None 0 18.7 kB ricmoo
npm/@ethersproject/[email protected] None 0 250 kB ricmoo
npm/@ethersproject/[email protected] None 0 257 kB ricmoo
npm/@ethersproject/[email protected] None 0 6.09 kB ricmoo
npm/@ethersproject/[email protected] None 0 69.5 kB ricmoo
npm/@ethersproject/[email protected] None 0 47.5 kB ricmoo
npm/@ethersproject/[email protected] None 0 31 kB ricmoo
npm/@ethersproject/[email protected] network 0 1.2 MB ricmoo
npm/@ethersproject/[email protected] None 0 17.3 kB ricmoo
npm/@ethersproject/[email protected] None 0 29.6 kB ricmoo
npm/@ethersproject/[email protected] None 0 21.7 kB ricmoo
npm/@ethersproject/[email protected] None 0 244 kB ricmoo
npm/@ethersproject/[email protected] None 0 119 kB ricmoo
npm/@ethersproject/[email protected] None 0 89.6 kB ricmoo
npm/@ethersproject/[email protected] network 0 128 kB ricmoo
npm/@trufflesuite/[email protected] 🔁 npm/@trufflesuite/[email protected] None 0 270 kB davidmurdoch
npm/@trufflesuite/[email protected] environment, network +3 119 MB davidmurdoch
npm/[email protected] None 0 484 kB vweevers
npm/[email protected] None 0 19.2 kB ahultgren
npm/[email protected] None 0 541 kB hargasinski
npm/[email protected] None 0 9.98 kB junderw
npm/[email protected] 🔁 npm/[email protected] None +1 214 kB indutny
npm/[email protected] 🔁 npm/[email protected] None 0 55.2 MB truffle-cicd
npm/[email protected] 🔁 npm/[email protected], npm/[email protected] None 0 52.9 kB emn178
npm/[email protected] 🔁 npm/[email protected] Transitive: environment, filesystem +1 788 kB fanatid
npm/[email protected] None 0 30.3 kB vweevers
npm/[email protected] None 0 35.9 kB vweevers
npm/[email protected] None 0 1.41 MB bnjmnt4n
npm/[email protected] None 0 7.28 kB vweevers
npm/[email protected] 🔁 npm/[email protected] None 0 12.8 kB mafintosh
npm/[email protected] 🔁 npm/[email protected] None 0 1.89 MB fanatid
npm/[email protected] network 0 113 kB lpinca

🚮 Removed packages: npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/@metamask/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected], npm/[email protected]

View full report↗︎

Copy link

socket-security bot commented Jan 16, 2025

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
New author npm/[email protected] 🚫
High CVE npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
High CVE npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Network access npm/[email protected] 🚫
Native code npm/[email protected] 🚫
New author npm/[email protected] 🚫
Network access npm/@ethersproject/[email protected] 🚫
Network access npm/@ethersproject/[email protected] 🚫
Network access npm/@ethersproject/[email protected] 🚫
Network access npm/@ethersproject/[email protected] 🚫
Native code npm/[email protected] 🚫
Network access npm/@trufflesuite/[email protected] 🚫
New author npm/@trufflesuite/[email protected] 🚫
AI-detected potential code anomaly npm/[email protected]
  • Notes: While the script is intended for legitimate purposes, the direct execution of potentially unsanitized input through 'process.argv' in the exec() function poses a significant security risk.
  • Confidence: 1.00
  • Severity: 0.60
⚠︎
NPM Shrinkwrap npm/[email protected] ⚠︎
Low CVE npm/[email protected] ⚠︎
Low CVE npm/[email protected] ⚠︎
Low CVE npm/[email protected] ⚠︎
Low CVE npm/[email protected] ⚠︎
Low CVE npm/[email protected] ⚠︎

View full report↗︎

Next steps

What is new author?

A new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.

Scrutinize new collaborator additions to packages because they now have the ability to publish code into your dependency tree. Packages should avoid frequent or unnecessary additions or changes to publishing rights.

What is a CVE?

Contains a high severity Common Vulnerability and Exposure (CVE).

Remove or replace dependencies that include known high severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Why is native code a concern?

Contains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.

Verify that the inclusion of native code is expected and necessary for this package's functionality. If it is unnecessary or unexpected, consider using alternative packages without native code to mitigate potential risks.

What is an AI-detected potential code anomaly?

AI has identified unusual behaviors that may pose a security risk.

An AI system found a low-risk anomaly in this package. It may still be fine to use, but you should check that it is safe before proceeding.

What is a shrinkwrap file?

Package contains a shrinkwrap file. This may allow the package to bypass normal install procedures.

Packages should never use npm shrinkwrap files due to the dangers they pose.

What is a mild CVE?

Contains a low severity Common Vulnerability and Exposure (CVE).

Remove or replace dependencies that include known low severity CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Take a deeper look at the dependency

Take 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 package

If 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 risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@cryptodev-2s cryptodev-2s changed the title feat: replace ethjs* packages with @ethersproject feat: replace ethjs* packages with @ethersproject for EIP1193 compatibility Jan 16, 2025
package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@cryptodev-2s cryptodev-2s changed the title feat: replace ethjs* packages with @ethersproject for EIP1193 compatibility feat: replace ethjs* packages with ethers for EIP1193 compatibility Jan 20, 2025
@cryptodev-2s cryptodev-2s changed the title feat: replace ethjs* packages with ethers for EIP1193 compatibility feat: replace @metamask/ethjs* packages with ethers for EIP1193 compatibility Jan 20, 2025
@cryptodev-2s cryptodev-2s changed the title feat: replace @metamask/ethjs* packages with ethers for EIP1193 compatibility feat: replace @metamask/ethjs-{contract,query} packages with ethers for EIP1193 compatibility Jan 20, 2025
test/unit/index.js Outdated Show resolved Hide resolved
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had one blocking comment but other than that, looks good to me.

test/helper.js Outdated Show resolved Hide resolved
test/integration/human-standard-token.js Show resolved Hide resolved
test/unit/index.js Outdated Show resolved Hide resolved
@cryptodev-2s cryptodev-2s requested a review from mcmire January 21, 2025 00:17
@cryptodev-2s cryptodev-2s changed the title feat: replace @metamask/ethjs-{contract,query} packages with ethers for EIP1193 compatibility feat: replace @metamask/ethjs-{contract,query} packages with @ethersproject for EIP1193 compatibility Jan 21, 2025
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me!

@cryptodev-2s cryptodev-2s merged commit 0f783c6 into main Jan 21, 2025
18 of 19 checks passed
@cryptodev-2s cryptodev-2s deleted the cryptodev2s/replace-eths-package-with-ethersproject branch January 21, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make module fully EIP-1193 compliant
3 participants