fix: keep transitive scanning with --offline-vulnerabilities#2783
Conversation
ee57ce6 to
d407f3d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2783 +/- ##
==========================================
+ Coverage 79.26% 79.29% +0.02%
==========================================
Files 122 122
Lines 8258 8259 +1
==========================================
+ Hits 6546 6549 +3
+ Misses 1329 1328 -1
+ Partials 383 382 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
382bf3d to
10ba3e1
Compare
| "github.com/google/osv-scalibr/plugin" | ||
| ) | ||
|
|
||
| func Test_networkCapability(t *testing.T) { |
There was a problem hiding this comment.
Not too sure if this test is that useful, since it's just testing 1 if statement essentially.
There was a problem hiding this comment.
Thanks, fair point.
I added it as a regression guard for the CompareOffline / PluginNetworkDisabled split, but the transitive scan test covers the user-visible behavior. I can drop this one if you prefer :)
There was a problem hiding this comment.
Hmm... Let's keep it for now since it runs pretty fast, if we find it causing friction later we can remove it.
There was a problem hiding this comment.
Sounds good, thanks for the review!
10ba3e1 to
3f672da
Compare
Overview
Fixes #2775.
--offline-vulnerabilitiesis documented as only switching vulnerability matching to the local DB, but it was also causing Scalibr to filter out network-backed plugins.That meant transitive dependency scanning was disabled even when
--no-resolvewas not passed.This PR keeps that behavior scoped to the full
--offlineflag instead.Details
I added a separate
ScannerActions.PluginNetworkDisabledfield and wire it from--offline.CompareOfflinestill controls the local vulnerability DB path. The source and container scan paths now usePluginNetworkDisabledwhen setting Scalibr's network capability.License behavior under
--offline-vulnerabilitiesis intentionally left unchanged in this PR.Testing
go test ./pkg/osvscanner ./cmd/osv-scanner/internal/helpergo test ./cmd/osv-scanner/scan/source -run TestCommand_Transitive -count=1Also ran:
./scripts/run_tests.shChecklist
./scripts/run_lints.sh../scripts/run_tests.sh.