Merge pull request #9811 from steven-zou/fix/issue_#9795_add_scan_by

add scan by info in the scan report summary
This commit is contained in:
Steven Zou 2019-11-09 09:24:23 +08:00 committed by GitHub
commit 5cebfd17d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -156,5 +156,7 @@ func GenerateNativeSummary(r *scan.Report, options ...Option) (interface{}, erro
sum.Severity = overallSev
}
sum.Scanner = rp.Scanner
return sum, nil
}

View File

@ -100,6 +100,10 @@ func (suite *SummaryTestSuite) TestSummaryGenerateSummaryNoOptions() {
suite.Equal(vuln.High, nativeSummary.Severity)
suite.Nil(nativeSummary.CVEBypassed)
suite.Equal(2, nativeSummary.Summary.Total)
suite.Equal("Clair", nativeSummary.Scanner.Name)
suite.Equal("Harbor", nativeSummary.Scanner.Vendor)
suite.Equal("0.1.0", nativeSummary.Scanner.Version)
}
// TestSummaryGenerateSummaryWithOptions ...

View File

@ -16,6 +16,8 @@ package vuln
import (
"time"
v1 "github.com/goharbor/harbor/src/pkg/scan/rest/v1"
)
// NativeReportSummary is the default supported scan report summary model.
@ -29,6 +31,7 @@ type NativeReportSummary struct {
CVEBypassed []string `json:"-"`
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Scanner *v1.Scanner `json:"scanner,omitempty"`
}
// VulnerabilitySummary contains the total number of the found vulnerabilities number