You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, Trivy treats packages with the same version but different dependencies as duplicates and excludes them. This leads to inconsistent results when scanning the same project multiple times.
When scanning a project that has the same package version but with different dependencies, Trivy treats them as duplicates and excludes one of them. This results in non-deterministic output.
Packages with the same version but different dependencies should be treated as separate packages. This will ensure consistent results when scanning the same project multiple times.
Upon further consideration, I realized that this difference in the dependency graph also affects how parent packages are handled. In the example above, @aws-crypto/[email protected] actually has two separate instances with different downstream dependencies. Suppose @aws-sdk/client-sts is the parent package of one such @aws-crypto/[email protected]. Under that parent, the subtree might be:
In other words, @aws-sdk/client-sts could also have two distinct instances. If we only look at a package’s direct dependencies, we can’t tell them apart—both instances list @aws-crypto/[email protected] as a direct dependency, even though their subgraphs differ. Therefore, we must compare entire subgraphs to determine whether two instances are truly identical.
Treating every unique package path as a separate instance—like npm does (e.g. node_modules/@aws-crypto/crc32/node_modules/@aws-crypto/util and node_modules/@aws-crypto/util)—is simpler, but it can suddenly expose what appear to be duplicate packages and confuse users. I currently believe it’s best to filter out any instances whose entire subgraphs are identical.
Overview
Currently, Trivy treats packages with the same version but different dependencies as duplicates and excludes them. This leads to inconsistent results when scanning the same project multiple times.
See #8775 for details.
Current Behavior
When scanning a project that has the same package version but with different dependencies, Trivy treats them as duplicates and excludes one of them. This results in non-deterministic output.
Example:
vs
Expected Behavior
Packages with the same version but different dependencies should be treated as separate packages. This will ensure consistent results when scanning the same project multiple times.
Related Issues
Discussed in #8775
The text was updated successfully, but these errors were encountered: