DependencyTrack / DependencyTrack/dependency-track

Specifying only Group Name and Version will not match VulnerableSoftware using the Internal Analyzer.

Open
#2,984 2 comments 1 reaction 0 assignees View on GitHub
defect good first issue p2
Dominant language
Java
Stars
4.2k
Forks
811
Avg merge
8h 39m
Merged PRs (30d)
237

Description

If you specify only the mandatory fields you'll never get a match using the Internal Analyzer.
```
String componentVersion;
String componentUpdate;
if (parsedCpe != null) {
componentVersion = parsedCpe.getVersion();
componentUpdate = parsedCpe.getUpdate();
} else if (component.getPurl() != null) {
componentVersion = component.getPurl().getVersion();
componentUpdate = null;
} else {
// Catch cases where the CPE couldn't be parsed and no PURL exists.
// Should be rare, but could lead to NPEs later.
LOGGER.debug("Neither CPE nor PURL of component " + component.getUuid() + " provide a version - skipping analysis");
return;
}
// In some cases, componentVersion may be null, such as when a Package URL does not have a version specified
if (componentVersion == null) {
return;
}`

```
That `else` short circuits the versionRangeAnalysis when there's no PURL and no CPE.

_Originally posted by @officerNordberg in https://github.com/DependencyTrack/dependency-track/discussions/2983#discussioncomment-6817170_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.