summaryrefslogtreecommitdiffstats
path: root/documentation/ref-manual/classes.rst
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2022-12-02 15:50:48 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-07 15:04:15 +0000
commitc8839099506ee9c694f5b9da3ef6cc7cf0b2c142 (patch)
tree2ec7cac1be39f8765f1ebca1e19c1cdbe21af205 /documentation/ref-manual/classes.rst
parentbe95d5f93abf2bce807f33fa0d9ae38e49fdbcce (diff)
downloadpoky-c8839099506ee9c694f5b9da3ef6cc7cf0b2c142.tar.gz
SPDX and CVE documentation updates
Backporting from master the ones that are applicable to kirkstone. (From yocto-docs rev: c10d65ef3bbdf4fe3abc03e3aef3d4ca8c2ad87f) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/ref-manual/classes.rst')
-rw-r--r--documentation/ref-manual/classes.rst96
1 files changed, 93 insertions, 3 deletions
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index a6dafe8f90..6e73c5d4fb 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -361,6 +361,32 @@ authors used.
361Both build methods inherit the ``cpan-base`` class for basic Perl 361Both build methods inherit the ``cpan-base`` class for basic Perl
362support. 362support.
363 363
364.. _ref-classes-create-spdx:
365
366``create-spdx.bbclass``
367=======================
368
369The :ref:`create-spdx <ref-classes-create-spdx>` class provides support for
370automatically creating :term:`SPDX` :term:`SBOM` documents based upon image
371and SDK contents.
372
373This class is meant to be inherited globally from a configuration file::
374
375 INHERIT += "create-spdx"
376
377The toplevel :term:`SPDX` output file is generated in JSON format as a
378``IMAGE-MACHINE.spdx.json`` file in ``tmp/deploy/images/MACHINE/`` inside the
379:term:`Build Directory`. There are other related files in the same directory,
380as well as in ``tmp/deploy/spdx``.
381
382The exact behaviour of this class, and the amount of output can be controlled
383by the :term:`SPDX_ARCHIVE_PACKAGED`, :term:`SPDX_ARCHIVE_SOURCES` and
384:term:`SPDX_INCLUDE_SOURCES` variables.
385
386See the description of these variables and the
387":ref:`dev-manual/common-tasks:creating a software bill of materials`"
388section in the Yocto Project Development Manual for more details.
389
364.. _ref-classes-cross: 390.. _ref-classes-cross:
365 391
366``cross.bbclass`` 392``cross.bbclass``
@@ -396,14 +422,62 @@ discussion on these cross-compilation tools.
396``cve-check.bbclass`` 422``cve-check.bbclass``
397===================== 423=====================
398 424
399The ``cve-check`` class looks for known CVEs (Common Vulnerabilities 425The :ref:`cve-check <ref-classes-cve-check>` class looks for known CVEs (Common Vulnerabilities
400and Exposures) while building an image. This class is meant to be 426and Exposures) while building with BitBake. This class is meant to be
401inherited globally from a configuration file:: 427inherited globally from a configuration file::
402 428
403 INHERIT += "cve-check" 429 INHERIT += "cve-check"
404 430
431To filter out obsolete CVE database entries which are known not to impact software from Poky and OE-Core,
432add following line to the build configuration file::
433
434 include cve-extra-exclusions.inc
435
405You can also look for vulnerabilities in specific packages by passing 436You can also look for vulnerabilities in specific packages by passing
406``-c cve_check`` to BitBake. You will find details in the 437``-c cve_check`` to BitBake.
438
439After building the software with Bitbake, CVE check output reports are available in ``tmp/deploy/cve``
440and image specific summaries in ``tmp/deploy/images/*.cve`` or ``tmp/deploy/images/*.json`` files.
441
442When building, the CVE checker will emit build time warnings for any detected
443issues which are in the state ``Unpatched``, meaning that CVE issue seems to affect the software component
444and version being compiled and no patches to address the issue are applied. Other states
445for detected CVE issues are: ``Patched`` meaning that a patch to address the issue is already
446applied, and ``Ignored`` meaning that the issue can be ignored.
447
448The ``Patched`` state of a CVE issue is detected from patch files with the format
449``CVE-ID.patch``, e.g. ``CVE-2019-20633.patch``, in the :term:`SRC_URI` and using
450CVE metadata of format ``CVE: CVE-ID`` in the commit message of the patch file.
451
452If the recipe lists the ``CVE-ID`` in :term:`CVE_CHECK_IGNORE` variable, then the CVE state is reported
453as ``Ignored``. Multiple CVEs can be listed separated by spaces. Example::
454
455 CVE_CHECK_IGNORE += "CVE-2020-29509 CVE-2020-29511"
456
457If CVE check reports that a recipe contains false positives or false negatives, these may be
458fixed in recipes by adjusting the CVE product name using :term:`CVE_PRODUCT` and :term:`CVE_VERSION` variables.
459:term:`CVE_PRODUCT` defaults to the plain recipe name :term:`BPN` which can be adjusted to one or more CVE
460database vendor and product pairs using the syntax::
461
462 CVE_PRODUCT = "flex_project:flex"
463
464where ``flex_project`` is the CVE database vendor name and ``flex`` is the product name. Similarly
465if the default recipe version :term:`PV` does not match the version numbers of the software component
466in upstream releases or the CVE database, then the :term:`CVE_VERSION` variable can be used to set the
467CVE database compatible version number, for example::
468
469 CVE_VERSION = "2.39"
470
471Any bugs or missing or incomplete information in the CVE database entries should be fixed in the CVE database
472via the `NVD feedback form <https://nvd.nist.gov/info/contact-form>`__.
473
474Users should note that security is a process, not a product, and thus also CVE checking, analyzing results,
475patching and updating the software should be done as a regular process. The data and assumptions
476required for CVE checker to reliably detect issues are frequently broken in various ways.
477These can only be detected by reviewing the details of the issues and iterating over the generated reports,
478and following what happens in other Linux distributions and in the greater open source community.
479
480You will find some more details in the
407":ref:`dev-manual/common-tasks:checking for vulnerabilities`" 481":ref:`dev-manual/common-tasks:checking for vulnerabilities`"
408section in the Development Tasks Manual. 482section in the Development Tasks Manual.
409 483
@@ -1975,6 +2049,22 @@ When inherited by a recipe, the ``perlnative`` class supports using the
1975native version of Perl built by the build system rather than using the 2049native version of Perl built by the build system rather than using the
1976version provided by the build host. 2050version provided by the build host.
1977 2051
2052.. _ref-classes-pypi:
2053
2054``pypi.bbclass``
2055================
2056
2057The :ref:`pypi <ref-classes-pypi>` class sets variables appropriately for recipes that build
2058Python modules from `PyPI <https://pypi.org/>`__, the Python Package Index.
2059By default it determines the PyPI package name based upon :term:`BPN`
2060(stripping the "python-" or "python3-" prefix off if present), however in
2061some cases you may need to set it manually in the recipe by setting
2062:term:`PYPI_PACKAGE`.
2063
2064Variables set by the :ref:`pypi <ref-classes-pypi>` class include :term:`SRC_URI`, :term:`SECTION`,
2065:term:`HOMEPAGE`, :term:`UPSTREAM_CHECK_URI`, :term:`UPSTREAM_CHECK_REGEX`
2066and :term:`CVE_PRODUCT`.
2067
1978.. _ref-classes-python_flit_core: 2068.. _ref-classes-python_flit_core:
1979 2069
1980``python_flit_core.bbclass`` 2070``python_flit_core.bbclass``