Skip to content

Commit

Permalink
Merge pull request #9811 from steven-zou/fix/issue_#9795_add_scan_by
Browse files Browse the repository at this point in the history
add scan by info in the scan report summary
  • Loading branch information
steven-zou committed Nov 9, 2019
2 parents 0b09bd1 + 7bdf249 commit 5cebfd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/pkg/scan/report/summary.go
Expand Up @@ -156,5 +156,7 @@ func GenerateNativeSummary(r *scan.Report, options ...Option) (interface{}, erro
sum.Severity = overallSev
}

sum.Scanner = rp.Scanner

return sum, nil
}
4 changes: 4 additions & 0 deletions src/pkg/scan/report/summary_test.go
Expand Up @@ -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 ...
Expand Down
3 changes: 3 additions & 0 deletions src/pkg/scan/vuln/summary.go
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 5cebfd1

Please sign in to comment.