-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set vulnerability as rejected for empty snyk records to suppress it in apiserver #1621
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -151,7 +151,9 @@ void testNoResults() throws Exception { | |
assertThat(outputRecord.getValue().getStatus()).isEqualTo(ScanStatus.SCAN_STATUS_SUCCESSFUL); | ||
assertThat(outputRecord.getValue().hasFailureReason()).isFalse(); | ||
assertThat(outputRecord.getValue().getScanner()).isEqualTo(Scanner.SCANNER_SNYK); | ||
assertThat(outputRecord.getValue().getBom().getVulnerabilitiesCount()).isZero(); | ||
assertThat(outputRecord.getValue().getBom().getVulnerabilitiesList()).satisfiesExactlyInAnyOrder( | ||
vulnerability -> assertThat(vulnerability.getRejected()).isNotNull() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If there are legitimately no results, the rejection status doesn't make sense. |
||
); | ||
} | ||
|
||
@Test | ||
|
@@ -211,7 +213,9 @@ record -> { | |
assertThat(record.getValue().getStatus()).isEqualTo(ScanStatus.SCAN_STATUS_SUCCESSFUL); | ||
//assertThat(record.getValue().getFailureReason()).contains("Purl pkg:deb/debian/curl@7.50.3 failed with status 400 due to Snyk error code SNYK-OSSI-2044 : Expected distro to be present"); | ||
assertThat(record.getValue().getScanner()).isEqualTo(Scanner.SCANNER_SNYK); | ||
assertThat(record.getValue().getBom().getVulnerabilitiesCount()).isZero(); | ||
assertThat(record.getValue().getBom().getVulnerabilitiesList()).satisfiesExactlyInAnyOrder( | ||
vulnerability -> assertThat(vulnerability.getRejected()).isNotNull() | ||
); | ||
}); | ||
verify(snykClientMock, Mockito.times(1)).getIssues(anyString(), anyString(), any(ReportRequest.class)); | ||
} | ||
|
@@ -255,7 +259,9 @@ void testCachingWithNoResults() throws Exception { | |
|
||
assertThat(outputTopic.getQueueSize()).isEqualTo(3); | ||
assertThat(outputTopic.readRecordsToList()).allSatisfy(record -> | ||
assertThat(record.getValue().getBom().getVulnerabilitiesCount()).isZero()); | ||
assertThat(record.getValue().getBom().getVulnerabilitiesList()).satisfiesExactlyInAnyOrder( | ||
vulnerability -> assertThat(vulnerability.getRejected()).isNotNull() | ||
)); | ||
|
||
// Verify that the client was invoked just once, despite three results being returned. | ||
verify(snykClientMock, Mockito.times(1)).getIssues(anyString(), anyString(), any(ReportRequest.class)); | ||
|
@@ -318,7 +324,9 @@ void testRetry() throws Exception { | |
assertThat(record.getValue().getStatus()).isEqualTo(ScanStatus.SCAN_STATUS_SUCCESSFUL); | ||
assertThat(record.getValue().hasFailureReason()).isFalse(); | ||
assertThat(record.getValue().getScanner()).isEqualTo(Scanner.SCANNER_SNYK); | ||
assertThat(record.getValue().getBom().getVulnerabilitiesCount()).isZero(); | ||
assertThat(record.getValue().getBom().getVulnerabilitiesList()).satisfiesExactlyInAnyOrder( | ||
vulnerability -> assertThat(vulnerability.getRejected()).isNotNull() | ||
); | ||
}); | ||
} | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a safe assumption to make here? The comment above reads:
Also, a vulnerability record without ID and source doesn't make sense to be rejected. My understanding was that Snyk still returned the ID, but no content for it. But this makes me think they don't return it at all anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No they don't send any data i.e.
"data": []