-
Notifications
You must be signed in to change notification settings - Fork 13
ROX-13627: Extend GetNodeVulnerabilities API by supporting Node Inventory #1004
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
Merged
Merged
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
79eec92
Extend GetNodeVulnerabilitiesRequest/Response
vikin91 75760af
Fix Makefile for devs who have spaces in the PATH and do not use wget
vikin91 858a2c4
Extend GetNodeVulnerabilities-API by adding node inventory support
vikin91 6d68e7c
Add e2e test for GetRHCOSNodeVulnerabilities
vikin91 a100e49
Add e2e testcase for a vulnerable and non-fixable pkg
vikin91 371c99e
Remove WIP integration test from this branch
vikin91 892a246
Cleanup debug printlns
vikin91 fca9919
Add a feature flad for the RHCOS node scanning
vikin91 75fadf0
Minor: Fix indentation in proto file
vikin91 bf11cb0
Fix style
vikin91 cd12427
Readd accidentally removed line
vikin91 2e12f90
Style: var found bool
vikin91 a1d9cf9
Use less confusing strings in test case
vikin91 d6ec31a
Add more debug to a test failure msg
vikin91 e818a91
Fix mistake in test
vikin91 470c4b3
Skip e2e test if a feature flag is disabled
vikin91 e0e2842
Enable the ff and see what CI says
vikin91 2faba04
Disable the feature flag again
vikin91 6ffc2e2
Enable the ROX_RHCOS_NODE_SCANNING feature flag in the chart, so that…
vikin91 52b12a7
Remove feature flag RHCOSNodeScanning
vikin91 cf0dc19
Improve code in the e2e test
vikin91 f6fe85f
Use realistic namespace value
vikin91 089f1df
Rename fields in proto. Add Notes to GetNodeVulnerabilitiesRequest
vikin91 45be13f
Handle uncertifiedRHEL. Move hasUncertifiedRHEL to common pkg
vikin91 f6c9742
Add test case for uncertifiedRHEL scan
vikin91 7c8416a
Apply renaming in e2e test
vikin91 f75f7d3
Fix expected result for uncertifiedRHEL scan
vikin91 e0a6003
Add testcase for feat with 0 vulnerabilities. Fix issues found on the…
vikin91 0070416
Add --fail to curl
vikin91 de9c59c
Add assertion on number of features in the API response
vikin91 5fe7d4f
Remove curl support
vikin91 c1eee55
Correct leftovers
vikin91 687f46c
Extract ConvertFeatures to a separate pkg
vikin91 875c69d
Add comment to meet style reqs
vikin91 e2e5d30
Simplify the test assertions
vikin91 fe94c74
Add comments about spot-checking of vulns
vikin91 6692db4
Address review comments
vikin91 fe869a5
Remove nil check in test code
vikin91 1e3bd9d
Remove accidentally added blank lines
vikin91 5216a20
Add comment to the grep test case stating that this may fail in the f…
vikin91 d26da56
Use map for storing test cases
vikin91 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package features | ||
|
||
import ( | ||
log "github.com/sirupsen/logrus" | ||
apiV1 "github.com/stackrox/scanner/api/v1" | ||
"github.com/stackrox/scanner/api/v1/convert" | ||
v1 "github.com/stackrox/scanner/generated/scanner/api/v1" | ||
) | ||
|
||
// ConvertFeatures converts api Features into v1 (proto) Feature pointers. | ||
func ConvertFeatures(apiFeatures []apiV1.Feature) []*v1.Feature { | ||
features := make([]*v1.Feature, 0, len(apiFeatures)) | ||
for _, a := range apiFeatures { | ||
vulns := convertVulnerabilities(a.Vulnerabilities) | ||
|
||
features = append(features, &v1.Feature{ | ||
Name: a.Name, | ||
Version: a.Version, | ||
FeatureType: a.VersionFormat, | ||
AddedByLayer: a.AddedBy, | ||
Location: a.Location, | ||
Vulnerabilities: vulns, | ||
FixedBy: a.FixedBy, | ||
ProvidedExecutables: a.Executables, | ||
}) | ||
} | ||
return features | ||
} | ||
|
||
func convertVulnerabilities(apiVulns []apiV1.Vulnerability) []*v1.Vulnerability { | ||
vulns := make([]*v1.Vulnerability, 0, len(apiVulns)) | ||
for _, v := range apiVulns { | ||
metadata, err := convert.MetadataMap(v.Metadata) | ||
if err != nil { | ||
log.Errorf("error converting metadata map: %v", err) | ||
continue | ||
} | ||
if metadata == nil { | ||
log.Warnf("metadata is nil for %s; skipping...", v.Name) | ||
continue | ||
} | ||
|
||
vulns = append(vulns, &v1.Vulnerability{ | ||
Name: v.Name, | ||
Description: v.Description, | ||
Link: v.Link, | ||
MetadataV2: metadata, | ||
FixedBy: v.FixedBy, | ||
Severity: v.Severity, | ||
}) | ||
} | ||
return vulns | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.