-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: add modular scanners #261
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #261 +/- ##
==========================================
+ Coverage 32.50% 33.02% +0.51%
==========================================
Files 17 17
Lines 1572 1626 +54
==========================================
+ Hits 511 537 +26
- Misses 1032 1060 +28
Partials 29 29
☔ View full report in Codecov by Sentry. |
fa8e774
to
e36543e
Compare
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
e36543e
to
b9a770d
Compare
The owner in https://github.com/anubhav06/copa-grype will need to be changed from |
@anubhav06 This is the motivation of the modular scanners so we don't have to (unless we want to officially support an integration). However, we should add a doc to document existing integrations (example: https://open-policy-agent.github.io/gatekeeper/website/docs/externaldata#providers-maintained-by-the-community) Looks like there are a few conflicts now, can you please resolve them? |
pkg/report/report.go
Outdated
@@ -21,7 +23,36 @@ type ScanReportParser interface { | |||
Parse(string) (*types.UpdateManifest, error) | |||
} | |||
|
|||
func TryParseScanReport(file string) (*types.UpdateManifest, error) { | |||
func TryParseScanReport(file, scanner string) (*types.UpdateManifest, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a test provider (you can use/reference existing trivy code) and make sure to add e2e tests for testing this integration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm, I should add a provider file similar to https://github.com/open-policy-agent/gatekeeper/blob/master/test/externaldata/dummy-provider/provider.go right? sorry if this is a silly question as I'm new to test providers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries! we don't need the same or similar code (just the concept). if we can turn trivy into a test provider without duplicating code, i think that would be ideal so we can make sure to test the provider call flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please check my new commits regarding tests, is it what is expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! this is great for now. we can do a follow up to integrate https://github.com/project-copacetic/scanner-parser-template/ to test success cases into e2e
as a follow up, we'll need:
- go install https://github.com/project-copacetic/scanner-parser-template in github actions e2e
- run with a fake report
- make sure copa can call and receive results from the plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sozercan in order to go install, we will need a release of the scanner-plugin-template, right?
We can also install using something like:
curl -sfL https://github.com/project-copacetic/scanner-plugin-template/releases/download/v${SCANNER_PLUGIN_TEMPLATE_VERSION}/scanner-plugin-template_${SCANNER_PLUGIN_TEMPLATE_VERSION}_Linux-64bit.tar.gz -o scanner-plugin-template.tar.gz
sudo tar -zxvf scanner-plugin-template.tar.gz -C /usr/local/bin/
rm scanner-plugin-template.tar.gz
similar to how other tools are installed in the copa CI, however even that would require a release of the fake-plugin.
@anubhav06 looks like this is not working for me
I ran grype (v0.69.1) with
seems like descriptor.name is empty?
|
Oh ok understood. That's interesting. I'll add the docs as well, once this PR is complete and merged. |
This is because in the new version of grype (v0.69.1) which you are using, it seems they have removed "grype" from It's strange as to why did they remove this in the new version, I'll look into this and will get back with a solution 👍 Update: |
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
…into modular-scanners Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
For testing:
Update: The grype bug is fixed and there should be a new release of grype soon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comment
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
…into modular-scanners
Signed-off-by: Anubhav Gupta <mail.anubhav06@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
@anubhav06 sorry for delay, we had a few CI blockers! i pushed a minor update to your PR so we can get this merged asap, hope that's okay |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending tests
@anubhav06 merged, thank you! |
Added support for modular scanners.
Closes #59
Overview
copa-grype plugin: https://github.com/anubhav06/copa-grype
How does it Work?
How to Test?
copa-grype
After adding the
copa-grype
binary to PATH: