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

vulndb evaluator: Cleanups and unit tests for the package database lookups #949

Merged
merged 3 commits into from
Sep 13, 2023

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Sep 13, 2023

The PR to implement the first version of PR vulnerability scanning was merged
so that we can have something demoable soon, but the code quality was not up
to even MVP standards (thanks Ozz and Luke for closing both eyes during review).

As I'm implementing the rest of the features for this epic, I'm also going
back and cleaning up the code and adding tests. This PR handles the package
database module.

Commit messages in the patches have more details about each patch.

Copy link
Contributor

@JAORMX JAORMX left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment before merging

internal/engine/eval/vulncheck/pkgdb.go Outdated Show resolved Hide resolved
…egistry

The fixes include:
    - properly handle non-200 error codes
    - get rid of the separate npmPackageReply and packageJson
      structures, just parse what we need using a single struct
    - don't read the whole reply into a byte slice, use a reader instead
This will make the http queries more performant
Increases test coverage from 0% to ~90% for the pkgdb.go module
@jhrozek jhrozek merged commit 71db85a into mindersec:main Sep 13, 2023
12 checks passed
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