Repository navigation
Trivy classifies production pnpm workspace dependencies in pnpm deploy lockfiles as dev dependencies #11385
Closed
sergio-ferreira-jscrambler
started this conversation in
Bugs
Replies: 1 comment
|
Hello @sergio-ferreira-jscrambler Created #11389 Regards, Dmitriy |
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
We scan each service's production dependency lockfile after running pnpm deploy --prod. The deployed service has a production dependency on a local workspace package, which itself has a production dependency on @xmldom/xmldom@0.8.13. The package is present in the production deployment.
In the generated pnpm-lock.yaml, pnpm records the local workspace package as a file: dependency. Trivy treats the transitive package as a development dependency and suppresses its vulnerabilities by default. Scanning the same deployed lockfile with --include-dev-deps reports the findings.
This reproduces with pnpm 11.27.0 and pnpm 12.11.2, using Trivy 0.75.0. The minimal fixture is this repository; see README.md and repro.sh.
Desired Behavior
When scanning a lockfile generated by pnpm deploy --prod, Trivy should report vulnerabilities in all dependencies included in that production deployment by default. It should continue to omit actual development dependencies, which pnpm deploy --prod excludes from the deployed lockfile and package tree.
Actual Behavior
Without
--include-dev-deps, Trivy reports zero HIGH or CRITICAL findings for the deployed lockfile. With --include-dev-deps, it reports eight HIGH findings for @xmldom/xmldom@0.8.13:Reproduction Steps
Clone or use the minimal reproduction repository at https://github.com/sergio-ferreira-jscrambler/trivy-pnpm-workspace-repro
Run the production deployment:
Scan the deployed lockfile both ways:
Compare the results: the first scan reports zero findings; the second reports the eight HIGH xmldom findings listed above.
There's also a
repro.shfile that you can use that does the steps aboveTested with both pnpm 11.27.0 and and pnpm 12.11.2; the result was the same.
Target
Filesystem
Scanner
Vulnerability
Output Format
JSON
Mode
Standalone
Debug Output
Operating System
Ubuntu 24.04.1 LTS, Linux kernel 7.0.0-34-generic, x86_64
Version
Checklist
trivy clean --allAll reactions