-
Notifications
You must be signed in to change notification settings - Fork 2.5k
fix(misconf): do not log scanners when misconfig scanning is disabled #8345
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
fix(misconf): do not log scanners when misconfig scanning is disabled #8345
Conversation
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.
Do we need this even when the misconfiguration scanner is disabled?
trivy/pkg/commands/artifact/run.go
Lines 437 to 444 in 6826601
// Filter only enabled misconfiguration scanners | |
ma, err := filterMisconfigAnalyzers(opts.MisconfigScanners, analyzer.TypeConfigFiles) | |
if err != nil { | |
log.Error("Invalid misconfiguration scanners specified, defaulting to use all misconfig scanners", | |
log.Any("scanners", opts.MisconfigScanners)) | |
} else { | |
analyzers = append(analyzers, ma...) | |
} |
Signed-off-by: nikpivkin <[email protected]>
6826601
to
af4379f
Compare
Fixed af4379f |
pkg/commands/artifact/run.go
Outdated
} | ||
|
||
log.Debug("Enabling misconfiguration scanners", | ||
log.Any("scanners", lo.Without(analyzer.TypeConfigFiles, analyzers...))) |
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.
IIUC we don't need to check all analyzers here.
log.Any("scanners", lo.Without(analyzer.TypeConfigFiles, analyzers...))) | |
log.Any("scanners", lo.Without(analyzer.TypeConfigFiles, ma...))) |
pkg/commands/artifact/run.go
Outdated
// Do not perform misconfiguration scanning when it is not specified. | ||
if !opts.Scanners.AnyEnabled(types.MisconfigScanner, types.RBACScanner) { | ||
analyzers = append(analyzers, analyzer.TypeConfigFiles...) | ||
} else { | ||
// Filter only enabled misconfiguration scanners | ||
ma, err := disabledMisconfigAnalyzers(analyzer.TypeConfigFiles, opts.MisconfigScanners) |
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:
is there any point in passing analyzer.TypeConfigFiles
as an argument to the function?
Signed-off-by: nikpivkin <[email protected]>
@aqua-bot backport release/v0.59 |
…#8345) Signed-off-by: nikpivkin <[email protected]>
Backport PR created: #8349 |
…aquasecurity#8345) Signed-off-by: nikpivkin <[email protected]>
Description
This PR logs enabled misconfiguration scanners only when misconfig scanning is enabled.
Checklist