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

Partial package.json files lead to empty packages in output #311

Closed
luhring opened this issue Jan 22, 2021 · 0 comments · Fixed by #312
Closed

Partial package.json files lead to empty packages in output #311

luhring opened this issue Jan 22, 2021 · 0 comments · Fixed by #312
Assignees
Labels
bug Something isn't working

Comments

@luhring
Copy link
Contributor

luhring commented Jan 22, 2021

What happened:

Some package.json files contain very little information, and specifically, they don't have a name or version field. This is seems to be considered allowable for unpublished packages. (See related: microsoft/rushstack#2070).

For example, here's an entire package.json file we found:

{
  "sideEffects": false,
  "module": "../../esm/fp/isSaturday/index.js",
  "typings": "../../typings.d.ts"
}

This results in Syft decoding the JSON to a PackageJSON without error, which results in an empty and unusable package being returned in the end.

What you expected to happen:

We should enforce that if a parsed PackageJSON is missing the name or version fields, it should not be included in the final output. This doesn't need to be an error, but we should consider expressing this in a more detailed level of log output.

How to reproduce it (as minimally and precisely as possible):

syft docker.io/anchore/enterprise-ui:latest -o json | jq '[ .artifacts[] | select(.name == "" or .version == "") ]'

Anything else we need to know?:

Environment:

  • Output of syft version:
Application:   syft
Version:       0.12.2
BuildDate:     2021-01-06T02:43:56Z
GitCommit:     0f6288881bf8db287e07576bf8dd067184745759
GitTreeState:  clean
Platform:      darwin/amd64
GoVersion:     go1.14.13
Compiler:      gc
  • OS (e.g: cat /etc/os-release or similar): macOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant