mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 13:43:01 -06:00
Improve markdown report
This commit is contained in:
parent
1e6c674d67
commit
be9f5f37ca
2
.github/workflows/container.yml
vendored
2
.github/workflows/container.yml
vendored
@ -4,6 +4,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- "*"
|
||||||
|
branches:
|
||||||
|
- "main"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
|
|||||||
@ -27,8 +27,15 @@ type markdownTemplateInputRemediation struct {
|
|||||||
Score int
|
Score int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type markdownTemplateInputResultSummary struct {
|
||||||
|
Ecosystem string
|
||||||
|
PackageCount int
|
||||||
|
PackageWithIssuesCount int
|
||||||
|
}
|
||||||
|
|
||||||
type markdownTemplateInput struct {
|
type markdownTemplateInput struct {
|
||||||
Remediations []markdownTemplateInputRemediation
|
Remediations map[string][]markdownTemplateInputRemediation
|
||||||
|
Summary map[string]markdownTemplateInputResultSummary
|
||||||
ManifestsCount int
|
ManifestsCount int
|
||||||
PackagesCount int
|
PackagesCount int
|
||||||
}
|
}
|
||||||
@ -73,14 +80,27 @@ func (r *markdownReportGenerator) Finish() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sortedList := sr.sortedRemediations()
|
sortedList := sr.sortedRemediations()
|
||||||
remediations := []markdownTemplateInputRemediation{}
|
remediations := map[string][]markdownTemplateInputRemediation{}
|
||||||
|
summaries := map[string]markdownTemplateInputResultSummary{}
|
||||||
|
|
||||||
for _, s := range sortedList {
|
for _, s := range sortedList {
|
||||||
remediations = append(remediations, markdownTemplateInputRemediation{
|
mp := s.pkg.Manifest.Path
|
||||||
|
remediations[mp] = append(remediations[mp], markdownTemplateInputRemediation{
|
||||||
Pkg: s.pkg,
|
Pkg: s.pkg,
|
||||||
PkgRemediationName: sr.packageNameForRemediationAdvice(s.pkg),
|
PkgRemediationName: sr.packageNameForRemediationAdvice(s.pkg),
|
||||||
Score: s.score,
|
Score: s.score,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if _, ok := summaries[mp]; !ok {
|
||||||
|
summaries[mp] = markdownTemplateInputResultSummary{
|
||||||
|
Ecosystem: s.pkg.Manifest.Ecosystem,
|
||||||
|
PackageCount: len(s.pkg.Manifest.Packages),
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
s := summaries[mp]
|
||||||
|
s.PackageWithIssuesCount += 1
|
||||||
|
summaries[mp] = s
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpl, err := template.New("markdown").Parse(markdownTemplate)
|
tmpl, err := template.New("markdown").Parse(markdownTemplate)
|
||||||
@ -98,5 +118,6 @@ func (r *markdownReportGenerator) Finish() error {
|
|||||||
Remediations: remediations,
|
Remediations: remediations,
|
||||||
ManifestsCount: sr.summary.manifests,
|
ManifestsCount: sr.summary.manifests,
|
||||||
PackagesCount: sr.summary.packages,
|
PackagesCount: sr.summary.packages,
|
||||||
|
Summary: summaries,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,18 +2,33 @@
|
|||||||
|
|
||||||
## Summary
|
## Summary
|
||||||
|
|
||||||
* {{ .ManifestsCount }} manifest(s) were scanned
|
| | |
|
||||||
* {{ .PackagesCount }} packages were analyzed
|
|-----------|-----------------------|
|
||||||
|
| Manifests | {{ .ManifestsCount }} |
|
||||||
|
| Packages | {{ .PackagesCount }} |
|
||||||
|
|
||||||
|
## Results
|
||||||
|
|
||||||
|
| Manifest | Ecosystem | Packages | :x: Packages with Issues |
|
||||||
|
|----------|-----------|----------|--------------------------|
|
||||||
|
{{- range $key, $value := .Summary }}
|
||||||
|
| {{ $key }} | {{ $value.Ecosystem }} | {{ $value.PackageCount }} | {{ $value.PackageWithIssuesCount }} |
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
## Remediation Advice
|
## Remediation Advice
|
||||||
|
|
||||||
The table below lists advice for dependency upgrade to mitigate one or more
|
The table below lists advice for dependency upgrade to mitigate one or more
|
||||||
issues identified during the scan.
|
issues identified during the scan.
|
||||||
|
|
||||||
|
{{ range $key, $value := .Remediations }}
|
||||||
|
> {{ $key }}
|
||||||
|
|
||||||
| Package | Update Version | Risk Score | Issues |
|
| Package | Update Version | Risk Score | Issues |
|
||||||
|---------|----------------|------------|--------|
|
|---------|----------------|------------|--------|
|
||||||
{{- range .Remediations }}
|
{{- range $value }}
|
||||||
| {{ .PkgRemediationName }} | {{ .Pkg.Insights.PackageCurrentVersion }} | {{ .Score }} | - |
|
| {{ .PkgRemediationName }} | {{ .Pkg.Insights.PackageCurrentVersion }} | {{ .Score }} | - |
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user