-
-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4394 from nscuro/issue-4376
- Loading branch information
Showing
2 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,7 +252,7 @@ public void testWithPackageWithoutTrivyProperties() { | |
assertThat(qm.getAllVulnerabilities(component)).isEmpty(); | ||
} | ||
|
||
/** | ||
/** | ||
* This test documents the case where Trivy is able to correlate a package with vulnerabilities | ||
* when additional properties provided. When including libc6 in an SBOM, | ||
* Trivy adds metadata to the component, which among other things includes alternative package names. | ||
|
@@ -346,7 +346,7 @@ public void testWithPackageWithTrivyProperties() { | |
}); | ||
} | ||
|
||
/** | ||
/** | ||
* This test documents the case where Trivy generates a sbom and operative system is not entirely on distro qualifier. | ||
* <p> | ||
* Here's an excerpt of the properties included: | ||
|
@@ -436,4 +436,25 @@ public void testWithPackageWithTrivyPropertiesWithDistroWithoutOS() { | |
assertThat(vuln.getReferences()).isNotBlank(); | ||
}); | ||
} | ||
|
||
@Test // https://github.com/DependencyTrack/dependency-track/issues/4376 | ||
public void testWithGoPackage() { | ||
final var project = new Project(); | ||
project.setName("acme-app"); | ||
qm.persist(project); | ||
|
||
final var component = new Component(); | ||
component.setProject(project); | ||
component.setName("golang/github.com/nats-io/nkeys"); | ||
component.setVersion("0.4.4"); | ||
component.setClassifier(Classifier.LIBRARY); | ||
component.setPurl("pkg:golang/github.com/nats-io/[email protected]"); | ||
qm.persist(component); | ||
|
||
final var analysisEvent = new TrivyAnalysisEvent(List.of(component)); | ||
new TrivyAnalysisTask().inform(analysisEvent); | ||
|
||
assertThat(qm.getAllVulnerabilities(component)).hasSizeGreaterThanOrEqualTo(1); | ||
} | ||
|
||
} |