Skip to content

Commit cc2c51c

Browse files
committed
Move SBOM data recommendations, address review comments
1 parent f57cdbe commit cc2c51c

File tree

1 file changed

+56
-29
lines changed

1 file changed

+56
-29
lines changed

peps/pep-0770.rst

Lines changed: 56 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,26 @@ package archive or information about the top-level software in the package that
101101
can't be encoded into Core Metadata but is relevant for the SBOM use-case
102102
("software identifiers", "purpose", "support level", etc).
103103

104-
Zero-or-more SBOM documents per package
105-
---------------------------------------
104+
Zero-or-more opaque SBOM documents
105+
----------------------------------
106106

107107
Rather than requiring at most one included SBOM document per Python package,
108108
this PEP proposes that one or more SBOM documents may be included in a Python
109109
package. This means that code attempting to annotate a Python package with SBOM
110110
data may do so without being concerned about corrupting data already contained
111111
within other SBOM documents.
112112

113-
This decision also means this PEP is capable of supporting multiple SBOM
114-
standards without favoring one, instead deferring support to SBOM consuming
115-
tools. This decision also means that the merging of SBOM documents never needs
116-
to be handled by Python tools, instead deferring this to SBOM consuming tools
117-
who are better placed to handle cross-standard conversions.
113+
Additionally, this PEP treats SBOM document data opaquely instead relying on
114+
final end-users of the SBOM data to process the contained SBOM data.
115+
This choice acknowledges that SBOM standards are an active area of development
116+
where there is not yet (and may never be) a single definitive SBOM standard
117+
and that SBOM standards can continue to evolve independent of Python packaging
118+
standards. Already tools that consume SBOM documents support a multitude of
119+
SBOM standards to handle this reality.
120+
121+
These decisions mean this PEP is capable of supporting any SBOM standard
122+
and does not favor one over the other, instead deferring the decision to
123+
producing projects and tools and consuming user tooling.
118124

119125
.. _770-spec:
120126

@@ -159,36 +165,20 @@ If an ``Sbom-File`` is listed in a
159165
:term:`Built Distribution`'s Core Metadata:
160166

161167
* That file MUST be included in the :term:`distribution archive` at the
162-
specified path relative to the root license directory.
163-
* That file MUST be installed with the :term:`project` at that same relative
164-
path.
168+
specified path relative to the root SBOM directory.
169+
* Installers MUST install the file with the :term:`project` at that same
170+
relative path.
165171
* Inside the root SBOM directory, packaging tools MUST reproduce the directory
166172
structure under which the source files are located relative to the project
167173
root. The root SBOM directory is
168174
`specified in a later section <#770-spec-project-formats>`__.
169175
* Path delimiters MUST be the forward slash character (``/``), and parent
170176
directory indicators (``..``) MUST NOT be used.
171-
* SBOM document contents MUST be UTF-8 encoded JSON according to :rfc:`8259`.
172-
* SBOM document contents MUST use an SBOM standard, and for better
173-
interoperability SHOULD be a well-known SBOM standard such as
174-
`CycloneDX <cyclonedxspec_>`_ or `SPDX <spdxspec_>`_.
175-
* The "primary" component being described in included SBOM documents MUST be the
176-
Python package. This is achieved in CycloneDX using the ``metadata.component``
177-
field and in SPDX using the ``DESCRIBES`` relationship.
178-
* SBOM documents MUST include metadata for the timestamp when the SBOM document
179-
was created. This information helps consuming tools understand the order that
180-
multiple SBOM documents were created to untangle conflicts between various
181-
stages building the Python package.
182-
* SBOM documents SHOULD include metadata describing the tool creating the SBOM
183-
document. This information helps users find which tool needs to be fixed in
184-
the case of defects.
185177

186178
For all newly-uploaded distribution archives that include one or more
187179
``Sbom-File`` fields in their Core Metadata and declare a ``Metadata-Version``
188-
of ``2.5`` or higher, PyPI SHOULD validate that all specified files are present
189-
in the distribution archives, are valid UTF-8 encoded JSON, and for well-known
190-
SBOM standards provide the minimum required fields by those standards and this
191-
PEP.
180+
of ``2.5`` or higher, PyPI and other indices SHOULD validate that all files
181+
specified with ``Sbom-File`` are present in the distribution archives.
192182

193183
.. _770-spec-project-source-metadata:
194184

@@ -252,7 +242,7 @@ Examples of valid SBOM files declarations:
252242
sbom-files = ["bom.json"]
253243
254244
[project]
255-
sbom-files = ["sboms/openssl.cdx.json", "licenses/openssl.spdx.json"]
245+
sbom-files = ["sboms/openssl.cdx.json", "sboms/openssl.spdx.json"]
256246
257247
[project]
258248
sbom-files = ["sboms/*"]
@@ -316,6 +306,36 @@ A few additions will be made to the existing specifications.
316306
relative to the ``sboms`` directory, and that any files in this directory MUST
317307
be copied from wheels by install tools.
318308

309+
SBOM data interoperability
310+
--------------------------
311+
312+
This PEP treats data contained within SBOM documents as opaque, recognizing
313+
that SBOM standards are an active area of development. However, there are some
314+
considerations for SBOM data producers that when followed will improve the
315+
interoperability and usability of SBOM data made available in Python packages:
316+
317+
* SBOM documents SHOULD use a widely-accepted SBOM standard, such as
318+
`CycloneDX <cyclonedxspec_>`_ or `SPDX <spdxspec_>`_.
319+
* SBOM documents SHOULD use UTF-8-encoded JSON (:rfc:`8259`) when available
320+
for the SBOM standard in use.
321+
* SBOM documents SHOULD include all required fields for the SBOM standard in
322+
use.
323+
* SBOM documents SHOULD include a "time of creation" and "creating tool" field
324+
for the SBOM standard in use. This information is important for users
325+
attempting to reconstruct different stages for a Python package being built.
326+
* The primary component described by the SBOM document SHOULD be the top-level
327+
software within the Python package (for example,
328+
"pkg:pypi/pillow" for the "Pillow" package).
329+
* All non-primary components SHOULD have one or more paths in the relationship
330+
graph showing the relationship between components. If this information isn't
331+
included, SCA tools might exclude components outside of the relationship graph.
332+
* All software components SHOULD have a name, version, and one or more software
333+
identifiers (PURL, CPE, download URL).
334+
335+
PyPI and other indices MAY validate the contents of SBOM documents specified by
336+
this PEP, but MUST NOT validate or reject data for unknown
337+
SBOM standards, versions, or fields.
338+
319339
Backwards Compatibility
320340
=======================
321341

@@ -400,6 +420,13 @@ Conditional project source SBOM files
400420

401421
How can a project specify an SBOM file that is conditional? Under what circumstances would an SBOM document be conditional?
402422

423+
Selecting a single SBOM standard
424+
--------------------------------
425+
426+
Should this PEP select a single SBOM standard instead of supporting any
427+
SBOM standard? Selecting a single standard would potentially limit the
428+
evolution of SBOM standards which is an active area of development.
429+
403430
References
404431
==========
405432

0 commit comments

Comments
 (0)