Skip to content

Commit 2eeb5d9

Browse files
committed
feat(ISV-5859): Add index image SBOM generator
A Mobster can now generate SBOMs for index images that represents its multiarch structure. The script generates SBOMs in SPDX format using provided index manifest generated using Buildah/Skopeo. The generator uses spdx_tools library to assemble the document and before storing it to file it validates its schema. JIRA: ISV-5859 Signed-off-by: Ales Raszka <araszka@redhat.com>
1 parent aa27722 commit 2eeb5d9

File tree

10 files changed

+985
-7
lines changed

10 files changed

+985
-7
lines changed

.yamllint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ ignore:
2121
- ansible/vaults/
2222
- .venv
2323
- node_modules/
24+
- .tekton/ # Directory managed by Konflux

docs/img/index-image.spdx.svg

Lines changed: 143 additions & 0 deletions
Loading

docs/sboms/oci_image_sbom.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SBOM for Image Index
2+
3+
The Mobster tool is capable of generating SBOMs for OCI image indexes based
4+
on the guidelines from the
5+
[Red Hat Product Security](https://github.com/RedHatProductSecurity/security-data-guidelines).
6+
7+
## Usage
8+
9+
```bash
10+
# First get index manifest using buildah
11+
buildah manifest inspect registry.redhat.io/ubi10-beta/ubi@sha256:f817eb70b083c93b4d6b47e1daae292d662e3427f5e73c5e8f513695e5afc7cc > ./index-image-manifest.json
12+
13+
# Then generate SBOM using Mobster
14+
mobster generate \
15+
--output index.sbom.spdx.json \
16+
oci-index \
17+
--index-image-pullspec "registry.redhat.io/ubi10-beta/ubi:latest" \
18+
--index-image-digest "sha256:f817eb70b083c93b4d6b47e1daae292d662e3427f5e73c5e8f513695e5afc7cc" \
19+
--index-manifest-path ./index-image-manifest.json
20+
```
21+
22+
23+
**List of arguments:**
24+
25+
- `--index-image-pullspec`
26+
- Must be in the format `repository/image:tag`
27+
- Example value `registry.redhat.io/ubi10-beta/ubi:latest`
28+
- `--index-image-digest`
29+
- Must be in the format `algorithm:hexvalue`
30+
- Example value `sha256:f817eb70b083c93b4d6b47e1daae292d662e3427f5e73c5e8f513695e5afc7cc`
31+
- `--index-manifest-path`
32+
- Path to a file containing a json output of `buildah manifest inspect` command
33+
- File contents MUST be a valid JSON
34+
- See example in [index_manifest.json](../../tests/data/index_manifest.json)
35+
- `--output`
36+
- Path where the SBOM should be written
37+
38+
39+
## Example
40+
41+
To closely replicate the [example image index](https://github.com/RedHatProductSecurity/security-data-guidelines/blob/main/sbom/examples/container_image/build/ubi9-micro-container-9.4-6.1716471860.spdx.json),
42+
you can use the following command:
43+
44+
45+
# Structure of the generated SBOM
46+
47+
The generated SBOM has following structure:
48+
```
49+
- SPDXRef-DOCUMENT
50+
- SPDXRef-image-index
51+
- Image-amd64 (VARIANT_OF)
52+
- Image-arm64 (VARIANT_OF)
53+
- Image-ppc64le (VARIANT_OF)
54+
- Image-s390x (VARIANT_OF)
55+
```
56+
57+
![index-sbom](../img/index-image.spdx.svg)

0 commit comments

Comments
 (0)