From 64a6222bf943906a5a8629d0cf590a0079c13d52 Mon Sep 17 00:00:00 2001 From: Kota Kanbe Date: Wed, 3 Feb 2021 17:52:44 +0900 Subject: [PATCH] fix(report): set created_at and updated_at of trivy to json (#1162) --- contrib/trivy/parser/parser.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contrib/trivy/parser/parser.go b/contrib/trivy/parser/parser.go index cd918288..3723af5d 100644 --- a/contrib/trivy/parser/parser.go +++ b/contrib/trivy/parser/parser.go @@ -57,12 +57,24 @@ func Parse(vulnJSON []byte, scanResult *models.ScanResult) (result *models.ScanR return references[i].Link < references[j].Link }) + var published time.Time + if vuln.PublishedDate != nil { + published = *vuln.PublishedDate + } + + var lastModified time.Time + if vuln.LastModifiedDate != nil { + lastModified = *vuln.LastModifiedDate + } + vulnInfo.CveContents = models.CveContents{ models.Trivy: models.CveContent{ Cvss3Severity: vuln.Severity, References: references, Title: vuln.Title, Summary: vuln.Description, + Published: published, + LastModified: lastModified, }, } // do only if image type is Vuln