-
Notifications
You must be signed in to change notification settings - Fork 794
Apk upstream matcher #3256
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
Draft
vaikas
wants to merge
2
commits into
anchore:main
Choose a base branch
from
vaikas:apk-upstream-matcher
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Apk upstream matcher #3256
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'd love to make this more data driven. It seems like the actual logic we want is closer to, "If
pis from a distro where there is fix info for binary APKs (if that's the right term) and not just origin/upstream APKs (if that's the right term), then we don't need to search upstream."There's some subtlety here too:
Is there an approach we could do where we have a precedence where evidence of fix takes precedence over evidence of vulnerability which takes precedence over a search miss, and if there's data about both p and p's upstream/origin, the specific data (p) takes precedence. For example:
That way Grype does the best matching job it can given the data it has, rather than hard-coding heuristics for different distros (which is something we've done a lot of and would love to stop doing). What do you think @vaikas ?
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.
This does not directly answer your question, but hopefully gives a bit more context on what problem the change is meant to address.
So the current use of 'origin' (and I think in this context == 'upstream') is imho a bit wonky in this context. In the current context, it says that pkg-a and pkg-a-sub were built from the same source code. But for the vuln identification purposes I fail to see why they should be treated identically (today, IIUC), in that if I see a pkg-a-sub I automatically 'inherit' all the vulns for pkg-a.
Some examples where this is especially wonky, when there are things like:
pkg
pkg-dev [headers for example]
pkg-doc [docs for example]
pkg-compat [shell scripts for example]
In today's world, if we see pkg-doc it's treated as pkg-a which doesn't make any sense. For Chainguard, we track occurances of vulnerabilities at the artifact level (APK) vs. origin because it's lossy.
And sub-packages can have vulns that do not appear in the origin package, so need to surface that as well.
I'm happy to hop on a call since that might be a higher BW conversation 🤣
So, that was the driving motivation for this change.
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.
That makes a lot of sense. I agree that saying pkg-docs is vulnerable because pkg is vulnerable is silly. The reason this practice exists in Grype is that historically, distros and CVEs are published against the source/upstream/origin package, and we're using the granularity we have.
The thing I don't love about the config option approach is that it makes it the user's responsibility to figure out whether they're scanning an image whose distro's publisher publishes granular vulnerability and fix data, but that's a question about the state of grype's database more than its a question about the user's preferences. I'm not opposed to having a config (we often put in configs with behavior changes so that people can pin back to older grype behavior), but I would love for the default behavior to be smarter.
Maybe this is something that should (eventually?) be on Grype's metadata about vulnerability providers? Like the matcher asks the database, "Hey, Is Wolfi one of the ones where binary APKs have fix data, or one of the ones where everything is stuck to the source/upstream/origin package?" and behaves differently based on the answer?
I'd be happy to jump on a call. We have a Vuln Data Office Hours appointment link if you find a convenient time on there.