chore: publish IntegraCI build modules a11ec75d3e09
This commit is contained in:
1 parent
694710104a
commit
3c2b80914e
78 files changed
+4982
-405
No files matched your search
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// vulnDBUpdatedAt returns VulnerabilityDB.UpdatedAt from `trivy version
|
||||
// --format json`, or "" when the output carries none (no DB in the cache, an
|
||||
// older Trivy, not JSON). The platform reads it from report_data
|
||||
// ("vuln_db_updated_at") and treats a database older than
|
||||
// secure_delivery_vuln_db_max_age_days, or an absent date, as `cve = unknown`
|
||||
// (ADR-0093 §8). The value is passed through unparsed: judging it is the
|
||||
// platform's job, and a runner clock must not decide it.
|
||||
func vulnDBUpdatedAt(versionJSON string) string {
|
||||
var v struct {
|
||||
VulnerabilityDB *struct {
|
||||
UpdatedAt string `json:"UpdatedAt"`
|
||||
} `json:"VulnerabilityDB"`
|
||||
}
|
||||
if err := json.Unmarshal([]byte(versionJSON), &v); err != nil || v.VulnerabilityDB == nil {
|
||||
return ""
|
||||
}
|
||||
return v.VulnerabilityDB.UpdatedAt
|
||||
}
|
||||
Reference in new issue
Block a user