-
Notifications
You must be signed in to change notification settings - Fork 594
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
Add support for using VEX statements to filter/enrich match results #1365
Comments
This sounds awesome, and I agree with the phased approach:
I have a lot of ideas for 3 and 4, but we can cross those bridges as we get there. From the Wolfi side, we're happy to act as guinea pigs and help design the download/discovery/caching/magic parts to make sure it works well with Grype and users get the magical experience without having to sacrifice security or control. |
I love all of this. 😍 A couple of small thoughts:
This is easily the Grype feature I'm most excited about. |
This is great, I've been diving into the grype code over the past week and I think that I have a good grasp on what @wagoodman and @luhring are mentioning here. I'll write an initial patch to propose # 1 above (take a single document...) |
OK, I opened #1397 which implements item 1 🚀 |
is this only for container images, as with
which seems to come from https://github.com/anchore/grype/blob/main/grype/vex/openvex/implementation.go#L70 |
This is awesome, I am excited that VEX is being integrated directly into scanning tools. This greatly helps fight back against the systematic false-positives that will only get worse as more automated tooling tries its best to automate something which isn't automatable. I want to create and publish SBOMs for CPython, but want to do so in a way that allows our team to mark vulnerabilities in bundled dependencies (like OpenSSL, which we only use a small subset of features) as not affecting CPython so as not to cause alarm and increase demands on volunteers to make unnecessary security releases. This is the architecture I am imagining for CPython's SBOM and VEX, all SBOM documents would be referencing a VEX document (potentially stored publicly on GitHub) so we're able to make statements about vulnerabilities in dependencies post-release without requiring everyone update their SBOMs. CycloneDX currently has support for specifying VEX documents (via Obviously right now we could (and will try to) tell everyone to use our VEX statements with our SBOMs, but I suspect that there will be a percentage of folks which don't do that and then we end up having to engage with them piecemeal regardless. Would be great if there was a way for it all to happen auto-magically. Is this use-case covered in phase 3, and if not, can it be? |
@sethmlarson I would love to talk more about it, we are working exactly on this on OpenVEX. One way to magically discover the documents is via the SBOM reference as you mentioned it, but I would love to talk about the other methods we are implementing and exploring support for other well known data storage locations. Do you want to transfer this as an issue in openvex/spec? We can continue the conversation there! |
@sej7278 Yes, for now the only artifact type that can incorporate vex data are container images. But we are working to support more, can you explain your use case a little bit more? |
@puerco I'm basically interested in RPMs. So an SBOM generated from RPMs and SRPMs using syft, then vulnerability scanned using grype and linking to vex data to clarify if the package is actually vulnerable or not. A general improvement on scans based on arbitrary version strings from binaries is the endgame. |
I'm confused as to the status of this feature. I'm trying to use it for container images, and there is already a |
Never mind, it seems that the issue I'm having is due to a matching issue. I'll work on a fix and submit a PR soon. |
We scan artifacts before packing/shipping them off to air gapped environments. For example, a set of resolved |
Since for some time now SPDX has this externalRef specced out as well @sethmlarson: https://github.com/spdx/spdx-3-model/blob/3.0.1/model/Core/Vocabularies/ExternalRefType.md?plain=1#L64 I am coming from a very similar place where we would like to be able to "mute" false-positive vulnerabilities found of deps in published SBOMs. Would also be willing to contribute this to grype, but It would probably make sense to get #1619 merged first. |
Given a set of VEX statements, which represents status assessments relative to a vulnerability matched with a product, it would be ideal to filter grype results down to useful or novel results (removing results that have
not_affected
status values in a VEX statement). The primary motivator behind this is to attempt to reduce the result size when possible to help the user focus on the results that have a practical impact (and not spend time attempting to remediate non-issues).One question might be: where should these VEX documents come from? There is a bit of a spectrum here, and I think that motivates a possible implementation path:
Enable grype to be able to...
alpine:latest
). There are a lot of added challenges here but ultimately this would be the most "magical", requiring the least amount of user input to leverage vex documents. This added automagic-ness should not sacrifice security concerns to achieve this and ideally would require no additional configuration (not a requirement though). There are a lot of directions this could go in, so I'll leave this speculation for later.The nice thing about this path is that we defer decisions about where these documents come from while working on the logistics of lining up the existing OpenVEX spec.
For
1
something like this could be the input:The same input could work for
2
and3
, where the argument might be a directory and we look for vex documents, or the argument could be a remote resource such as[email protected]:myorg/myvexrepo.git
... I'm softly suggesting this initially to help set an initial direction, but consider none of this set in stone.Side note: I think we should focus initial conversations and efforts just on
1
for now, but I wanted to at least get a vision going for later.One question I have about this feature is could there be multiple modes in how you would use a vex document? The initial suggestion at the top of this issue is primarily as a filter, and I was thinking about suggesting
--filter
or something similar as a step one. However, vex documents could also be used as a source of vulnerabilities based off of thestatus
field with a value ofaffected
. This means thatfilter
is potentially the wrong verb to use based off of potential future usage... so I fell back to specifying "what" is being input ("vex") instead of an operation on the CLI. (dev note: this is where we add new flags)I'm assuming that either mode (filtering and adding) would be useful depending on the use case and not mutually exclusive. I tend to add config items instead of CLI flags/args when there are "knobs" like these for different use cases and a sensible default behavior. That being said adding
vex.filter_not_affected
andvex.add_affected
configurables (GRYPE_VEX_FILTER_NOT_AFFECTED
andGRYPE_VEX_ADD_AFFECTED
env vars) would be nice, with a default totrue
for both (dev note: here's were we bind new config elements into the application config).When it comes to the JSON output grype rarely drops match results when there are filters applied, instead they are partitioned into a separate output in the JSON format:
matches
andignoredMatches
. When we filter out results based on vex statements I think we should elect to put these matches into theignoredMatches
section, allowing the user to audit the total set of results found.With each record we tend to capture "how" the match was made in the
.matchDetails
of the match object . So for example, a match made against the alpine:3.2 image might have a match that looks like this:Where the
matchDetails
show what wesearchedBy
(given the package details) and what elements contributed towards finding a match in thefound
section. I think thematchDetails
field should be amended to account for when we add matches based purely on vex statements, so we can show our work in how the match was made like we do with all of our other matchers.Similarly, when we ignore a match based on a vex statement we should also take note of the reason why it was ignored. Today we do this in the
IgnoredMatch
object, which is a superset of theMatch
object but additionally captures the ignore rules that apply to this match . Looking at how we express ignore rules, a question that comes to mind is "should we fix vex concepts into these ignore rules? or should we add something else? (or change how this works fundamentally?)"Ok, I have more thoughts and questions around how might the UI get updated, should we refactor the workflow to account for filtering logic earlier in processing, and related topics... but this has gotten verbose, let me stop here for now and open up the floor.
CC: @luhring @jspeed-meyers @puerco
The text was updated successfully, but these errors were encountered: