Skip to content

Commit e0c845e

Browse files
iansltxgeorgekarrv
authored andcommitted
Don't panic on zero-length NVD description_data array fields (#21250)
#21242 # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [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] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) QA'd manually (see repro scenario in the linked bug). Happy to dig into adding tests here if it's worth the time to build them now that the upstream data feed has been patchd.
1 parent f30ae80 commit e0c845e

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

changes/21242-nvd-input-validation

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Continue with an empty CVE description when the NVD CVE feed doesn't include description entries (instead of panicking)

server/vulnerabilities/nvd/sync.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,10 @@ func LoadCVEMeta(ctx context.Context, logger log.Logger, vulnPath string, ds fle
216216
}
217217
schema := vuln.Schema()
218218

219-
meta := fleet.CVEMeta{
220-
CVE: cve,
221-
Description: schema.CVE.Description.DescriptionData[0].Value,
219+
meta := fleet.CVEMeta{CVE: cve}
220+
221+
if len(schema.CVE.Description.DescriptionData) > 0 {
222+
meta.Description = schema.CVE.Description.DescriptionData[0].Value
222223
}
223224

224225
if schema.Impact.BaseMetricV3 != nil {

0 commit comments

Comments
 (0)