perf(local): only load advisories that are about the packages being scanned#2241
Merged
another-rex merged 3 commits intogoogle:mainfrom Oct 1, 2025
Merged
perf(local): only load advisories that are about the packages being scanned#2241another-rex merged 3 commits intogoogle:mainfrom
another-rex merged 3 commits intogoogle:mainfrom
Conversation
67db513 to
fea59d2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2241 +/- ##
==========================================
- Coverage 67.71% 67.46% -0.26%
==========================================
Files 169 169
Lines 16272 16386 +114
==========================================
+ Hits 11019 11055 +36
- Misses 4578 4655 +77
- Partials 675 676 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
fea59d2 to
ee40413
Compare
ee40413 to
53a40b3
Compare
another-rex
approved these changes
Sep 23, 2025
G-Rath
commented
Sep 23, 2025
364707c to
88bcecd
Compare
Collaborator
|
Got a conflict, but otherwise should be good to merge |
582ea62 to
0786a18
Compare
another-rex
reviewed
Oct 1, 2025
| func mightAffectPackages(v osvschema.Vulnerability, names []string) bool { | ||
| for _, affected := range v.Affected { | ||
| for _, name := range names { | ||
| if affected.Package.Name == name { |
Collaborator
There was a problem hiding this comment.
We need another check for Repo name here I believe to solve the GIT issue
0786a18 to
3aa885f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This updates the local matcher to have it skip advisories that don't have at least one affected entry with a package name matching one of the packages being scanned in the current run, which can greatly reduce the peak memory usage for databases like Ubuntu (going from something like 10gb down to 1gb).
Since we cache databases based on their ecosystem only, this does mean subsequent calls to
LocalMatcher#MatchVulnerabilitieswill not give any results for packages that were not present in the first call - while this shouldn't be a problem currently since we handle creating theVulnerabilityMatcheras part of scanning, I've added a basic guard that returns an error if the function is called with any "partial" database cached to catch this (be it on purpose or because of a bug)This should not impact guided remediation since it explicitly loads the database before doing any work meaning this change won't help it but should also not hurt it
Resolves #2217 (again)