Gathering detailed insights and metrics for lockfile-lint-api
Gathering detailed insights and metrics for lockfile-lint-api
Gathering detailed insights and metrics for lockfile-lint-api
Gathering detailed insights and metrics for lockfile-lint-api
Lint an npm or yarn lockfile to analyze and detect security issues
npm install lockfile-lint-api
Typescript
Module System
Min. Node Version
Node Version
NPM Version
86.8
Supply Chain
99.4
Quality
80
Maintenance
100
Vulnerability
100
License
lockfile-lint@4.14.0
Published on 14 Jun 2024
lockfile-lint@4.13.2
Published on 21 Feb 2024
lockfile-lint-api@5.9.1
Published on 11 Feb 2024
lockfile-lint@4.13.1
Published on 11 Feb 2024
lockfile-lint@4.13.0
Published on 11 Feb 2024
lockfile-lint-api@5.9.0
Published on 11 Feb 2024
JavaScript (99.69%)
Shell (0.31%)
Total Downloads
19,493,344
Last Day
7,997
Last Week
160,705
Last Month
848,312
Last Year
5,885,184
788 Stars
277 Commits
35 Forks
9 Watching
14 Branches
35 Contributors
Latest Version
5.9.1
Package Id
lockfile-lint-api@5.9.1
Unpacked Size
41.68 kB
Size
11.80 kB
File Count
13
NPM Version
10.2.3
Node Version
18.19.0
Publised On
11 Feb 2024
Cumulative downloads
Total Downloads
Last day
-34.1%
7,997
Compared to previous day
Last week
-25.1%
160,705
Compared to previous week
Last month
22.4%
848,312
Compared to previous month
Last year
34.6%
5,885,184
Compared to previous year
3
18
Lint an npm or yarn lockfile to analyze and detect issues
Lints an npm or yarn lockfile to analyze and detect issues
1npm install --save lockfile-lint-api
lockfile-lint-api
exposes a set of validator APIs that can be used for programmatic use-cases, such as being employed by other tools and programs if needed.
The following lockfile validators are supported
Validator API | description | implemented |
---|---|---|
ValidateHttps | validates the use of HTTPS as protocol schema for all resources | ✅ |
ValidateHost | validates a whitelist of allowed hosts to be used for resources in the lockfile | ✅ |
ValidatePackageNames | validates that the resolved URL matches the package name | ✅ |
ValidateScheme | validates a whitelist of allowed URI schemes to be used for hosts | ✅ |
ValidateIntegrity | validates that the integrity hash type is sha512 | ✅ |
NOTE: package entries without a resolved
field (for example, those installed from the local filesystem) will automatically pass all url-based validators.
When validators encounter errors they will throw an exception, and on either success or failure in validating data they will always return a descriptive object for the validation task.
When validation is successful the following object will be returned from the validating function:
1{ 2 "type": "success", 3 "errors": [] 4}
When validation has failed the following object will be returned from the validating function:
1{ 2 "type": "error", 3 "errors": [ 4 { 5 "package": "@babel/cli", 6 "message": "detected invalid origin for package: @babel/cli" 7 } 8 ] 9}
Notes about the returned object:
package
property and other metadata depends on the specific validators being used1const validator = new ValidateHost({packages: lockfile.object}) 2let result 3try { 4 result = validator.validate(['npm']) 5} catch (error) { 6 // something bad happened during validation and the validation 7 // process couldn't take place 8} 9 10console.log(result) 11/* prints 12{ 13 "type": "error", 14 "errors": [ 15 { 16 "message": "detected invalid origin for package: meow", 17 "package": "meow" 18 } 19 ] 20} 21*/
1const {ValidateHost, ParseLockfile} = require('lockfile-lint-api') 2 3// path to the lockfile 4const yarnLockfilePath = '/path/to/my/yarn.lock' 5const options = { 6 lockfilePath: yarnLockfilePath 7} 8 9// instantiate a new parser with options object 10const parser = new ParseLockfile(options) 11 12// read the file synchronously and parses it 13// providing back an object that is compatible 14// with the @yarn/lockfile library which has 15// all the packages listed in `lockfile.object` 16const lockfile = parser.parseSync() 17 18// now instantiate a validator object with those 19// list of packages 20const validator = new ValidateHost({packages: lockfile.object}) 21let result 22try { 23 // validation is synchronous and is being called 24 // with 'npm' as a shortcut for the npm registry 25 // host to validate all lockfile resources are 26 // whitelisted to the npm host 27 result = validator.validate(['npm']) 28} catch (error) { 29 // couldn't process the validation 30} 31 32if (result.type === 'success') { 33 // validation succeeded 34}
Please consult CONTRIBUTING for guidelines on contributing to this project.
lockfile-lint-api © Liran Tal, Released under the Apache-2.0 License.
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 4/23 approved changesets -- score normalized to 1
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
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@types/lockfile-lint-api
TypeScript definitions for lockfile-lint-api
@ellentorg/nostrum-exercitationem-facilis
A _very_ minimal implementation of a [PassThrough stream](https://nodejs.org/api/stream.html#stream_class_stream_passthrough)
@womorg/ipsam-sint-eaque
> Dependency-less Test Runner for Node.js
@hishprorg/assumenda-tempora-eius
Node [streams2](http://nodejs.org/api/stream.html) over [Primus](https://github.com/primus/primus): added back-pressure!