feat: support running detectors#2021
Conversation
6935cce to
c1cf931
Compare
Only one of these tests actually uses `--all-packages` but they all output in JSON format so I think this is a better name and that also means its reasonable for us to add more cases such as in #2021
c6483e0 to
0ff98a9
Compare
bf0d582 to
97ca687
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2021 +/- ##
==========================================
+ Coverage 67.50% 67.61% +0.11%
==========================================
Files 172 173 +1
Lines 16242 16293 +51
==========================================
+ Hits 10964 11017 +53
+ Misses 4603 4601 -2
Partials 675 675 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@another-rex turns out I just completely forgot about configuring the snapshot normalizers for JSON 🤦 I think this is good to go, and probably best to land as-is so it can be used, and get things improved in follow up, specifically:
|
|
hmm so the failures on Windows are from detectors such as |
38458e8 to
62afcdf
Compare
another-rex
left a comment
There was a problem hiding this comment.
To make the detector presets more useful, I think we need to do the capabilities filtering ourselves on OSV-Scanner's side, and auto-disable detectors that have requirements that doesn't match.
I'm a bit confused on the windows specific errors, since for container scanning we should be scanning a linux system, even on windows, so I'm not sure why there are those errors appearing.
|
|
||
| // todo: rethink this life choice... | ||
| for name, enabled := range detectors { | ||
| if name != "" && enabled { |
There was a problem hiding this comment.
We can probably invert some of these if statements
| Name: "scanning_insecure_alpine_image_with_detector_preset", | ||
| Args: []string{ | ||
| "", "image", "--format=json", | ||
| "--experimental-detectors", "weakcreds", |
There was a problem hiding this comment.
I'm surprised this is running at all, since in ValidatePluginRequirements in scalibr it should fail if we are running some of these extractors on containers.
There was a problem hiding this comment.
Oh, ScanContainer is not checking for capabilities... that's not intended I believe.
There was a problem hiding this comment.
*and we are also not passing in any capabilities
ef6c913 to
f2713b1
Compare
f2713b1 to
51f787c
Compare
51f787c to
4479370
Compare
1cc9446 to
7d5a5e7
Compare
ed70c09 to
78ffc51
Compare
78ffc51 to
40f4490
Compare
This adds experimental support for having the scanner run detectors which are plugins aimed at identifying vulnerabilities through more interactive means than extractors such as by reading config files or making HTTP requests with crafted payloads.
Currently this does not have a lot of tests as only a handful of detectors exist and most are based on very specific situations which cannot be changed without shipping support for custom configuration (which is its own whole thing), but I have managed to at least get one with a positive finding using the
weakcredentials/etcshadowdetector scanning a custom image.Also this does not remove the requirement of at least one extractor being enabled and a package found since that too would be a much larger change and with the current pool of detectors available being so limited I don't think it's appropriate to drop that requirement just yet.
Resolves #1969