mirror of
https://github.com/fleetdm/fleet
synced 2026-05-22 08:28:52 +00:00
main task: #19857 subtask: #21392 - For GET /api/v1/fleet/vulnerabilities/{cve} endpoint, added validation of CVE format, and added a 204 response. The 204 response indicates that the vulnerability is known to Fleet but not present on any hosts. - Removed the previous known_vulnerability field implementation # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/Committing-Changes.md#changes-files) for more information. - [x] Added/updated tests - [x] Manual QA for all new/changed functionality
27 lines
723 B
Go
27 lines
723 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
)
|
|
|
|
var eeValidVulnSortColumns = []string{
|
|
"cve",
|
|
"hosts_count",
|
|
"created_at",
|
|
"cvss_score",
|
|
"epss_probability",
|
|
"cve_published",
|
|
}
|
|
|
|
func (svc *Service) ListVulnerabilities(ctx context.Context, opt fleet.VulnListOptions) ([]fleet.VulnerabilityWithMetadata, *fleet.PaginationMetadata, error) {
|
|
opt.ValidSortColumns = eeValidVulnSortColumns
|
|
opt.IsEE = true
|
|
return svc.Service.ListVulnerabilities(ctx, opt)
|
|
}
|
|
|
|
func (svc *Service) Vulnerability(ctx context.Context, cve string, teamID *uint, useCVSScores bool) (vuln *fleet.VulnerabilityWithMetadata,
|
|
known bool, err error) {
|
|
return svc.Service.Vulnerability(ctx, cve, teamID, true)
|
|
}
|