{"name":"lockfile-lint","version":"5.0.0","keywords":["lockfile check","lockfile lint","lockfile","lock","lint","yarn","npm","linter","security","parse"],"author":{"url":"https://github.com/lirantal","name":"Liran Tal","email":"liran.tal@gmail.com"},"license":"Apache-2.0","_id":"lockfile-lint@5.0.0","maintainers":[{"name":"lirantal","email":"liran.tal@gmail.com"},{"name":"lirantal_bot","email":"liran.tal+npm@gmail.com"}],"homepage":"https://github.com/lirantal/lockfile-lint/tree/master/packages/lockfile-lint","bugs":{"url":"https://github.com/lirantal/lockfile-lint/tree/master/packages/lockfile-lint/issues"},"bin":{"lockfile-lint":"bin/lockfile-lint.js"},"dist":{"shasum":"052a11c150e328bb5fb548b071ebcd2df70614bc","tarball":"http://registry-npm.ywwl.com/lockfile-lint/download/lockfile-lint-5.0.0.tgz","fileCount":7,"integrity":"sha512-QcVIVITLZAhWYHU2wbNSOMgwc6EN4Y2sy6mjgS5aikYyRzgDIfotXUsCrm38En+3fZpc58Yu7DF9dNeT/goi1A==","signatures":[{"sig":"MEQCIHKzlcg+EfUkRPkSQBPCk9T7HI6jtequ3m11IjOAjxBWAiBXUBc1H74CEsAJvdiiCmNGzwUWtEd8sSeT7IE9uekFFg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/lockfile-lint@5.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":39142,"size":11312,"noattachment":false,"key":"/lockfile-lint/-/lockfile-lint-5.0.0.tgz"},"jest":{"notify":true,"verbose":true,"testMatch":["**/*.test.js"],"collectCoverage":true,"testEnvironment":"node","coverageThreshold":{"global":{"lines":80,"branches":80,"functions":80,"statements":80}},"collectCoverageFrom":["index.js","src/**/*.{js,ts}"],"testPathIgnorePatterns":["/__tests__/.*/__fixtures__/.*"]},"engines":{"node":">=16.0.0"},"gitHead":"09dabb4ff7ac74bb32136ac010502aa3be0e317d","scripts":{"docs":"yarn run docs:code && yarn run docs:api","lint":"eslint .","test":"jest","commit":"git-cz","format":"prettier-standard \"**/*.js\"","docs:api":"doxdox *.js --layout bootstrap --output docs/index.html","lint:fix":"eslint . --fix","docs:code":"docco *.js --output docs/code","test:watch":"jest --watch","coverage:view":"open-cli coverage/lcov-report/index.html"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:f3593ccb-539a-4330-a9f1-0468819faec9"}},"standard":{"env":["jest"],"ignore":["**/out/"],"parser":"babel-eslint"},"repository":{"url":"git+https://github.com/lirantal/lockfile-lint.git","type":"git","directory":"packages/lockfile-lint"},"_npmVersion":"11.6.2","description":"A CLI to lint a lockfile for security policies","directories":{},"_nodeVersion":"24.13.0","dependencies":{"debug":"^4.3.4","yargs":"^17.7.2","fast-glob":"^3.3.2","cosmiconfig":"^9.0.0","lockfile-lint-api":"^5.9.2"},"eslintConfig":{"env":{"es6":true,"jest":true,"node":true},"rules":{"no-process-exit":"warn","object-curly-spacing":"off","jest/no-focused-tests":"error","jest/no-disabled-tests":"error","jest/no-identical-title":"error","node/no-unpublished-require":"off","space-before-function-paren":"off","node/no-unsupported-features":"off","security/detect-unsafe-regex":"error","security/detect-child-process":"error","security/detect-buffer-noassert":"error","security/detect-object-injection":"warn","security/detect-pseudoRandomBytes":"error","security/detect-non-literal-regexp":"error","security/detect-eval-with-expression":"error","security/detect-disable-mustache-escape":"error","security/detect-non-literal-fs-filename":"error","security/detect-possible-timing-attacks":"error","security/detect-no-csrf-before-method-override":"error"},"extends":["standard","plugin:node/recommended"],"plugins":["import","standard","node","security","jest"],"parserOptions":{"ecmaVersion":8,"ecmaFeatures":{"impliedStrict":true}}},"eslintIgnore":["coverage/**"],"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"jest":"29.6.2","docco":"^0.9.1","doxdox":"3.0.0","eslint":"^8.46.0","semver":"^7.5.4","open-cli":"^7.2.0","babel-eslint":"^10.0.1","babel-preset-env":"^1.7.0","prettier-standard":"16.4.1","eslint-plugin-jest":"^27.2.3","eslint-plugin-node":"11.1.0","babel-preset-es2015":"^6.24.1","eslint-plugin-import":"^2.28.0","eslint-plugin-promise":"^6.1.1","eslint-config-standard":"^17.1.0","eslint-plugin-security":"^1.7.1","eslint-plugin-standard":"^4.1.0","babel-plugin-transform-regenerator":"^6.26.0","babel-plugin-syntax-async-functions":"^6.13.0"},"_npmOperationalInternal":{"tmp":"tmp/lockfile-lint_5.0.0_1769353963229_0.7093582510513778","host":"s3://npm-registry-packages-npm-production"},"readme":"<p align=\"center\"><h1 align=\"center\">\nlockfile-lint\n\n</h1>\n\n<p align=\"center\">\n  A CLI to lint a lockfile for security policies\n</p>\n\n<p align=\"center\">\n<a href=\"https://www.npmjs.org/package/lockfile-lint\"><img src=\"https://badgen.net/npm/v/lockfile-lint\" alt=\"npm version\"/></a>\n  <a href=\"https://www.npmjs.org/package/lockfile-lint\"><img src=\"https://badgen.net/npm/license/lockfile-lint\" alt=\"license\"/></a>\n  <a href=\"https://www.npmjs.org/package/lockfile-lint\"><img src=\"https://badgen.net/npm/dt/lockfile-lint\" alt=\"downloads\"/></a>\n  <a href=\"https://travis-ci.org/lirantal/lockfile-lint\"><img src=\"https://badgen.net/travis/lirantal/lockfile-lint\" alt=\"build\"/></a>\n  <a href=\"https://codecov.io/gh/lirantal/lockfile-lint\"><img src=\"https://badgen.net/codecov/c/github/lirantal/lockfile-lint\" alt=\"codecov\"/></a>\n<a href=\"https://snyk.io/test/npm/lockfile-lint\"><img src=\"https://snyk.io/test/npm/lockfile-lint/badge.svg\" alt=\"Known Vulnerabilities\" data-canonical-src=\"https://snyk.io/test/npm/lockfile-lint\" style=\"max-width:100%;\"></a>\n  <a href=\"https://github.com/nodejs/security-wg/blob/main/processes/responsible_disclosure_template.md\"><img src=\"https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg\" alt=\"Security Responsible Disclosure\" /></a>\n</p>\n\n# About\n\nA CLI tool to lint a lockfile for security policies\n\n# Install\n\n```bash\nnpm install --save lockfile-lint\n```\n\n# Usage\n\n`lockfile-lint` can be installed per a project scope, or globally and exposes a `lockfile-lint` executable that should be practiced during builds, CIs, and general static code analysis procedures to ensure that lockfiles are kept up to date with pre-defined security and usage policies.\n\n```bash\nlockfile-lint --type <yarn|npm> --path <path-to-lockfile> --validate-https --allowed-hosts <host-to-match> --allowed-urls <urls-to-match>\n```\n\nSupported lockfiles:\n- npm's `package-lock.json` and `npm-shrinkwrap.json`\n- yarn's `yarn.lock`\n\n# Example\n\nAn example of running the linter with debug output for a yarn lockfile and asserting that all resources are using the official npm registry as source for packages:\n\n```bash\nDEBUG=* lockfile-lint --path yarn.lock --type yarn --allowed-hosts npm\n```\n\n**Example 2**: specify hostnames and enforce the use of HTTPS as a protocol\n\n```bash\nlockfile-lint --path yarn.lock --allowed-hosts registry.yarnpkg.com --validate-https\n```\n\n- `--type yarn` is ommitted since lockfile-lint can figure it out on it's own\n- `--allowed-hosts` explicitly set to match yarn's mirror host\n\n**Example 3**: allow the lockfile to contain packages served over github and so need to specify github.com as a host as well as the `git+https:` as a valid URI scheme\n\n```bash\nlockfile-lint --path yarn.lock --allowed-hosts yarn github.com --allowed-schemes \"https:\" \"git+https:\"\n```\n\n- `--allowed-hosts` explicitly set to match github.com as a host and specifies `yarn` as the alias for yarn's official mirror host\n- `--allowed-schemes` is used instead of `validate-https` and it explicitly allows both `https:` and `git+https:` as the [HTTP Scheme](https://tools.ietf.org/html/rfc3986#section-3.1) for the github URL. Note that `--allowed-schemes` and `--validate-https` are mutually exclusive.\n\n**Example 4**: allow the lockfile to contain a package which resolves to a specific URL specified by the `--allowed-urls` option while all other packages must resolve to yarn as specified by `--allowed-hosts`\n\n```bash\nlockfile-lint --path yarn.lock --allowed-hosts yarn --allowed-urls https://github.com/lirantal/lockfile-lint#d30ce73a3e5977dede29450df1c79b09f02779b2\n```\n\n- `--allowed-hosts` allows packages from yarn only\n- `--allowed-urls` overrides `allowed-hosts` and allows a specific Github URL to pass validation\n\n# CLI command options\n\n| command line argument            | description                                                                                                                                                                                                                                                                           | implemented   |\n|----------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|\n| `--path`, `-p`                   | path to the lockfile but you can also provide a glob matching pattern as long as it isn't expanded by a shell like bash or zsh. If that's the case, you can provide it as a string, for example: `-p '/Users/lirantal/repos/**/package-lock.json'` to match multiple lockfiles        | ✅            |\n| `--type`, `-t`                   | lockfile type, options are `npm` or `yarn`                                                                                                                                                                                                                                            | ✅            |\n| `--format`, `-f`                 | sets what type of report output is desired, one of [ `pretty`, `plain` ] with `plain` removing colors & status symbols from output                                                                                                                                                    | ✅            |\n| `--validate-https`, `-s`         | validates the use of HTTPS as protocol schema for all resources in the lockfile                                                                                                                                                                                                       | ✅            |\n| `--allowed-hosts`, `-a`          | validates a list of allowed hosts to be used for all resources in the lockfile. Supported short-hands aliases are `npm`, `yarn`, and `verdaccio` which will match URLs `https://registry.npmjs.org`, `https://registry.yarnpkg.com` and `https://registry.verdaccio.org` respectively | ✅            |\n| `--allowed-schemes`, `-o`        | allowed [URI schemes](https://tools.ietf.org/html/rfc2396#section-3.1) such as \"https:\", \"http\", \"git+ssh:\", or \"git+https:\"                                                                                                                                                          | ✅            |\n| `--allowed-urls`, `-u`           | allowed URLs (e.g. `https://github.com/some-org/some-repo#some-hash`)                                                                                                                                                                                                                 | ✅            |\n| `--empty-hostname`, `-e`         | allow empty hostnames, or set to false if you wish for a stricter policy                                                                                                                                                                                                              | ✅            |\n| `--validate-package-names`, `-n` | validates that the resolved URL matches the package name                                                                                                                                                                                                                              | ✅            |\n| `--validate-integrity`, `-i`     | validates the integrity field is a sha512 hash                                                                                                                                                                                                                                        | ✅            |\n| `--validate-integrity-strict` | requires complete SHA-512 integrity, with exceptions for Git, local directory, linked and bundled dependencies | ✅ |\n| `--allowed-package-name-aliases`, `-l` | allow package name aliases to be used by specifying package name and their alias as pairs (e.g: `string-width-cjs:string-width`)                                                                                                                                                | ✅            |\n| `--integrity-exclude`            | exclude packages from the `--validate-integrity` check                                                                                                                                                                                                                                | ✅            |\n\n# Strict integrity validation\n\nUse `--validate-integrity-strict` to require a complete, base64-encoded SHA-512\ndigest for each dependency in npm lockfiles (versions 1, 2 and 3) or Yarn Classic\nlockfiles:\n\n```bash\nlockfile-lint --path package-lock.json --validate-integrity-strict\n```\n\nThe flag works on its own and takes precedence over `--validate-integrity` when\nboth are passed. The existing `--validate-integrity` behavior is unchanged.\n`--integrity-exclude` applies to either mode.\n\nGit dependencies, local directories (`file:`), workspace links and bundled\ndependencies are exempt because they may not have an integrity field. Local\ntarballs (`.tgz` or `.tar.gz`) and HTTP(S) tarballs still require integrity,\nincluding tarballs hosted on GitHub. Registry entries require complete `integrity` regardless of whether `resolved`\nis present. Missing or incomplete integrity is reported in either case.\n\nThis validates the recorded hash's presence and format; it does not download\npackages or establish that their contents are trustworthy. Yarn Berry uses a\ndifferent checksum format and is not supported by this SHA-512 integrity policy.\n\nIn a configuration file, set `validateIntegrityStrict: true`.\n\nFor npm v2/v3, bundled entries require a verified bundler ancestor. The parser\nwalks up the package path, skipping ancestors marked `inBundle`/`bundled`, to the\nnearest non-bundled ancestor. That ancestor must exist and declare\n`bundleDependencies` as a non-empty array or `true`. It must also have a complete\nSHA-512 integrity value or qualify independently as a commit-pinned Git source,\nlocal directory or workspace link. Transitive bundled dependencies are covered\neven when their names are absent from the declaration.\n\nFor npm v1, the nearest enclosing non-bundled ancestor must meet the same\nintegrity/source requirement. The v1 dependency tree does not record the parent's\n`bundleDependencies`, so the parser cannot confirm the declaration itself.\nMissing or unverified ancestors leave children subject to the integrity check;\nexcluding a parent from validation does not verify its bundle.\n\nRaw `link`, `bundled` or `inBundle` flags do not exempt HTTP(S) sources or local\n`.tgz`/`.tar.gz` files; the Git source exceptions below still apply.\n\nGit-protocol URLs and Git-host shorthands require a 7-40-character hexadecimal\ncommit fragment to qualify for an exemption. Branches, tags, semver ranges and\nmissing refs require complete SHA-512 integrity. Link/bundle flags cannot bypass\nthis pin requirement. Local file URLs are classified using their decoded path:\npercent-encoded `.tgz`/`.tar.gz` extensions still require integrity, and malformed\nURL escapes do not qualify as local directories.\n\nYarn Classic GitHub sources are also exempt when the URL is exactly\n`https://codeload.github.com/<owner>/<repo>/tar.gz/<40-hex-commit-sha>`,\nwithout a query string or fragment. Codeload URLs using tags, branches or short\nSHAs, and archive URLs that do not match this shape, still require integrity.\n\nHTTPS GitHub, GitLab and Bitbucket repository URLs of the form\n`https://<host>/<owner>/<repo>#<commit>` are exempt when the commit is 7-40\nhexadecimal characters and there is no query string. This separate Git-remote\nexception accepts abbreviated commits; archive/download paths remain subject\nto the tarball rules above.\n\nStrict mode rejects Yarn Berry with one unsupported-format message and exits\nnon-zero. When this is the only failure, the CLI reports\n`Error: unsupported lockfile format for --validate-integrity-strict` without\nclaiming security issues. If other validators also fail (for example,\n`--validate-https`), it retains `Error: security issues detected!` for those\nfindings. This applies to both plain and pretty output.\n\n# File-Based Configuration\n\nLockfile-lint uses [cosmiconfig](https://github.com/davidtheclark/cosmiconfig) for configuration file support. This means you can configure the above options via (in order of precedence):\n\n- A \"lockfile-lint\" key in your package.json file.\n- A .lockfile-lintrc file, written in JSON or YAML, with optional extensions: .json/.yaml/.yml (without extension takes precedence).\n- A .lockfile-lintrc.js, .lockfile-lintrc.cjs, or .lockfile-lintrc.mjs file that exports an object.\n- A lockfile-lint.config.js, lockfile-lint.config.cjs, or lockfile-lint.config.mjs file that exports an object.\n\nESM syntax is supported in `.mjs` files. For example:\n\n```javascript\nexport default {\n  path: 'yarn.lock',\n  type: 'yarn',\n  allowedHosts: ['npm', 'yarn'],\n  validateHttps: true\n}\n```\n\nThe configuration file will be resolved starting from the current working directory, and searching up the file tree until a config file is (or isn't) found. Command-line options take precedence over any file-based configuration.\n\nThe options accepted in the configuration file are the same as the options above in camelcase (e.g. \"path\", \"allowedHosts\").\n\n# References\n\n- [This package aliasing article](https://snyk.io/blog/exploring-extensions-of-dependency-confusion-attacks-via-npm-package-aliasing/) explains the rational for error reporting on package aliases in lockfiles.\n- [Why npm lockfiles can be a security blindspot for injecting malicious modules](https://snyk.io/blog/why-npm-lockfiles-can-be-a-security-blindspot-for-injecting-malicious-modules/)\n\n# Contributing\n\nPlease consult [CONTRIBUTING](../../CONTRIBUTING.md) for guidelines on contributing to this project.\n\n# Author\n\n**lockfile-lint** © [Liran Tal](https://github.com/lirantal), Released under the [Apache-2.0](./LICENSE) License.\n","publish_time":1769353963365,"_cnpm_publish_time":1769353963365,"dist-tags":{"latest":"5.1.0"}}