Skip to content

Commit

Permalink
fix: handle CWE name suffixed with 'noinfo'
Browse files Browse the repository at this point in the history
@daviskirk suggestion

Co-authored-by: Davis Kirkendall <1049817+daviskirk@users.noreply.github.com>
  • Loading branch information
JimmyDore and daviskirk committed May 25, 2023
1 parent 7aad2e2 commit edfe36c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Community Contributors

- Jacob A. - https://github.com/jwa5426
- Jacob A. - https://github.com/jwa5426
- Jimmy D. - https://github.com/JimmyDore
8 changes: 7 additions & 1 deletion jake/command/oss.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,20 @@ def handle_args(self) -> int:
vector=oic_vulnerability.cvss_vector
)
)
cwes = None
if oic_vulnerability.cwe:
try:
cwes = [int(oic_vulnerability.cwe[4:])]
except ValueError:
pass # ignore cases where conversion to int fails

vulnerability: Vulnerability = Vulnerability(
bom_ref=oic_vulnerability.id,
id=oic_vulnerability.id,
source=VulnerabilitySource(
name='OSS Index', url=XsUri(oic_vulnerability.reference)
),
cwes=[int(oic_vulnerability.cwe[4:])] if oic_vulnerability.cwe else None,
cwes=cwes,
description=oic_vulnerability.title,
detail=oic_vulnerability.description,
ratings=ratings,
Expand Down

0 comments on commit edfe36c

Please sign in to comment.