-
Notifications
You must be signed in to change notification settings - Fork 100
feat: Analyzer for user defined packages. #137
base: main
Are you sure you want to change the base?
Conversation
The new analyser works on `manifest.trivy` files (name up for debate!) and adds packages from it. The manifest file is a json file with a single array, each object in the array can contain any data which the types.Package object have, only name and version is _required_ though. Signed-off-by: Johannes Tegnér <johannes@jitesoft.com>
|
@@ -0,0 +1,4 @@ | |||
[ |
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.
I would suggest to make this file csv or yaml format, so you can append more easily than with json, wdyt?
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.
Aye, that is a sane thought, not sure why I went with JSON to be honest, hehe.
Will update that in a bit (after kids are in bed ;) )
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.
Will have to look a bit deeper into this, it seems like there is no native yaml support, and doesn't feel right to add a new dependency for this tiny feature... I'll figure something out, and I still agree with you that JSON is not the perfect format :)
I think it's a great idea! e.g. In the case of static filenames, it is difficult to sort out the driver. So, I think need to give the unique name charp.trivy for C#, java.trivy for java, and so on. |
I think that the most useful thing for it is to look for vulnerabilities in built applications (it will of course require the user to specify the packages with the correct name for the OS distribution, eg: |
This is related to the feature request aquasecurity/trivy#293.
Regarding what information that the manifest files need to contain, shouldn't it be the same information as passed to the trivy server API (https://github.com/aquasecurity/trivy/blob/master/rpc/detector/service.proto)? |
Hi there!
When building docker images, I often build most of the software from source instead of downloading them from a package registry.
Looking at issues like aquasecurity/trivy#481 in the Trivy repository, make me think that I'm not alone.
This pull request contains a simple analyzer which adds packages to scan from a json file (currently named
/etc/manifest.trivy
open for better naming!). The json file uses thetypes.Package
intypes/image.go
as resource in the decoder, although it only requires the name and version to work.I added a test for it in the
analyzer_test.go
file, and could not find more tests which tests the analyzers, please let me know (if the PR is wanted) if I missed anything when it comes to the tests!