Inconsistent cyclonedx SBOM results #8775
Replies: 1 comment 1 reply
-
|
Thank you for the detailed report. Thanks to the package.json you shared to help reproduce the issue, we were able to identify the problem. We assumed that a given package@version would have the same dependencies within the same project. Unfortunately, that doesn't seem to be the case. Please take a look at the following: $ npm ls --all --json | jq '.dependencies["aws-amplify"].dependencies["@aws-amplify/interactions"].dependencies["@aws-sdk/client-lex-runtime-v2"].dependencies["@aws-sdk/eventstream-handler-node"].dependencies["@aws-sdk/eventstream-codec"].dependencies["@aws-crypto/crc32"].dependencies["@aws-crypto/util"]'
{
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-2.0.2.tgz",
"overridden": false,
"dependencies": {
"@aws-sdk/types": {
"version": "3.775.0"
},
"@aws-sdk/util-utf8-browser": {
"version": "3.6.1"
},
"tslib": {
"version": "1.14.1"
}
}
}$ npm ls --all --json | jq '.dependencies["aws-amplify"].dependencies["@aws-amplify/geo"].dependencies["@aws-sdk/client-location"].dependencies["@aws-crypto/sha256-browser"].dependencies["@aws-crypto/util"]'
{
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-2.0.2.tgz",
"overridden": false,
"dependencies": {
"@aws-sdk/types": {
"version": "3.186.0"
},
"@aws-sdk/util-utf8-browser": {
"version": "3.186.0"
},
"tslib": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"overridden": false
}
}
}Even though they are both You can also see different graphs under Currently, Trivy treats these as duplicates and excludes them, so which one gets picked determines the result—and it isn’t deterministic. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
In some cases we get inconsistent cyclonedx results (running the same trivy command on the same
package-lock.jsonfile multiple times generates different versions of packages in a cyclonedx file). We were able to create a minimalpackage.jsonandpackage-lock.jsonto create this (see attached)package.json
package-lock.json
also attached below are results of running the following command multiple times in the directory of the
package-lock.json:cyclonedx.1.json
cyclonedx.2.json
(ignore the changes in the positions, timestamps and ref UUIDs, you can see a difference in the dependency versions of the
pkg:npm/%40aws-crypto/[email protected]package:{ "ref": "pkg:npm/%40aws-crypto/[email protected]", "dependsOn": [ "pkg:npm/%40aws-sdk/[email protected]", "pkg:npm/%40aws-sdk/[email protected]", "pkg:npm/[email protected]" ] }vs.
{ "ref": "pkg:npm/%40aws-crypto/[email protected]", "dependsOn": [ "pkg:npm/%40aws-sdk/[email protected]", "pkg:npm/%40aws-sdk/[email protected]", "pkg:npm/[email protected]" ] }Desired Behavior
the end result should be deterministic and produce the same results in each execution
Actual Behavior
produces different results in each execution with no apparent logic
Reproduction Steps
Target
Filesystem
Scanner
Vulnerability
Output Format
CycloneDX
Mode
Standalone
Debug Output
Operating System
Ubuntu 24.04.1 LTS
Version
Checklist
trivy clean --allBeta Was this translation helpful? Give feedback.
All reactions