-
Notifications
You must be signed in to change notification settings - Fork 12
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
ROX-12577 Scanner: load Istio dump #955
Conversation
Images are ready for the commit at 406c7b5. To use the images, use the tag |
e742532
to
272d78a
Compare
2d653fd
to
ad8ad7d
Compare
… build scripts and Added Istio bundle dir
ad8ad7d
to
f0c41b1
Compare
cmd/updater/diffdumps/cmd.go
Outdated
continue | ||
} | ||
if err := generateK8sDiff(k8sSubDir, baseFiles[name], headF); err != nil { | ||
if err := generateK8sDiff(subDir, baseFiles[name], headF); err != nil { |
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.
It should not be generateK8sDiff here. This function does not seem to be generic to different component.
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.
Yeah, this is wrong. I will fix this part.
cmd/updater/diffdumps/cmd.go
Outdated
@@ -99,10 +107,10 @@ func generateK8sDiffs(outputDir string, baseZipR *zip.ReadCloser, headZipR *zip. | |||
} | |||
|
|||
// Only look at YAML files in the k8s/ folder. |
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.
K8s?
e2f85dd
to
248b000
Compare
pkg/vulnloader/istioloader/yaml.go
Outdated
"github.com/stackrox/istio-cves/types" | ||
) | ||
|
||
// LoadYAMLFileFromReader loads the Kubernetes CVE feed from the given io.Reader. |
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.
Istio vulnerability feed
pkg/vulnloader/istioloader/yaml.go
Outdated
if err != nil { | ||
return types.Vuln{}, errors.Wrap(err, "reading YAML contents") | ||
} | ||
var schema types.Vuln |
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.
schema
=> vuln
@@ -1990,7 +1990,7 @@ var testCases = []testCase{ | |||
}, | |||
AddedBy: "sha256:36e8e9714b9a509fae9e515ff16237928c3d809f5ae228b14d2f7d7605c02623", | |||
Location: "jars/jackson-databind-2.9.10.4.jar", | |||
FixedBy: "2.12.6.1", | |||
FixedBy: "2.14.0", |
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.
This should really be done in a separate PR, but it's fine for now
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.
Yeah, I was using another pr but the CI always timed out. Meanwhile I didn't remove this change from this pr.
cmd/updater/diffdumps/cmd.go
Outdated
@@ -98,12 +148,18 @@ func generateK8sDiffs(outputDir string, baseZipR *zip.ReadCloser, headZipR *zip. | |||
continue | |||
} | |||
|
|||
// Only look at YAML files in the k8s/ folder. | |||
if filepath.Dir(name) != vulndump.K8sDirName || filepath.Ext(name) != ".yaml" { | |||
// Only look at YAML files in the k8s/ or istio/ folder. |
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.
in case we add another for some reason, let's just say "Only look at YAML files in the given dirName
directory."
cmd/updater/diffdumps/cmd.go
Outdated
continue | ||
} | ||
if err := generateK8sDiff(k8sSubDir, baseFiles[name], headF); err != nil { | ||
return errors.Wrapf(err, "generating Kubernetes diff for file %q", headF.Name) | ||
if outputDir == vulndump.K8sDirName { |
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.
Instead of doing this check, maybe we pass in a generateDiffFunc
to this function since they both have the same function signature
cmd/updater/diffdumps/cmd.go
Outdated
defer utils.IgnoreError(outF.Close) | ||
|
||
if !reflect.DeepEqual(baseIstioDump, istioDump) { | ||
log.Infof("Kubernetes CVE file %q is in the diff", headF.Name) |
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.
Istio
cmd/updater/diffdumps/cmd.go
Outdated
if !reflect.DeepEqual(baseIstioDump, istioDump) { | ||
log.Infof("Kubernetes CVE file %q is in the diff", headF.Name) | ||
if _, err := io.Copy(outF, headReader); err != nil { | ||
return errors.Wrap(err, "copying Kubernetes CVE file") |
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.
Istio vulnerability
0ccf242
to
30882af
Compare
…e generateDiffFunc
1ed9d95
to
f8fd461
Compare
@daynewlee: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
very minor nits. Did you also confirm the vulns are stored in the scanner
image as expected?
cmd/updater/diffdumps/cmd.go
Outdated
@@ -69,9 +73,57 @@ func generateK8sDiff(outputDir string, baseF, headF *zip.File) error { | |||
return nil | |||
} | |||
|
|||
func generateIstioDiffHelper(outputDir string, baseF, headF *zip.File) error { |
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.
nit: generateIstioDiff
cmd/updater/diffdumps/cmd.go
Outdated
if err := generateK8sDiff(k8sSubDir, baseFiles[name], headF); err != nil { | ||
return errors.Wrapf(err, "generating Kubernetes diff for file %q", headF.Name) | ||
if err := generateDiffs(subDir, baseFiles[name], headF); err != nil { | ||
return errors.Wrapf(err, "generating Istio diff for file %q", headF.Name) |
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.
remove Istio
, as it's not clear if this is k8s or Istio at this time
|
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.
Don't forget to change the PR title :)
In this pr, we want to make sure Scanner can load Istio dump, detect changes in Istio dump in run time and in CI.