Skip to content

Commit 75e0e88

Browse files
authored
Merge pull request #68 from RedHatProductSecurity/add-midstream-definition
Add upstream/midstream/downstream definitions
2 parents 282773c + de0c8d9 commit 75e0e88

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

docs/sbom.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ composing multiple SBOMs into a larger set (to describe a product, for example).
149149

150150
_Complete_ SBOMs provide a full, in-depth representation of all levels of the build process in a single file. A
151151
Complete SBOM includes all component layers and their dependencies, offering a complete view of a product's composition.
152-
These types of SBOMs are mostly used for procurement and audit purposes.
152+
These types of SBOMs are mostly used for procurement and audit.
153153

154154
Red Hat aims to publish Complete SBOMs at
155155
[https://security.access.redhat.com/data/sbom/](https://security.access.redhat.com/data/sbom/) while Shallow SBOMs
@@ -466,7 +466,21 @@ To associate a set of remote sources with the repository referencing them, use:
466466

467467
#### RPM
468468

469-
An architecture-specific RPM built by Red Hat can be represented by a package object using the following data:
469+
Before defining what RPM package objects look like, let's also define the specific types of sources that can be involved
470+
in the RPM build process:
471+
472+
- An _upstream source_ is the original source code as released by the software's primary developers or maintainers.
473+
474+
- A _midstream source_ is a copy of the upstream code, which may be modified or simply mirrored for distribution
475+
purposes. Midstream sources are optional.
476+
477+
- A _downstream source_ is a set of sources used to create a source RPM. These are the real build inputs that get
478+
packaged into an SRPM, regardless of whether they originated directly from upstream or came through a midstream
479+
archive. Downstream sources may include distribution-specific patches, build configuration changes, spec files,
480+
and any other files needed to build the final RPM package.
481+
482+
An architecture-specific (downstream) RPM built by Red Hat can be represented by a package object using
483+
the following data:
470484

471485
=== "SPDX 2.3"
472486

@@ -525,7 +539,7 @@ purl identifiers
525539

526540
[`checksums`](https://spdx.github.io/spdx-spec/v2.3/package-information/#710-package-checksum-field)
527541
: Minimally, the list of checksums must include the SHA256 checksum of the RPM file or source archive itself.
528-
All other checksums should be specified as annotations (see below).
542+
All other checksums should be specified as annotations (see below).
529543

530544
[`annotations`](https://spdx.github.io/spdx-spec/v2.3/annotations/)
531545
: A list of annotations may provide additional information that is specific to the RPM format. In the example
@@ -534,7 +548,7 @@ purl identifiers
534548
- The SHA256 checksum of the RPM header (this value does not change when an RPM is signed; unlike the file SHA256 \
535549
checksum used in `checksums`).
536550

537-
Each set of architecture-specific RPMs also have an associated source RPM (SRPM) that bundles all the source code
551+
Each set of architecture-specific RPMs also has an associated source RPM (SRPM) that bundles all the source code
538552
that was used to build those RPMs. SRPMs should be represented as a separate package object in an SBOM, and their
539553
relationship to architecture-specific RPMs can be represented with:
540554

@@ -595,6 +609,35 @@ To associate a set of source archives with the SRPM that includes them, use:
595609
}
596610
```
597611

612+
Optionally, an upstream source may be mirrored in a different repository where the source is modified in a way that
613+
makes it consumable by the downstream distributor. This is referred to as a midstream source. The package object for
614+
the midstream source looks identical to an upstream package, but with different download location and purl identifier.
615+
616+
The relationship between an upstream source and a midstream source can be represented with:
617+
618+
=== "SPDX 2.3"
619+
620+
```json
621+
{
622+
"spdxElementId": "SPDXRef-Midstream0",
623+
"relationshipType": "GENERATED_FROM",
624+
"relatedSpdxElement": "SPDXRef-Source0"
625+
}
626+
```
627+
628+
The complete diagram of the relationships between the various types of sources in an SBOM might look like this:
629+
630+
``` mermaid
631+
graph TD
632+
A["https://openssl.org/source/openssl-3.0.7.tar.gz"]
633+
B["https://github.com/(RH openssl midstream repo)/archive/refs/tags/3.0.7.tar.gz"]
634+
C["SRPM: openssl 3.0.7-18.el9_2.src"]
635+
D["RPM: openssl 3.0.7-18.el9_2.aarch64"]
636+
C -->|CONTAINS| B
637+
B -->|GENERATED_FROM| A
638+
D -->|GENERATED_FROM| C
639+
```
640+
598641
#### Product
599642

600643
Individual components such as packages and container images are almost always provided as part of a specific product.

mkdocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ markdown_extensions:
6464
- abbr # https://squidfunk.github.io/mkdocs-material/reference/tooltips/#adding-abbreviations
6565
- md_in_html
6666
- def_list # https://squidfunk.github.io/mkdocs-material/reference/lists/#using-definition-lists
67-
- pymdownx.superfences
67+
- pymdownx.superfences:
68+
custom_fences:
69+
- name: mermaid
70+
class: mermaid
71+
format: !!python/name:pymdownx.superfences.fence_code_format
6872
- pymdownx.tabbed:
6973
alternate_style: true
7074
- toc:

0 commit comments

Comments
 (0)