Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class ImageScanningTest extends BaseSpecification {

where:
"data inputs are: "
imageName | policyName | tag
"jenkins/jenkins:lts" | "Fixable CVSS >= 7" | "lts"
"nginx:latest" | "Latest tag" | "latest"
imageName | policyName | tag
"jenkins/jenkins:2.77" | "Fixable CVSS >= 7" | "2.77"
"nginx:latest" | "Latest tag" | "latest"
}

@Unroll
Expand Down
14 changes: 10 additions & 4 deletions stackrox-container-image-scanner/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
<version>4.5.13</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -130,21 +135,21 @@
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.2</version>
<version>0.2.3</version>
</dependency>
<!-- required by OkHTTP -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.7.0</version>
<version>1.7.10</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.2</version>
<version>5.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -193,7 +198,7 @@
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>5.4.0</version>
<version>6.1.0</version>
<!-- /RELEASE_VERSION -->
<executions>
<execution>
Expand All @@ -214,6 +219,7 @@
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<sourceFolder>src/gen/java/main</sourceFolder>
<enumUnknownDefaultCase>true</enumUnknownDefaultCase>
</configOptions>
</configuration>
</execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ public void shouldNotFailOnMissingData() throws IOException {
assertEquals(expected, actual);
}

@Test
public void shouldNotFailOnUnknownEnumValue() throws IOException {
MOCK_SERVER.stubFor(postImagesScan().willReturn(
ok().withBodyFile("v1/images/scan/unknown-enum.json")));
List<CVE> actual = imageService.getImageScanResults("nginx:latest");
ImmutableList<CVE> expected = ImmutableList.of(
new CVE(null, null, new StorageEmbeddedVulnerability()
.cve("CVE-MISSING-DATA")
.scoreVersion(V2))
);
assertEquals(expected, actual);
}

private MappingBuilder postImagesScan() {
return post(urlEqualTo("/v1/images/scan"))
.withHeader("Authorization", equalTo("Bearer {some token}"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ class ServiceExceptionTest {
@DisplayName("ServiceException message")
@ParameterizedTest(name = "should be \"{2}\" when response body \"{0}\"")
@CsvSource({
",,Status code: 500.",
",API Message,Status code: 500. Error: API Message",
",,'Status code: 500. Error: Message: null\n" +
"HTTP response code: 500\n" +
"HTTP response body: null\n" +
"HTTP response headers: null'",
",API Message,'Status code: 500. Error: Message: API Message\n" +
"HTTP response code: 500\n" +
"HTTP response body: null\n" +
"HTTP response headers: null'",
"{},,Status code: 500.",
"{\"message\":\"some error\"},,Status code: 500. Error: some error",
"not a json,,Status code: 500. Response body: not a json"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scan": {
"components": [
{
"vulns": [
{
"cve": "CVE-MISSING-DATA"
}
]
}
],
"notes": [
"UNKNOWN VALUE"
]
}
}