Just log the error if vulnerabilities fail (#3963)
* Just log the error if vulnerabilities fail * Add explicit return for more secure future iterations
This commit is contained in:
+17
-13
@@ -706,19 +706,7 @@ func cronVulnerabilities(
|
||||
}
|
||||
|
||||
if !vulnDisabled {
|
||||
err := vulnerabilities.TranslateSoftwareToCPE(ctx, ds, vulnPath, logger, config)
|
||||
if err != nil {
|
||||
level.Error(logger).Log("msg", "analyzing vulnerable software: Software->CPE", "err", err)
|
||||
sentry.CaptureException(err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = vulnerabilities.TranslateCPEToCVE(ctx, ds, vulnPath, logger, config)
|
||||
if err != nil {
|
||||
level.Error(logger).Log("msg", "analyzing vulnerable software: CPE->CVE", "err", err)
|
||||
sentry.CaptureException(err)
|
||||
continue
|
||||
}
|
||||
checkVulnerabilities(ctx, ds, logger, vulnPath, config)
|
||||
}
|
||||
|
||||
if err := ds.CalculateHostsPerSoftware(ctx, time.Now()); err != nil {
|
||||
@@ -731,6 +719,22 @@ func cronVulnerabilities(
|
||||
}
|
||||
}
|
||||
|
||||
func checkVulnerabilities(ctx context.Context, ds fleet.Datastore, logger kitlog.Logger, vulnPath string, config config.FleetConfig) {
|
||||
err := vulnerabilities.TranslateSoftwareToCPE(ctx, ds, vulnPath, logger, config)
|
||||
if err != nil {
|
||||
level.Error(logger).Log("msg", "analyzing vulnerable software: Software->CPE", "err", err)
|
||||
sentry.CaptureException(err)
|
||||
return
|
||||
}
|
||||
|
||||
err = vulnerabilities.TranslateCPEToCVE(ctx, ds, vulnPath, logger, config)
|
||||
if err != nil {
|
||||
level.Error(logger).Log("msg", "analyzing vulnerable software: CPE->CVE", "err", err)
|
||||
sentry.CaptureException(err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func cronWebhooks(ctx context.Context, ds fleet.Datastore, logger kitlog.Logger, identifier string, failingPoliciesSet fleet.FailingPolicySet) {
|
||||
appConfig, err := ds.AppConfig(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user