2022-05-20 16:58:40 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
|
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
|
|
|
)
|
|
|
|
|
|
2023-12-12 18:24:20 +00:00
|
|
|
func (svc *Service) ListSoftware(ctx context.Context, opts fleet.SoftwareListOptions) ([]fleet.Software, *fleet.PaginationMetadata, error) {
|
2022-05-20 16:58:40 +00:00
|
|
|
// reuse ListSoftware, but include cve scores in premium version
|
2024-12-09 22:23:57 +00:00
|
|
|
// unless without_vulnerability_details is set to true
|
|
|
|
|
// including these details causes a lot of memory bloat
|
2024-12-13 22:39:21 +00:00
|
|
|
if (opts.MaximumCVSS > 0 || opts.MinimumCVSS > 0 || opts.KnownExploit) || !opts.WithoutVulnerabilityDetails {
|
2024-12-09 22:23:57 +00:00
|
|
|
opts.IncludeCVEScores = true
|
|
|
|
|
}
|
2022-05-20 16:58:40 +00:00
|
|
|
return svc.Service.ListSoftware(ctx, opts)
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-18 13:14:20 +00:00
|
|
|
func (svc *Service) SoftwareByID(ctx context.Context, id uint, teamID *uint, _ bool) (*fleet.Software, error) {
|
2022-05-20 16:58:40 +00:00
|
|
|
// reuse SoftwareByID, but include cve scores in premium version
|
2024-02-18 13:14:20 +00:00
|
|
|
return svc.Service.SoftwareByID(ctx, id, teamID, true)
|
2022-05-20 16:58:40 +00:00
|
|
|
}
|