You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-a, --advisories-repo-dir string directory containing the advisories repository
98
-
-f, --advisory-filter string exclude vulnerability matches that are referenced from the specified set of advisories (resolved|all|concluded)
99
-
--build-log treat input as a package build log file (or a directory that contains a packages.log file)
100
-
-D, --disable-sbom-cache don't use the SBOM cache
101
-
--distro string distro to use during vulnerability matching (default "wolfi")
102
-
-h, --help help for scan
103
-
--local-file-grype-db string import a local grype db file
104
-
-o, --output string output format (outline|json), defaults to outline
105
-
-r, --remote treat input(s) as the name(s) of package(s) in the Wolfi package repository to download and scan the latest versions of
106
-
--require-zero exit 1 if any vulnerabilities are found
107
-
-s, --sbom treat input(s) as SBOM(s) of APK(s) instead of as actual APK(s)
108
-
--use-cpes turn on all CPE matching in Grype
97
+
-a, --advisories-repo-dir string directory containing the advisories repository
98
+
-f, --advisory-filter string exclude vulnerability matches that are referenced from the specified set of advisories (resolved|all|concluded)
99
+
--build-log treat input as a package build log file (or a directory that contains a packages.log file)
100
+
-D, --disable-sbom-cache don't use the SBOM cache
101
+
--distro string distro to use during vulnerability matching (default "wolfi")
102
+
-h, --help help for scan
103
+
--local-file-grype-db string import a local grype db file
104
+
--max-allowed-built-age duration Max allowed age for vulnerability database, age being the time since it was built. Default max age is 120h (or five days) (default 120h0m0s)
105
+
-o, --output string output format (outline|json), defaults to outline
106
+
-r, --remote treat input(s) as the name(s) of package(s) in the Wolfi package repository to download and scan the latest versions of
107
+
--require-zero exit 1 if any vulnerabilities are found
108
+
-s, --sbom treat input(s) as SBOM(s) of APK(s) instead of as actual APK(s)
cmd.Flags().BoolVarP(&p.disableSBOMCache, "disable-sbom-cache", "D", false, "don't use the SBOM cache")
353
358
cmd.Flags().BoolVarP(&p.remoteScanning, "remote", "r", false, "treat input(s) as the name(s) of package(s) in the Wolfi package repository to download and scan the latest versions of")
354
359
cmd.Flags().BoolVar(&p.useCPEMatching, "use-cpes", false, "turn on all CPE matching in Grype")
360
+
cmd.Flags().DurationVar(&p.dbMaxAllowedBuildAge, "max-allowed-built-age", 120*time.Hour, "Max allowed age for vulnerability database, age being the time since it was built. Default max age is 120h (or five days)")
returnnil, fmt.Errorf("failed to load vulnerability database: %w", err)
231
248
}
232
249
250
+
// built time is defined in UTC,
251
+
// we should compare it against UTC
252
+
now:=time.Now().UTC()
253
+
age:=now.Sub(dbStatus.Built)
254
+
ifage>maxRecommendedBuildAge {
255
+
fmt.Fprintf(os.Stdout, "WARNING: the vulnerability database was built %s ago (max allowed age is %s but the recommended value is %s)\n", durafmt.ParseShort(age), durafmt.ParseShort(maxAllowedBuildAge), durafmt.ParseShort(maxRecommendedBuildAge))
0 commit comments