Skip to content

davidG999/lucky-package

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

17 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽ lucky-package

Feeling lucky? Try installing a random npm package

โš ๏ธ Disclaimer

While lucky-package performs security checks before installing anything, there's no guaranteed safety; a malicious or vulnerable package could still exist that has no security vulnerabilities publicly disclosed and passes all the checks. For more details, see Security concerns section.

๐Ÿ“ฅ Installation

npm install -g lucky-package

๐Ÿง Examples

Install a random package:

$ lucky-package install

  [1/4] ๐Ÿ”Ž Searching for a lucky package...
  [2/4] ๐ŸŽ‰ Found it! shittier
  [3/4] ๐Ÿš€ Installing...
  
  added 25 packages in 4s
  
  [4/4] โœ… Installed successfully! Run lucky-package --help to see all options

Install several random packages at once:

lucky-package install --amount=3

Undo the most recent installation:

lucky-package rollback

Feeling โœจ extra โœจ lucky? Try providing the --unsafe flag to include potentially dangerous packages in the search. Good luck ๐Ÿ™‚๐Ÿ™

lucky-package install --unsafe

๐Ÿ“– Usage

Command Alias Options Description
install i -a, --amount <number> Number of random packages to install.
Default: 1
-u, --unsafe Disables all preinstall security checks to include potentially dangerous packages in the search
-g, --global Install packages globally
rollback r -l, --last (default behaviour) Uninstall the most recent installed package(s) by lucky-package
-a, --all Uninstall all packages installed by lucky-package
config c -a, --audit <boolean> Specify whether to run npm audit after installation.
Default: false

๐Ÿ‘ฎ Security concerns

Preinstall security checks

By default, lucky-package uses npq to analyze each package before installation. This handy tool covers a range of security checks. The following checks from npq are being used:

  1. Scripts โ€” Excludes packages that have pre/post install script (which could potentially be malicious).
  2. Snyk โ€” Excludes packages that have been found with vulnerabilities in Snyk's database.
  3. Typosquatting โ€” Excludes packages with names similar to popular packages. See typosquatting.

Why only these three checks?

Running every npq check and finding a package that passes all of them can be very slow, which could ruin the fun! The checks are balanced for speed and safety.

Using --unsafe option

The --unsafe option disables all preinstall security checks mentioned above. This can lead to the installation of risky or malicious packages and is not recommended unless you know what you're doing.

Postinstall security checks

By default, npm audit is disabled with the --no-audit flag during installation, so you won't see audit messages like these:

audited 262 packages in 2s

found 0 vulnerabilities

Why is npm audit disabled by default?

The npm audit command is disabled by default to enhance the installation speed of your packages. Since security checks are already performed during the pre-installation phase using npq, running npm audit afterward can prolong the process.
If you prefer to enable this additional layer of security, you can easily configure the audit option:

lucky-package config --audit=true

About

๐ŸŽ Feeling lucky? Try installing a random npm package

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors