-
-
Notifications
You must be signed in to change notification settings - Fork 233
Huawei Pipeline Added with Tests #1770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Rishi Garg <[email protected]>
Signed-off-by: Rishi Garg <[email protected]>
Hi @TG1999 , Can you please review this pipeline importer. |
@Rishi-source I am also a contributor for vulnerablecode. You recently pushed code for huawei pipelines. I was working on some other advisories , and wanted to create tests for it , how should I create the JSON files for tests ? The output of my advisory data looks like this. Your help will be really appreciated
|
Hi @kunalsz, In order to convert the advisory data to json you have to firstly convert your AdvisoryData object to a dictionary
then import json and convert the dictionary to JSON formatted string.
you can add indent = 2 it enhances the readability of json format. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Rishi-source, see the suggestions and feedback. Again, browsing the vulnerability package details throws 500 error. Make sure to test the pipeline on your local machine and also cross-validate the imported vulnerability against the upstream advisory.
spdx_license_expression = "LicenseRef-Terms-Of-Use" | ||
license_url = "https://consumer.huawei.com/en/legal/terms-of-use/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the license for the security bulletin. We should leave this empty for now and reach out to them later to clarify the license for the security advisory.
def __init__(self): | ||
super().__init__() | ||
self.raw_data = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unnecessary.
""" | ||
self.log(f"Fetching {self.url}") | ||
try: | ||
response = requests.get(f"{self.url}2024/9/") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not make sense to collect advisories only from Sep-2024, we should collect all the security bulletins from https://consumer.huawei.com/en/support/bulletin/.
AffectedPackage( | ||
package=PackageURL(type="huawei", name=system_type), | ||
affected_version_range=VersionRange.from_string( | ||
f"vers:generic/={version_number}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead, we should add the huawei VersionRange in univers and use that here.
Reference( | ||
reference_id=data["cve_id"], | ||
url=f"https://nvd.nist.gov/vuln/detail/{data['cve_id']}", | ||
severities=[severity], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is completely wrong. This severity score is coming from huawei. why would you add NVD url to it?
The following pull request is fixes the issue fixes #1750 and adds a pipeline importer with tests.
Signed-off-by: Rishi Garg [email protected]