Skip to content

Add CWE support in all importers - #1137

Merged
TG1999 merged 1 commit into
aboutcode-org:mainfrom
ziadhany:cwe-importers
Nov 15, 2023
Merged

TG1999 merged 1 commit into
aboutcode-org:mainfrom
ziadhany:cwe-importers

Conversation

@ziadhany

Copy link
Copy Markdown
Collaborator

issues: #1093

@ziadhany ziadhany changed the title Add CWE support for gitlab and redhat Add CWE support in all importers Mar 7, 2023
@TG1999

TG1999 commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

@ziadhany Thanks++, before associating any vulnerability with CWE please check if it exists in cwe2 DB or not like this #1256, and also please do this for NVD importer too.

@TG1999 TG1999 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ziadhany thanks++, some nits for your consideration

Comment thread vulnerabilities/importers/github.py Outdated
else:
logger.error(f"Unknown identifier type {identifier_type!r} and value {value!r}")

weaknesses = []

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make a separate function get_cwes_from_github_advisory and add docstring and tests for that.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread vulnerabilities/importers/gitlab.py Outdated
try:
db.get(cwe_id)
weaknesses.append(cwe_id)
except Exception:

@ziadhany ziadhany Nov 14, 2023

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should change this general exception and replace it with ( InvalidCWEError ) after we merge this aboutcode-org/cwe2#10

Add get_cwes_from_github_advisory function and a test
Add CWE support for github importer
Add CWE support for osv
Add CWE support for gitlab and redhat

Signed-off-by: ziadhany <ziadhany2016@gmail.com>

@TG1999 TG1999 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TG1999
TG1999 merged commit a114deb into aboutcode-org:main Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants