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

[Rule] Suspicious packages #3

Open
iranreyes opened this issue Aug 22, 2019 · 0 comments · May be fixed by #12
Open

[Rule] Suspicious packages #3

iranreyes opened this issue Aug 22, 2019 · 0 comments · May be fixed by #12
Assignees

Comments

@iranreyes
Copy link
Member

iranreyes commented Aug 22, 2019

Idea

Create a rule that alerts if a package is suspicious based on configurable parameters

Rule Specifications

Name: suspicious-packages
Arguments:

  • downloads: Minimum amount of downloads per month in NPM
  • last-update: Last package update in months in NPM
  • maintainers: Minimum number of maintainers in NPM
  • open-issues: Minimum amount of open issues in GitHub
  • stars: Minimum amount of stars in GitHub
  • watchers: Minimum amount of watchers in GitHub
  • forks: Minimum amount of forks in GitHub
  • archived: Archived or not

Because a suspicious package may be the combination of many indicators, like:

  1. low downloads
  2. low downloads and last updated 9 months ago
  3. archived: yes

I think is better instead to add different setups like:

"suspicious-packages": [
      "error",
      {
        "base": {archived: true},
        "indicators": [{forks: 3, stars: 4}, {downloads: 10, "last-update": 6}],
        "whitelist": []
      }
    ]

Implementation

Use the API of NPM, NPM.io, Libraries.io and GitHub

NPM.io:
https://api.npms.io/v2/package/adviser

NPM:

Libraries.io:
Good API, we can avoid some GitHub requests and have a fallback for rate limits. Heads up, it also has rate limits
https://libraries.io/npm/adviser

GitHub:

Notes

  • Feel free to add more indicators to identify suspicious packages
  • GitHub without being logged in has a rate limit, be ready to get an invalid response, also you may want to add an option in the config to add a token and use it.
  • Create documentation for the rule within /docs/rules
  • Add metadata to the rule
  • Update the Plugin general README and add the new rule
  • Just scan dependencies (not devDependencies or dependencies of dependencies, etc)
@iranreyes iranreyes assigned iranreyes and unassigned iranreyes Aug 22, 2019
@tyrellbain tyrellbain self-assigned this Feb 4, 2020
@tyrellbain tyrellbain linked a pull request Oct 29, 2020 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants