Extend vulnerability age to 30 (#4901)

This commit is contained in:
Tomas Touceda 2022-04-06 11:42:02 -03:00 committed by GitHub
parent 5642981086
commit f2aba83a73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 4 deletions

View File

@ -0,0 +1 @@
* Extend the maximum age for a vulnerability to be considered recent to 30 days instead of 2.

View File

@ -108,7 +108,7 @@ const ManageAutomationsModal = ({
<div className={`${baseClass}__software-automation-description`}>
<p>
A request will be sent to your configured <b>Destination URL</b>{" "}
if a detected vulnerability (CVE) was published in the last 2
if a detected vulnerability (CVE) was published in the last 30
days.
</p>
</div>

View File

@ -61,7 +61,7 @@ var (
// max age to be considered a recent vulnerability (relative to NVD's published date)
// (a var to be able to change in tests)
recentVulnMaxAge = 2 * 24 * time.Hour
recentVulnMaxAge = 30 * 24 * time.Hour
// this allows mocking the time package for tests, by default it is equivalent
// to the time functions, e.g. theClock.Now() == time.Now().
@ -133,8 +133,14 @@ func TranslateCPEToCVE(
return recentVulns, nil
}
func checkCVEs(ctx context.Context, ds fleet.Datastore, logger kitlog.Logger,
cpes []*wfn.Attributes, file string, recentVulns map[string][]string) error {
func checkCVEs(
ctx context.Context,
ds fleet.Datastore,
logger kitlog.Logger,
cpes []*wfn.Attributes,
file string,
recentVulns map[string][]string,
) error {
dict, err := cvefeed.LoadJSONDictionary(file)
if err != nil {