8000 Consider supporting `npm-shrinkwrap.json` files · Issue #697 · google/osv-scalibr · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Consider supporting npm-shrinkwrap.json files #697
Open
@picatz

Description

@picatz

Today the packagelockjson extractor identifies package-lock.json files, as expected:

// FileRequired returns true if the specified file matches npm lockfile patterns.
func (e Extractor) FileRequired(api filesystem.FileAPI) bool {
path := api.Path()
if filepath.Base(path) != "package-lock.json" {
return false
}

But there is another file that could (should?) also be identified and parsed the same way:
npm-shrinkwrap.json

Both of these files have the same format, and perform similar functions in the root of a project.

The difference is that package-lock.json cannot be published, and it will be ignored if found in any place other than the root project.

In contrast, npm-shrinkwrap.json allows publication, and defines 510A the dependency tree from the point encountered. This is not recommended unless deploying a CLI tool or otherwise using the publication process for producing production packages.

If both package-lock.json and npm-shrinkwrap.json are present in the root of a project, npm-shrinkwrap.json will take precedence and package-lock.json will be ignored.

📄 https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#package-lockjson-vs-npm-shrinkwrapjson

Tangentially, should it be its own extractor (e.g. packageshrinkwrapjson), or would it make sense to include it as an additional case to the existing packagelockjson extractor's FileRequired method?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0