Skip to content

Commit

Permalink
adding some more error handling for when trivy glitches out on their …
Browse files Browse the repository at this point in the history
…licensing
  • Loading branch information
faizanH committed Dec 16, 2024
1 parent 7cfadd2 commit ef40d6e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions backend/engine/processor/sbom_cdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ def process_dependency(dep: dict, scan: Scan) -> None:
# Add the license object to the list for this component
licenses.append(license_obj_cache[license_id])

# Logging when a component has more than 15 licenses, as that is usually caused by a bug by Trivy
if len(licenses) > 15:
logger.error(f"{component} potentially contains incorrect license information")
# Update the component's set of licenses
if len(licenses) > 20:
logger.error(f"too many license reported: {licenses}")
if licenses:
component.licenses.set(licenses)

Expand Down

0 comments on commit ef40d6e

Please sign in to comment.