Failure to parse package-lock.json file including legacy license array format #10370
Closed
WhatIsACore
started this conversation in
Bugs
Replies: 1 comment
-
|
duplicate of #10119 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
If Trivy attempts to scan a
package-lock.jsonwhere any dependency uses an array for its license field (instead of a string), Trivy will fail to scan any part of the file, fail to output aWARNing or other indication of failure (unless running in --debug), and return an empty results array.Though this format is deprecated, per https://docs.npmjs.com/cli/v10/configuring-npm/package-json:
Old dependencies that have not been updated in a while can have this format in their
package.json, and the modernnpmwill still transfer this into a downstream v3package-lock.json, albeit with a warning. Though deprecated, the resulting lockfile is still considered legal. If a single dependency anywhere in the tree uses this format, the scan fails, making this issue more common than expected.Desired Behavior
Trivy either successfully parses the
package-lock.json, or ignores that particular license field, or logs anWARNwhen it fails to scan something that looks scannable.Actual Behavior
Trivy ignores the entire package-lock.json file.
Reproduction Steps
Target
Filesystem
Scanner
Vulnerability
Output Format
None
Mode
Standalone
Debug Output
Operating System
macOs Tahoe 26.3
Version
Checklist
trivy clean --allBeta Was this translation helpful? Give feedback.
All reactions