Skip to content

Commit

Permalink
feat: append additional references to NVD override record
Browse files Browse the repository at this point in the history
Signed-off-by: Weston Steimel <[email protected]>
  • Loading branch information
westonsteimel committed Nov 4, 2024
1 parent cb83f06 commit 4462e3f
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 8 deletions.
54 changes: 46 additions & 8 deletions schema/overrides.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
"type": "object",
"additionalProperties": false,
"properties": {
"_annotation": {"$ref": "#/$defs/annotation_record"},
"cve": {"$ref": "#/$defs/nvd_cve_record"}
"_annotation": {
"$ref": "#/$defs/annotation_record"
},
"cve": {
"$ref": "#/$defs/nvd_cve_record"
}
},
"required": ["_annotation", "cve"],
"required": [
"_annotation",
"cve"
],
"$defs": {
"annotation_record": {
"type": "object",
Expand All @@ -18,11 +25,14 @@
"reason": {
"type": "string"
},
"generated_from": {
"type": "string"
}
"generated_from": {
"type": "string"
}
},
"required": ["reason", "cve_id"],
"required": [
"reason",
"cve_id"
],
"additionalProperties": true
},
"nvd_cve_record": {
Expand All @@ -34,9 +44,37 @@
"items": {
"$ref": "#/$defs/nvd_cpe_configuration"
}
},
"references": {
"type": "array",
"items": {
"$ref": "#/$defs/nvd_reference"
}
}
}
},
"nvd_reference": {
"type": "object",
"properties": {
"url": {
"maxLength": 500,
"type": "string",
"pattern": "^(ftp|http)s?://\\S+$"
},
"source": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"url"
]
},
"nvd_cpe_configuration": {
"type": "object",
"required": [
Expand Down Expand Up @@ -122,4 +160,4 @@
}
}
}
}
}
13 changes: 13 additions & 0 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ def generate():

override["cve"]["configurations"].append(configuration)

references = enriched["adp"].get("references")
if references:
refs = []

for r in references:
refs.append({
"url": r["url"],
"source": "anchoreadp",
})

if refs:
override["cve"]["references"] = refs

override_path = f"data/{year}"

if not os.path.exists(override_path):
Expand Down

0 comments on commit 4462e3f

Please sign in to comment.