2022-09-06 19:12:17 +00:00
|
|
|
package webhooks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/url"
|
|
|
|
|
|
|
|
"github.com/fleetdm/fleet/v4/server/fleet"
|
|
|
|
fleetwebhooks "github.com/fleetdm/fleet/v4/server/webhooks"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Mapper struct {
|
|
|
|
fleetwebhooks.Mapper
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewMapper() fleetwebhooks.VulnMapper {
|
|
|
|
return &Mapper{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Mapper) GetPayload(
|
|
|
|
hostBaseURL *url.URL,
|
2023-05-17 20:53:15 +00:00
|
|
|
hosts []fleet.HostVulnerabilitySummary,
|
2022-09-13 14:41:52 +00:00
|
|
|
cve string,
|
2022-09-06 19:12:17 +00:00
|
|
|
meta fleet.CVEMeta,
|
|
|
|
) fleetwebhooks.WebhookPayload {
|
|
|
|
r := m.Mapper.GetPayload(hostBaseURL,
|
|
|
|
hosts,
|
2022-09-13 14:41:52 +00:00
|
|
|
cve,
|
2022-09-06 19:12:17 +00:00
|
|
|
meta,
|
|
|
|
)
|
|
|
|
r.EPSSProbability = meta.EPSSProbability
|
|
|
|
r.CVSSScore = meta.CVSSScore
|
|
|
|
r.CISAKnownExploit = meta.CISAKnownExploit
|
2023-03-28 20:11:31 +00:00
|
|
|
r.CVEPublished = meta.Published
|
2022-09-06 19:12:17 +00:00
|
|
|
return r
|
|
|
|
}
|