Skip to content

Commit

Permalink
Include information about CVE patches in CycloneDX output
Browse files Browse the repository at this point in the history
Signed-off-by: Arnout Engelen <arnout@bzzt.net>
  • Loading branch information
raboof committed Dec 23, 2023
1 parent 9e5ca03 commit c5b2ce3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/sbomnix/sbomdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,26 @@ def _drv_to_cdx_component(drv, uid="store_path"):
if "meta_description" in drv._asdict() and drv.meta_description:
component["description"] = drv.meta_description
_cdx_component_add_licenses(component, drv)
if drv.patches:
security_patches = []
for p in drv.patches.split(' '):
print(p)
m = re.search(r'CVE-\d{4}-\d+', p)
if m:
patch = {
"type": "unofficial",
"resolves": [
{
"type": "security",
"id": m.group(0)
}
]
}
security_patches.append(patch)
if security_patches:
pedigree = {}
pedigree["patches"] = security_patches
component["pedigree"] = pedigree
properties = []
for output_path in drv.outputs:
prop = {}
Expand Down

0 comments on commit c5b2ce3

Please sign in to comment.