MetaMask / eth-token-tracker

A JS module for tracking Ethereum token balances over block changes
ISC License
76 stars 44 forks source link

Add allow-scripts #118

Closed mcmire closed 8 months ago

mcmire commented 8 months ago

Adding @lavamoat/allow-scripts and @lavamoat/preinstall-always-fail is a prerequisite to upgrading to Yarn v3.

If you want to run tests or use this library locally, you will now need to run yarn setup instead of yarn install. This is temporary and the setup command will be changed back to yarn install when Yarn is upgraded to v3.

socket-security[bot] commented 8 months ago

New and removed dependencies detected. Learn more about Socket for GitHub โ†—๏ธŽ

Package New capabilities Transitives Size Publisher
npm/@lavamoat/allow-scripts@2.5.1 environment, filesystem, shell Transitive: network +121 5.76 MB boneskull
npm/@lavamoat/preinstall-always-fail@2.0.0 None 0 3.25 kB naugtur
npm/fs-minipass@2.1.0 filesystem +2 76.9 kB isaacs
npm/graceful-fs@4.2.11 environment, filesystem 0 32.5 kB isaacs
npm/is-core-module@2.13.1 None +2 72.5 kB ljharb
npm/minipass@3.3.6 None +1 62.8 kB isaacs
npm/minizlib@2.1.2 None +2 80.2 kB isaacs
npm/mkdirp@1.0.4 environment, filesystem 0 19.1 kB isaacs
npm/resolve@1.22.8 environment, filesystem +5 232 kB ljharb
npm/string-width@4.2.3 None +4 68 kB sindresorhus
npm/strip-ansi@6.0.1 None +1 9.64 kB sindresorhus
npm/tar@6.2.0 environment, filesystem +7 354 kB isaacs

๐Ÿšฎ Removed packages: npm/graceful-fs@4.1.15, npm/is-core-module@2.12.0, npm/resolve@1.22.2

View full reportโ†—๏ธŽ

socket-security[bot] commented 8 months ago

๐Ÿšจ 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 NoteSource
Network access npm/https-proxy-agent@5.0.1
Network access npm/https-proxy-agent@5.0.1
Network access npm/http-proxy-agent@5.0.0
Network access npm/http-proxy-agent@5.0.0
New author npm/npm-normalize-package-bin@3.0.1
New author npm/write-file-atomic@5.0.1
New author npm/which@3.0.1
New author npm/exponential-backoff@3.1.1
Network access npm/socks@2.7.1
Network access npm/agentkeepalive@4.5.0
Network access npm/agentkeepalive@4.5.0
New author npm/@npmcli/fs@2.1.2
Deprecated npm/@npmcli/move-file@2.0.1
  • Reason: This functionality has been moved to @npmcli/fs
New author npm/are-we-there-yet@3.0.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/make-fetch-happen@10.2.1
Network access npm/minipass-fetch@2.1.2
Network access npm/minipass-fetch@2.1.2
Network access npm/minipass-fetch@2.1.2
New author npm/nopt@6.0.0
New author npm/npmlog@6.0.2
Network access npm/socks-proxy-agent@7.0.0
Network access npm/socks-proxy-agent@7.0.0
New author npm/@npmcli/node-gyp@3.0.0
New author npm/read-cmd-shim@4.0.0
Shell access npm/@npmcli/promise-spawn@6.0.2
New author npm/unique-slug@3.0.0
New author npm/@lavamoat/aa@3.1.5
New author npm/cmd-shim@6.0.2
New author npm/hasown@2.0.0
Shell access npm/node-gyp@9.4.1
New author npm/node-gyp@9.4.1
Install scripts npm/@lavamoat/preinstall-always-fail@2.0.0
  • Install script: preinstall
  • Source: echo "Don't run npm lifecycle scripts by default! Create a .yarnrc or .npmrc and set enableScripts: false. Then, whitelist them with @lavamoat/allow-scripts" && exit 1
New author npm/json-parse-even-better-errors@3.0.1
New author npm/@lavamoat/allow-scripts@2.5.1
Shell access npm/@lavamoat/allow-scripts@2.5.1

View full reportโ†—๏ธŽ

Next steps

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.

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 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 shell access?

This module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.

Packages should avoid accessing the shell which can reduce portability, and make it easier for malicious shell access to be introduced.

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/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/https-proxy-agent@5.0.1
  • @SocketSecurity ignore npm/http-proxy-agent@5.0.0
  • @SocketSecurity ignore npm/npm-normalize-package-bin@3.0.1
  • @SocketSecurity ignore npm/write-file-atomic@5.0.1
  • @SocketSecurity ignore npm/which@3.0.1
  • @SocketSecurity ignore npm/exponential-backoff@3.1.1
  • @SocketSecurity ignore npm/socks@2.7.1
  • @SocketSecurity ignore npm/agentkeepalive@4.5.0
  • @SocketSecurity ignore npm/@npmcli/fs@2.1.2
  • @SocketSecurity ignore npm/@npmcli/move-file@2.0.1
  • @SocketSecurity ignore npm/are-we-there-yet@3.0.1
  • @SocketSecurity ignore npm/make-fetch-happen@10.2.1
  • @SocketSecurity ignore npm/minipass-fetch@2.1.2
  • @SocketSecurity ignore npm/nopt@6.0.0
  • @SocketSecurity ignore npm/npmlog@6.0.2
  • @SocketSecurity ignore npm/socks-proxy-agent@7.0.0
  • @SocketSecurity ignore npm/@npmcli/node-gyp@3.0.0
  • @SocketSecurity ignore npm/read-cmd-shim@4.0.0
  • @SocketSecurity ignore npm/@npmcli/promise-spawn@6.0.2
  • @SocketSecurity ignore npm/unique-slug@3.0.0
  • @SocketSecurity ignore npm/@lavamoat/aa@3.1.5
  • @SocketSecurity ignore npm/cmd-shim@6.0.2
  • @SocketSecurity ignore npm/hasown@2.0.0
  • @SocketSecurity ignore npm/node-gyp@9.4.1
  • @SocketSecurity ignore npm/@lavamoat/preinstall-always-fail@2.0.0
  • @SocketSecurity ignore npm/json-parse-even-better-errors@3.0.1
  • @SocketSecurity ignore npm/@lavamoat/allow-scripts@2.5.1
mcmire commented 8 months ago

All of the dependencies above are introduced by @lavamoat/allow-scripts and @lavamoat/preinstall-always-fail. I looked through them and nothing stands out. https-proxy-agent makes sense given the dependency tree:

[1/4] ๐Ÿค”  Why do we have the module "https-proxy-agent"...?
[2/4] ๐Ÿšš  Initialising dependency graph...
[3/4] ๐Ÿ”  Finding dependency...
[4/4] ๐Ÿšก  Calculating file sizes...
=> Found "https-proxy-agent@5.0.1"
info Reasons this module exists
   - "@lavamoat#allow-scripts#@npmcli#run-script#node-gyp#make-fetch-happen" depends on it
   - Hoisted from "@lavamoat#allow-scripts#@npmcli#run-script#node-gyp#make-fetch-happen#https-proxy-agent"
legobeat commented 8 months ago

All of the dependencies above are introduced by @lavamoat/allow-scripts and @lavamoat/preinstall-always-fail. I looked through them and nothing stands out. https-proxy-agent makes sense given the dependency tree:

[1/4] ๐Ÿค”  Why do we have the module "https-proxy-agent"...?
[2/4] ๐Ÿšš  Initialising dependency graph...
[3/4] ๐Ÿ”  Finding dependency...
[4/4] ๐Ÿšก  Calculating file sizes...
=> Found "https-proxy-agent@5.0.1"
info Reasons this module exists
   - "@lavamoat#allow-scripts#@npmcli#run-script#node-gyp#make-fetch-happen" depends on it
   - Hoisted from "@lavamoat#allow-scripts#@npmcli#run-script#node-gyp#make-fetch-happen#https-proxy-agent"

note: this should be a lot cleaner following the next release of @lavamoat/allow-scripts depending on a newer version of @npmcli/run-script