Skip to content

add-curl-advisories-importer - #1402

Closed
ambuj-1211 wants to merge 9 commits into
aboutcode-org:mainfrom
ambuj-1211:add-curl-advisories-importer
Closed

add-curl-advisories-importer#1402
ambuj-1211 wants to merge 9 commits into
aboutcode-org:mainfrom
ambuj-1211:add-curl-advisories-importer

Conversation

@ambuj-1211

@ambuj-1211 ambuj-1211 commented Jan 25, 2024

Copy link
Copy Markdown
Collaborator

This PR fixes #1166.
The test file is a dummy and will be completed once the curl.py importer is completed.

@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.

@ambuj-1211 thanks ++ for your contribution, I have added some comments for your consideration. Also run make valid command for fixing formatting errors.

Comment thread vulntotal/tests/test_osv.py
Comment thread vulnerabilities/importers/curl.py
Comment thread vulnerabilities/importers/curl.py Outdated
importer_name = "Curl Importer"
api_url = "https://curl.se/docs/vuln.json"

def get_response(self):

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 check utils.py and import fetch_response the function from there

Comment thread vulnerabilities/importers/curl.py Outdated
Comment thread vulnerabilities/importers/curl.py Outdated
for data in raw_data:
cve_id = data["aliases"]
if not cve_id.startswith("CVE"):
logger.error(f"Invalid CVE ID: {cve_id} in package {data['database_specific']['package']}")

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.

Use get method to extract data from dictionary

Comment thread vulnerabilities/importers/curl.py Outdated
# add range of raw data accordingly as f string using first and last value of the list.
affected_version_range = NginxVersionRange.from_native(raw_data["vulnerable"])

fixed_version = SemverVersion(raw_data["affected"][0]["ranges"][0]["events"][1]["fixed"])

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.

Suggested change
fixed_version = SemverVersion(raw_data["affected"][0]["ranges"][0]["events"][1]["fixed"])
fixed_version = SemverVersion(raw_data["affected"][0]["ranges"][0]["events"][1]["fixed"])

Check get_item method in utils.py and before accessing any index check the length of list

@TG1999

TG1999 commented Jan 25, 2024

Copy link
Copy Markdown
Contributor

@ambuj-1211 additionally please sign-off your commits

@ambuj-1211

Copy link
Copy Markdown
Collaborator Author

@TG1999 Apologies for the late response, I was stuck in my end sem exams. Done some changes as mentioned. I also want to know what to do for pURL, as in what should be the type, package name, and other components of the purl and also the version range for curl is not defined in univers what to do for that?

@TG1999

TG1999 commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

type-generic namespace-domain name i.e curl.se name - name of the tool (curl, tiny-curl), version - as specified, download_url as qualifiers, so https://curl.se/download/curl-8.6.0.tar.gz this will be pkg:generic/curl.se/curl@8.6.0?download_url=https://curl.se/download/curl-8.6.0.tar.gz

@TG1999

TG1999 commented Feb 6, 2024

Copy link
Copy Markdown
Contributor

@ambuj-1211 try to collect all the versions of curl and commit a test to check with univers if all versions are effectively Semver Version

@ambuj-1211

ambuj-1211 commented Mar 1, 2024

Copy link
Copy Markdown
Collaborator Author

@TG1999 check if it needs any more changes. Completed the curl.py file and the test_curl.py file.

Signed-off-by: ambuj <kulshreshthaak.12@gmail.com>
@ambuj-1211

Copy link
Copy Markdown
Collaborator Author

@TG1999 done the changes please review the commits

@ambuj-1211 ambuj-1211 closed this by deleting the head repository Mar 17, 2024
@pombredanne

Copy link
Copy Markdown
Member

@ambuj-1211 hey, you are not planning to complete this after all?

@ambuj-1211

ambuj-1211 commented Mar 28, 2024

Copy link
Copy Markdown
Collaborator Author

@pombredanne I made a new pr regarding this issue therefore I closed this one, because there were some problems with this branch which I was not able to resolve.

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.

Add CURL advisories data source

3 participants