fix(sbom): stop syft scans for stapel images without packages - #288
Merged
Conversation
A stapel image whose config declares no packages directive was scanned by syft in full, even though all of its content comes from the base image, imports and werf-managed instructions. Skip the syft scan for such images and derive their SBOM from the base image and import SBOMs instead; images with file-based packages keep the targeted cataloger scan, and os-pm-only images keep the runtime index collection. Dockerfile images are still scanned in full. Bump the SBOM artifact format version so previously attached full-scan SBOMs are regenerated. Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Signed-off-by: Radmir Khurum <radmir.khurum@flant.com>
Collaborator
Author
Verification
Review focus
|
nervgh
approved these changes
Sep 4, 2026
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
A stapel image whose config declares no
packagesdirective (e.g. onlyimage:+from:) was scanned by syft in full, even though all of its content comes from the base image, imports and werf-managed instructions. Such images are no longer scanned: their SBOM is derived from the base image's attested SBOM merged with import SBOMs.Repro (with
build.sbom.enable: trueand--repo):Previously this ran a full syft scan of the image; now no syft container is pulled or run for it.
What
packagesdirectives is not scanned by syft; its SBOM is the merge of the base image SBOM, import SBOMs and (when declared) the os-pm runtime index.shell/gitinstructions but nopackagesis also not scanned: content added by such instructions is out of SBOM scope by design.ErrSbomNotRequiredsemantics), instead of a full scan.packagesimages keep the targeted cataloger scan with source-path filtering; os-pm-only images keep the runtime index collection without a scan; Dockerfile images keep the full syft scan; scratch-based images keep the no-scan path (the scratch-specific condition is subsumed by the new rule); the base image "must have an SBOM artifact attached" requirement is pre-existing and unchanged.Why
The syft scan decision only special-cased os-pm-only and scratch-based stapel images; a plain
from:-only image fell through to a full unrestricted scan. That scan duplicated the base image contents at scan quality rather than attested quality and cost a syft container run per image per build. The scan is only meaningful for content werf manages via thepackagesdirective, so the skip condition is now "stapel image without catalogers" instead of enumerating special cases.Spec:
specs/021-sbom-skip-syft-without-packages/spec.md.