-
Notifications
You must be signed in to change notification settings - Fork 117
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: store --namespace as APK maintainer field #1751
base: main
Are you sure you want to change the base?
Conversation
@lyoung-confluent note packages sboms should have Originator already in /var/lib/db/sbom/ for each package. Can you please check that it is there, and it is different for self built package; versus the ones that came from Wolfi / Chainguard? Independent of the package sbom stuff, we typically do say that one can detect stuff out of the installed database; thus yeah we should probably do this bit. Separately, to get this change out quicker, we could also patch apko to check the namespace of the packages and automatically emit it for each package as it is generating the installed db (note that installed db is synthesised by apko at image build time, rather than being crated with apk add during base image builds). Please check if there is support for that in apko and/or consider contributing that. |
Blah, I was going to suggest this. Another option might be to use a URL that points to a site hosted under wolfi.dev or chainguard.dev (with some kind of landing page, if we're feeling fancy). In alpine these point to the upstream project. I'm not sure if that is worse or better than overloading maintainer. |
there have been requests to populate uri: in melange files, and have those propagate for upstream identification. |
|
https://wiki.alpinelinux.org/wiki/Apk_spec#Installed_Database_V2
https://wiki.alpinelinux.org/wiki/Apk_spec#APKINDEX_Format
However, there is this thing too in https://wiki.alpinelinux.org/wiki/Apk_spec#Installed_Database_V2:
what does repository tag mean? can that be "glibc@wolfi" ? |
ooooh, i wonder if apko should do this: https://wiki.alpinelinux.org/wiki/Repositories#Repository_pinning specify our repositories as tagged; generate world file as tagged; and then things pin to our repository and version. |
Yeah I've talked to matt a little bit about how this would solve a bunch of problems for us, but we'd need to fix a bunch of things downstream of apko that assume locked config looks like |
can it be both pinned to version and tagged |
Recently, we ran into an issue where
trivy
was incorrectly reporting vulnerabilities in a package/image we built viamelange
/apko
. Upon further investigation, this issue was occurring because we were building a package with the same name and similar versioning as an existing Wolfi/Chainguard package. As a result,trivy
was incorrectly matching the package name from Wolfi's security.json against this internal package and subsequently reporting vulnerabilities.We looked into "fixing" trivy's APK package logic to only extract APK packages that were installed from the Wolfi repository, however we discovered that
/lib/apk/db/installed
doesn't actually contain enough information to make this determination.This PR attempts to improve this situation in the future by passing along the
--namespace
build parameter (which is already embedded in the generated SBOM for each package) as themaintainer
field for each APK package as well. This information will eventually get included via them:
field in/lib/apk/db/installed
when the APK package is installed viaapk-tools
orapko
.A future change to
trivy
or other vulnerability scanners could be made to only extract the packages that either don't have amaintainer
field (for backwards compatibility), or have a value ofwolfi
(orchainguard
) only.Arguably the
packager
field would be a more appropriate location for this value however that field does not end up in/lib/apk/db/installed
, only a subset of fields are stored there: https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/src/package.c?ref_type=heads#L880