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

fix: offline scanning having different results than online #1566

Merged
merged 5 commits into from
Feb 5, 2025

Conversation

another-rex
Copy link
Collaborator

This fixes offline scanning having different results compared to using the API. Seems to have two causes:

  • vulnerabilities.Include function tests whether a vulnerability is included in aliases as well, and offline scanning skips those vulns if it is included in aliases. However, this is not the behavior of online scanning, where we return all records that match and do not skip alised vulns.
  • osv.dev query code has a special section to edit stdlib versions without a patch version to always assume it's at the max patch version. This code is not replicated in offline matcher code.
    • I initially placed it in the query code because I didn't want to show the patched version in the output. But I think it's probably a good thing that we show how we are interpreting a version rather than silently patching it, so moved it out to our PackageInfo struct.

@codecov-commenter
Copy link

codecov-commenter commented Feb 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.31%. Comparing base (5d239bf) to head (5875aa0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1566      +/-   ##
==========================================
- Coverage   69.34%   69.31%   -0.04%     
==========================================
  Files         200      200              
  Lines       19059    19029      -30     
==========================================
- Hits        13216    13189      -27     
+ Misses       5135     5133       -2     
+ Partials      708      707       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@hogo6002 hogo6002 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 need to remove the unused functions.

@another-rex another-rex merged commit e146bf5 into google:main Feb 5, 2025
13 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.

4 participants