core icon indicating copy to clipboard operation
core copied to clipboard

feat: make SafeEventEmitterProvider compatible with eth req libraries

Open cryptodev-2s opened this issue 1 year ago • 5 comments

Explanation

  • Aligning SafeEventEmitterProvider to EIP-1193 by adding a request method and deprecating sendAsync (which aren't part of the spec)
  • Ensuring that request does not require id and jsonrpc to be set, filling them in if they are missing

References

Fixes #4095

Changelog

@metamask/eth-json-rpc-provider

  • ADDED: request method type compatible with ethereum request libraries.
  • CHANGED: markes sendAsync as deprecated for usage in favor of request.

Checklist

  • [ ] I've updated the test suite for new or updated code as appropriate
  • [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • [ ] I've highlighted breaking changes using the "BREAKING" category above as appropriate

cryptodev-2s avatar Jun 13 '24 15:06 cryptodev-2s

🚨 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
Deprecated npm/[email protected]
  • Reason: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
🚫
Install scripts npm/[email protected]
  • Install script: postinstall
  • Source: node -e "try{require('./postinstall')}catch(e){}"
🚫

View full report↗︎

Next steps

What is a deprecated package?

The maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.

Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

What is an install script?

Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.

Packages should not be running non-essential scripts during install and there are often solutions to problems people solve with install scripts that can be run at publish time instead.

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

socket-security[bot] avatar Jun 13 '24 16:06 socket-security[bot]

@cryptodev-2s Hey! I still think we ought to add smoke tests so that we can be confident that these changes fix the compatibility issues we have with the various Ethereum libraries. I outlined ideas for this in the comment above. What are your thoughts?

mcmire avatar Jun 25 '24 17:06 mcmire

@cryptodev-2s Hey! I still think we ought to add smoke tests so that we can be confident that these changes fix the compatibility issues we have with the various Ethereum libraries. I outlined ideas for this in the comment above. What are your thoughts? @mcmire yes make sense I will add smoke tests as outlined in your comment

cryptodev-2s avatar Jun 25 '24 18:06 cryptodev-2s

One more comment from me above and then I think we may be good to go on this.

mcmire avatar Jul 03 '24 19:07 mcmire

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

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] None +6 1.46 MB lgbot
npm/@metamask/[email protected] Transitive: environment, eval, filesystem +6 2.94 MB lgbot
npm/@metamask/[email protected] None +3 92.5 kB metamaskbot
npm/[email protected] network +5 19 MB ricmoo

🚮 Removed packages: npm/[email protected]

View full report↗︎

socket-security[bot] avatar Jul 06 '24 00:07 socket-security[bot]