Skip to content
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

Add importer for vmware/photon/wiki/Security-Advisories vulnerabilities advisories #1683

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Samk1710
Copy link

@Samk1710 Samk1710 commented Nov 26, 2024

Added an importer at vulnerabilities/pipelines/vmwarephoton_importer.py and registered in vulnerabilities/importers/init.py
Addressing issue: #36

Signed-off-by: Sampurna Pyne [email protected]

Copy link
Member

@keshav-space keshav-space left a comment

Choose a reason for hiding this comment

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

Thanks @Samk1710, see some suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

Why commit the Qdrant init config?

advisories = []
for url in self.urls:
try:
response = requests.get(url)
Copy link
Member

Choose a reason for hiding this comment

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

Why fetch these twice? both in advisories_count and here.


# Use GenericVersion to handle non-semver versions
try:
fixed_version = GenericVersion(rev_ver)
Copy link
Member

Choose a reason for hiding this comment

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

Should we add support for PhotonVersion, or could we instead use RpmVersion?

response = requests.get(url)
response.raise_for_status()
advisories_data = response.json() # Fetch the data from the API
advisories.extend(self.to_advisory(advisories_data)) # Collect advisories for each URL
Copy link
Member

Choose a reason for hiding this comment

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

Not the right approach, advisory should always be yielded. No need to compute all advisory at once. See the other importer pipelines like https://github.com/aboutcode-org/vulnerablecode/blob/main/vulnerabilities/pipelines/nginx_importer.py

Copy link
Author

Choose a reason for hiding this comment

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

Thankyou @keshav-space for the suggestions. I will look into them and make the changes. Thankyou.

@captn3m0
Copy link

captn3m0 commented Dec 4, 2024

Should we instead use the Photon advisory republished in OSV

Since this code already uses the CVE feed, the additional source I use in generating in the OSV feed are the Photon Security Advisories which are in markdown.

Just for context, the additional information you get from the PHSA feed is the following:

  1. A PHSA identifier, issued by VMWare
  2. A textual severity (Low, Critical, Important, Moderate)
  3. Issue date for the advisory
  4. List of packages that were updated, with the associated checksums and build timestamps.

As an example, PHSA-2024-5.0-0301 includes updates for libarchive - ['CVE-2024-26256'] and openssl - ['CVE-2024-4741'].

The CVE JSON feed includes the following information:

{"cve_id": "CVE-2024-26256", "pkg": "libarchive", "cve_score": 7.8, "aff_ver": "all versions before 3.7.1-2.ph5 are vulnerable", "res_ver": "3.7.1-2.ph5"}

while the PHSA page calls it a "Important" update with an issue date of 2024-06-21 and the following 2 packages:

libarchive-3.7.1-2.ph5.x86_64.rpm | size : 384K , sha256 : 632f9fb09bb56c3b5c38ed668eb29184a9b294be56c510a7a022fe85c5eb9c9c , build time : Fri, 21 Jun 2024 12:40:33 UTC

libarchive-devel-3.7.1-2.ph5.x86_64.rpm | size : 172K , sha256 : 2423a6ddcb83676ba7ab675ad3c2cc19575a42b123cdfe1fd55a51474e1e3664 , build time : Fri, 21 Jun 2024 12:40:33 UTC

The only additional information I consume for the OSV feed is the PHSA ID (I'm planning to add the checksums), so the gains are quite minor - except for interoperability perhaps by relying on OSV imports directly.

@keshav-space
Copy link
Member

@captn3m0 Thanks for all the work on the PhotonOS OSV Advisory. We will be using it in this pipeline.

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.

3 participants