Installations
npm install @chax-at/better-npm-audit
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 8.12
Node Version
16.17.1
NPM Version
8.19.2
Score
68.2
Supply Chain
80.3
Quality
80.6
Maintenance
100
Vulnerability
99.3
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (98.7%)
JavaScript (1.3%)
Developer
chax-at
Download Statistics
Total Downloads
14,079
Last Day
4
Last Week
165
Last Month
471
Last Year
9,511
GitHub Statistics
202 Commits
3 Branches
1 Contributors
Package Meta Information
Latest Version
3.6.9
Package Id
@chax-at/better-npm-audit@3.6.9
Unpacked Size
37.21 kB
Size
9.73 kB
File Count
11
NPM Version
8.19.2
Node Version
16.17.1
Publised On
18 Jul 2023
Total Downloads
Cumulative downloads
Total Downloads
14,079
Last day
33.3%
4
Compared to previous day
Last week
44.7%
165
Compared to previous week
Last month
-19.3%
471
Compared to previous month
Last year
156.6%
9,511
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Better NPM Audit
The goal of this project is to help to reshape npm audit into the way the community would like, by the community itself. Giving another option for everyone and encourage more people to do security audits.
Supports both NPM version 6 and 7
NPM has upgraded to version 7 in late 2020 and has breaking changes on the npm audit
. The output of npm audit has significantly changed both in the human-readable and --json
output styles. We have added handling so it works properly in both npm versions.
Docs | Link |
---|---|
NPM v6 & v7 changes | https://github.blog/2020-10-13-presenting-v7-0-0-of-the-npm-cli/ |
NPM v7 blog post | https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major |
Official NPM v6 audit docs | https://docs.npmjs.com/cli/v6/commands/npm-audit |
Official NPM v7 audit docs | https://docs.npmjs.com/cli/v7/commands/npm-audit |
Dealing with new npm audit | https://uko.codes/dealing-with-npm-v7-audit-changes |
Installation
$ npm install --save better-npm-audit
or
$ npm install -g better-npm-audit
Usage
Run global
1better-npm-audit audit
Run with exceptions
Unhandled or newly reported vulnerabilities will be highlighted:
Unused exceptions will be notified:
Add into package scripts
1{ 2 "scripts": { 3 "prepush": "npm run test && npm run audit", 4 "audit": "better-npm-audit audit" 5 } 6}
Now you can run locally or in your CI pipeline:
1npm run audit
Options
Flag | Short | Description |
---|---|---|
--exclude | -x | Exceptions or the vulnerabilities ID(s) to exclude |
--module-ignore | -m | Names of modules to exclude |
--level | -l | The minimum audit level to validate; Same as the original --audit-level flag |
--production | -p | Skip checking the devDependencies |
--registry | -r | The npm registry url to use |
Environment Variables
Variable | Description |
---|---|
NPM_CONFIG_AUDIT_LEVEL | Used in setting the audit level. Note: this will be disregard if the audit level flag is passed onto the command. |
Using .nsprc
file to manage exceptions
You may add a file .nsprc
to your project root directory to manage the exceptions. For example:
1{ 2 "1337": { 3 "active": true, 4 "notes": "Ignored since we don't use xxx method", 5 "expiry": 1615462134681 6 }, 7 "4501": { 8 "active": false, 9 "notes": "Ignored since we don't use xxx method" 10 }, 11 "980": "Ignored since we don't use xxx method", 12 "https://github.com/advisories/GHSA-93q8-gq69-wqmw": "Github vulnerability URLs are supported as well", 13 "GHSA-qrpm-p2h7-hrv2": "GHSA is also possible", 14 "Note": "Any non number key will not be accepted" 15}
Fields
Attribute | Type | Description | Default | Examples |
---|---|---|---|---|
active | Boolean | If the tool should use it for exception | true | true |
expiry | String | Number | Human-readable date, or milliseconds since the UNIX Epoch | - '2020-01-31' - '2020/01/31' - '01/31/2021, 11:03:58' - '1 March 2016 15:00' - '1 March 2016 3:00 pm' - '2012-01-26T13:51:50.417-07:00' - 'Sun, 11 Jul 2021 03:03:13 GMT' - 'Thu Jan 26 2017 11:00:00 GMT+1100 (Australian Eastern Daylight Time)' - 327611110417 | |
notes | String | Notes related to the vulnerability. |
When using a .nsprc
file, a report will be displayed when it starts running:
Note: the expiry date will be styled in yellow and red color if it is detected more than one or five years ago.
Changelog
You can find the changelog here.
Special mentions
-
@IanWright for his solutions in improving the vulnerability validation for us to have the minimum-audit-level and production-mode flags.
-
@EdwinTaylor for all the bug reports and improvement suggestions.
-
@MrHus for the logging of unused exceptions from the .nsprc file and -ignore flags. Courtesy of 42 BV.
If you like this project,
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
SAST tool detected: CodeQL
Details
- Info: SAST configuration detected: CodeQL
- Warn: no pull requests merged into dev branch
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:46: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/chax-at/better-npm-audit/node.js.yml/master?enable=pin
- Info: 0 out of 6 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
11 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2
- Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55
- Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Score
3.2
/10
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More