Fix for missing SBOM in the final image installed using ISO image#579
Open
srmungar wants to merge 5 commits into
Open
Fix for missing SBOM in the final image installed using ISO image#579srmungar wants to merge 5 commits into
srmungar wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates SBOM generation during image composition so that ISO/live-install flows also end up with an SPDX SBOM embedded in the final filesystem, even when FullPkgListBom isn’t present.
Changes:
- Switch package DB queries to include package name/version/arch for both RPM and DEB targets.
- Add a fallback path that constructs a minimal SBOM package list directly from the installed package database when
FullPkgListBomis empty. - Write the SBOM to a timestamped filename and also publish/copy it to the canonical
spdx_manifest.json; SBOM generation/copy failures are now treated as fatal.
Comment on lines
2029
to
2034
| pkgType := imageOs.chrootEnv.GetTargetOsPkgType() | ||
| sBomFNm := rpmutils.GenerateSPDXFileName(template.GetImageName()) | ||
| cmd := "rpm -qa" | ||
| cmd := "rpm -qa --qf '%{NAME}\t%{VERSION}-%{RELEASE}\t%{ARCH}\n'" | ||
| if pkgType == "deb" { | ||
| cmd = "dpkg -l | awk '/^ii/ {print $2}'" | ||
| cmd = "dpkg-query -W -f='${Package}\t${Version}\t${Architecture}\\n'" | ||
| sBomFNm = debutils.GenerateSPDXFileName(template.GetImageName()) |
Comment on lines
+2102
to
+2104
| URL: manifest.DefaultLicense, | ||
| License: manifest.DefaultLicense, | ||
| Origin: manifest.DefaultLicense, |
Contributor
Template needs to be filled. |
arodage
reviewed
May 27, 2026
|
|
||
| // In live ISO install flows template-dump.yaml does not include FullPkgListBom, | ||
| // so build a minimal SBOM package list directly from the installed package DB. | ||
| if len(finalPkgs) == 0 { |
Contributor
There was a problem hiding this comment.
Need to add unit test for this.
You may add the following to TestGenerateSBOM():
{
name: "ISO install fallback - empty FullPkgListBom",
pkgType: "deb",
mockCommands: []shell.MockCommand{
{
Pattern: `dpkg -l \| awk '/\^ii/ \{print \$2\}'`,
Output: "curl\nwget\nvim",
Error: nil,
},
},
downloadedPkgs: nil, // simulates ISO install where FullPkgListBom is empty
expectError: false,
expectedPkgCount: 3, // all 3 installed packages should appear via fallback
},
generateSBOM() was only called from InstallImageOs (RAW/disk builds). ISO builds go through InstallInitrd, so spdx_manifest.json was never written to tmp/ — causing CopySBOMToImageBuildDir and CopySBOMToChroot to warn 'SBOM file not found' and skip the copy. Add a generateSBOM() call at the end of InstallInitrd, after postImageOsInstall, so ISO and initrd image builds also produce the SBOM file before isomaker/initrdmaker try to copy it.
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.
…O image as well.
Merge Checklist
All boxes should be checked before merging the PR
Description
Any Newly Introduced Dependencies
How Has This Been Tested?