diff --git a/node_scan.go b/node_scan.go index dbe8c73d..d5886d38 100644 --- a/node_scan.go +++ b/node_scan.go @@ -60,11 +60,12 @@ func runNodeScan(ctx context.Context, cfg *Config, root string) []*ScanResults { continue } klog.V(1).InfoS("scanning path", "path", innerPath) - res := scanBinary(ctx, component, tag, ignoreErrors, root, innerPath) + res := scanBinary(ctx, ignoreErrors, root, innerPath) if res.Skip { // Do not add skipped binaries to results. continue } + res.SetTag(tag).SetComponent(component) if res.Error == nil { klog.V(1).InfoS("scanning node success", "path", innerPath, "status", "success") } else { diff --git a/scan.go b/scan.go index 24479dd6..e6ab172f 100644 --- a/scan.go +++ b/scan.go @@ -253,11 +253,12 @@ func validateTag(ctx context.Context, tag *v1.TagReference, cfg *Config) *ScanRe return nil } klog.V(1).InfoS("scanning path", "path", path) - res := scanBinary(ctx, component, tag, ignoreErrors, mountPath, innerPath) + res := scanBinary(ctx, ignoreErrors, mountPath, innerPath) if res.Skip { // Do not add skipped binaries to results. return nil } + res.SetTag(tag).SetComponent(component) if res.Error == nil { klog.V(1).InfoS("scanning success", "image", image, "path", innerPath, "status", "success") } else { diff --git a/validations.go b/validations.go index 34948652..8db1ba82 100644 --- a/validations.go +++ b/validations.go @@ -17,7 +17,6 @@ import ( "github.com/Masterminds/semver/v3" mapset "github.com/deckarep/golang-set/v2" - v1 "github.com/openshift/api/image/v1" ) var ( @@ -334,11 +333,11 @@ func isElfExe(path string) (bool, error) { return false, nil } -func scanBinary(ctx context.Context, component *OpenshiftComponent, tag *v1.TagReference, ignoreErr IgnoreErrors, topDir, innerPath string) *ScanResult { +func scanBinary(ctx context.Context, ignoreErr IgnoreErrors, topDir, innerPath string) *ScanResult { allFn := validationFns["all"] baton := &Baton{TopDir: topDir} - res := NewScanResult().SetComponent(component).SetTag(tag).SetPath(innerPath) + res := NewScanResult().SetPath(innerPath) path := filepath.Join(topDir, innerPath)