in providers/idefense/schema/convert.go [127:171]
func (item *Vulnerability) makeConfigurations() (*nvd.NVDCVEFeedJSON10DefConfigurations, error) {
configs := item.findConfigurations()
if len(configs) == 0 {
return nil, errors.New("unable to find any configurations in data")
}
var matches []*nvd.NVDCVEFeedJSON10DefCPEMatch
for _, cfg := range configs {
for _, affected := range cfg.Affected {
match := &nvd.NVDCVEFeedJSON10DefCPEMatch{
Cpe23Uri: cfg.Cpe23Uri,
Vulnerable: true,
}
// determine version ranges
if cfg.HasFixedBy {
if affected.Prior {
match.VersionEndExcluding = cfg.FixedByVersion
} else {
match.VersionStartIncluding = affected.Version
match.VersionEndExcluding = cfg.FixedByVersion
}
} else {
if affected.Prior {
// affects all versions
} else {
match.VersionStartIncluding = affected.Version
}
}
matches = append(matches, match)
}
}
v := nvd.NVDCVEFeedJSON10DefConfigurations{
CVEDataVersion: cveDataVersion,
Nodes: []*nvd.NVDCVEFeedJSON10DefNode{
&nvd.NVDCVEFeedJSON10DefNode{
CPEMatch: matches,
Operator: "OR",
},
},
}
return &v, nil
}