Repository navigation
fix(sbom): stop marking os-pm packages under /lib64 as not shipped - #475
Merged
Merged
Conversation
pm records each installed file under the path its package archive spells, while the base image lays /lib64, /usr/lib64 and /usr/local/lib64 down as symlinks to /usr/lib, so a library the archive puts in /usr/lib64 is held by the image in /usr/lib. The shipped-scope reader looked the recorded path up literally in the layer index, found nothing for such a package, and marked it werf:shipped=false in the very image that installed it; an image importing those libraries inherited the same verdict for openssl, brotli, c-ares, libc and libunistring. Resolve the directories above each recorded path through the symlinks the index holds before consulting it, following chains and a ".." inside a target the way the kernel would, so the fileset names the file where the image has it. Bump the SBOM artifact format version so that SBOMs generated with the old reader are not reused from the registry. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Build on builder/distroless v3.1.16, the first base whose pm (0.1.12) writes /var/lib/pm/files.json, install curl and jq, and check the chain end to end: every installed package, dependencies included, is recorded with version, sha256 per file and symlinks; the digests agree with the image, also for files recorded under /usr/lib64 and held in /usr/lib; the donor's components carry the files as evidence at the resolved paths and none is marked; an image importing only curl and its libraries keeps every inherited component, marks jq and the packages no file of which came along, leaves curl's dependencies unmarked, and a rebuild from cache reuses the SBOM unchanged. A second fixture on the v3.0.2 base, whose pm writes no file list, checks that werf warns and judges no os-pm package. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Collaborator
Author
Verification
Review focus
Follow-up
|
reyreavman
marked this pull request as ready for review
October 26, 2026 10:03
reyreavman
pushed a commit
that referenced
this pull request
Oct 26, 2026
🤖 I have created a release *beep* *boop* --- ## [3.12.0-dk.3](v3.12.0-dk.2...v3.12.0-dk.3) (2026-10-26) ### Features * **build, stapel:** sign files matched by a glob pattern ([#471](#471)) ([ffda24e](ffda24e)) * **sbom:** inventory installed Python, JavaScript and Lua packages ([#472](#472)) ([7fde219](7fde219)) ### Bug Fixes * **build, stapel, import:** stop imports failing with sbom enabled ([#470](#470)) ([478b751](478b751)) * **sbom:** avoid marking editable Python packages as absent ([#474](#474)) ([e0b4b66](e0b4b66)) * **sbom:** retain legacy Python bytecode after source removal ([#476](#476)) ([36debcb](36debcb)) * **sbom:** stop marking os-pm packages under /lib64 as not shipped ([#475](#475)) ([cd0a029](cd0a029)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
An os-pm package whose files pm recorded under
/lib64,/usr/lib64or/usr/local/lib64is no longer markedwerf:shipped=falsein the image that installed it, nor in an image that imports its libraries. On base-images v3.1.16 (builder/distroless, pm 0.1.12 — the first pm writing/var/lib/pm/files.json) apackages: os-pminstall ofcurlmarked libc, gnu-gcc-lib, libstdc++ and libunistring as not shipped in the donor itself, and ascratchimage importingcurlwith its libraries additionally marked openssl, brotli and c-ares although their.sofiles were imported.What
/usr/lib64/xwhile the image symlinks/usr/lib64to/usr/libis evidence at/usr/lib/x, with the digest the image holds there; no occurrence names a path the image does not hold...inside a symlink target resolve as the kernel walks them; a chain that never settles leaves the package without files, as before./usr/lib/libcurl.so.4stayssymlinkevidence.curl==8.12.1 jq==1.8.1, the donor's 19 os-pm components all carry evidence and none is marked; the importing image leaves curl, libc, openssl, brotli, c-ares, nghttp2, libidn2, libpsl, zstd and libunistring unmarked and marks jq, gnu-gcc-lib, libstdc++, baselayout, busybox, tzdata, rsync, findutils and gnu-glibc-locale; a rebuild reuses the SBOM unchanged.index.jsonbut nofiles.json, werf still warns and marks no os-pm package in either image.SBOM os-pm shipped scope(labelse2e, sbom, ospm, shipped-scope, simple) with fixturesinject/ospm_partial_importandinject/ospm_partial_import_no_filelist.Why
pm 0.1.12 records every file under the path its package archive spells (
recordPath(header.Name)in its untar), and the archives of libc, openssl, brotli, c-ares, gnu-gcc-lib, libstdc++ and libunistring spelllib64/usr/lib64, which baselayout lays down as symlinks to/usr/lib. The layer index werf builds knows the file only at the resolved path,collectlooked the recorded path up literally, and a package with every file under such a directory ended with an empty occurrence list — which the rule reads as "looked for, found nothing" and marks. Left alone, every os-pm library of these base images is a false "not shipped" in the SBOM of every consumer, the signal the shipped-scope work exists to produce.Resolving on the pm side (record the on-disk path) would also work, but every image already built with pm 0.1.12 carries the archive paths, and the index already holds the symlinks needed to follow them.