Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion pkg/scan/apk.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,23 @@ func NewScanner(opts Options) (*Scanner, error) {
dbDestDir = DefaultGrypeDBDir
}

// Default to 24 hours if GRYPE_DB_MAX_ALLOWED_BUILT_AGE is unset
maxAllowedBuiltAge := 24 * time.Hour

grypeMaxAllowedBuiltAge := os.Getenv("GRYPE_DB_MAX_ALLOWED_BUILT_AGE")
if grypeMaxAllowedBuiltAge != "" {
parseMaxAllowedBuiltAge, err := time.ParseDuration(grypeMaxAllowedBuiltAge)
if err != nil {
return nil, fmt.Errorf("could not parse GRYPE_DB_MAX_ALLOWED_BUILT_AGE: %w", err)
}
maxAllowedBuiltAge = parseMaxAllowedBuiltAge
}

installCfg := installation.Config{
DBRootDir: dbDestDir,
ValidateChecksum: true,
ValidateAge: !opts.DisableDatabaseAgeValidation,
MaxAllowedBuiltAge: 24 * time.Hour,
MaxAllowedBuiltAge: maxAllowedBuiltAge,
UpdateCheckMaxFrequency: 1 * time.Hour,
}

Expand Down