-
-
Notifications
You must be signed in to change notification settings - Fork 234
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
base: main
Are you sure you want to change the base?
Conversation
* 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 <[email protected]>
…1936 Signed-off-by: Michael Ehab Mikhail <[email protected]>
@classmethod | ||
def steps(cls): | ||
return ( | ||
return [ |
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.
Why this change ?
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 should be a tuple as well to maintain code consistency. I will change this.
advisory_files = filtered_files | ||
|
||
for advisory in list(advisory_files): | ||
for result in self.to_advisory_data(advisory): |
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.
Why we are not using yield from here ?
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.
Do you mean?
for advisory in list(advisory_files):
yield from self.to_advisory_data(advisory)
advisory_files = list(vuln_directory.glob("*.json")) | ||
|
||
if not self.is_batch_run: | ||
package_name = self.purl.name |
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.
Why we not actually check in our DB if the purl exists, before even checking all files ?
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.
How does that guarantee that we won't find new advisories if we have the purl in DB?
As far as I understand, in order to find out whether we have new advisories, we have to check all files.
Solves #1936