Skip to content

Modify NPM importer to support package-first mode #1941

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

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

Conversation

michaelehab
Copy link
Collaborator

Solves #1936

  • Update NPM importer to filter and process advisories relevant to the purl passed in the constructor
  • Update NPM v2 importer to filter and process advisories relevant to the purl passed in the constructor
  • Update NPM importer tests to test package-first mode
  • Update NPM v2 importer tests to test package-first mode

* Update NPM importer to filter and process advisories relevant to the purl passed in the constructor

* Update NPM v2 importer to filter and process advisories relevant to the purl passed in the constructor

* Update NPM importer tests to test package-first mode

* Update NPM v2 importer tests to test package-first mode

Signed-off-by: Michael Ehab Mikhail <michael.ehab@hotmail.com>
…1936

Signed-off-by: Michael Ehab Mikhail <michael.ehab@hotmail.com>
@michaelehab michaelehab requested review from TG1999 and keshav-space and removed request for TG1999 July 12, 2025 09:23
@michaelehab michaelehab self-assigned this Jul 13, 2025
@classmethod
def steps(cls):
return (
return [
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this change ?

advisory_files = filtered_files

for advisory in list(advisory_files):
for result in self.to_advisory_data(advisory):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we are not using yield from here ?

advisory_files = list(vuln_directory.glob("*.json"))

if not self.is_batch_run:
package_name = self.purl.name
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we not actually check in our DB if the purl exists, before even checking all files ?

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