|
| 1 | +*************************************************************** |
| 2 | +How to Guide for working with Software Bill of Materials (SBOM) |
| 3 | +*************************************************************** |
| 4 | + |
| 5 | +Glossary |
| 6 | +======== |
| 7 | + |
| 8 | +.. glossary:: |
| 9 | + |
| 10 | + SBOM |
| 11 | + Software Bill of Materials - is a comprehensive list of all the software components, dependencies, and metadata associated with an application. |
| 12 | + |
| 13 | + SPDX |
| 14 | + Software Package Data Exchange - is an open standard (or format) for communicating Software Bill of Materials (SBOM) information including components, licenses, copyrights, and security references. |
| 15 | + |
| 16 | + CycloneDX |
| 17 | + CycloneDX is a full-stack Bill of Materials (BOM) standard that provides advanced supply chain capabilities for cyber risk reduction. |
| 18 | + |
| 19 | + VEX |
| 20 | + Vulnerability Exploitability eXchange - is a standardized format for sharing information about vulnerabilities and their exploitability. |
| 21 | + |
| 22 | + |
| 23 | +Generating SBOM |
| 24 | +=============== |
| 25 | + |
| 26 | +|__SDK_FULL_NAME__| build generates SBOMs in the following formats and versions: |
| 27 | + |
| 28 | +.. list-table:: |
| 29 | + :header-rows: 1 |
| 30 | + |
| 31 | + * - Format |
| 32 | + - Version |
| 33 | + - Yocto |
| 34 | + - Buildroot |
| 35 | + * - SPDX |
| 36 | + - 3.0 |
| 37 | + - Supported |
| 38 | + - Not-Supported |
| 39 | + * - CycloneDX |
| 40 | + - 1.6 |
| 41 | + - Supported |
| 42 | + - Supported |
| 43 | + |
| 44 | +Follow the steps below based on your required format. |
| 45 | + |
| 46 | +Generating SBOM in SPDX 3.0 Format |
| 47 | +---------------------------------- |
| 48 | + |
| 49 | +SPDX 3.0 is generated by default when building |__SDK_FULL_NAME__| Yocto, no extra steps required. |
| 50 | +If you require additional vulnerability information, follow these steps: |
| 51 | + |
| 52 | +1. Add the following line to your ``local.conf``: |
| 53 | + |
| 54 | + .. code-block:: text |
| 55 | +
|
| 56 | + INHERIT += "vex" |
| 57 | +
|
| 58 | +2. Build Yocto according to the build instructions in :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>`. |
| 59 | + |
| 60 | +The following artifacts will be generated in the Yocto deploy directory: |
| 61 | + |
| 62 | +.. list-table:: |
| 63 | + :header-rows: 1 |
| 64 | + :widths: 50 50 |
| 65 | + |
| 66 | + * - File |
| 67 | + - Description |
| 68 | + * - ``${IMAGE_NAME}.rootfs.spdx.json`` |
| 69 | + - The SPDX v3.0 SBOM file |
| 70 | + * - ``${IMAGE_NAME}.rootfs.json`` |
| 71 | + - Vulnerability information file generated by ``vex.bbclass`` |
| 72 | + |
| 73 | + |
| 74 | +Generating SBOM in CycloneDX Format |
| 75 | +-------------------------------------- |
| 76 | + |
| 77 | +To generate SBOM in CycloneDX format, follow these steps: |
| 78 | + |
| 79 | +1. Start with the build instructions in :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>` |
| 80 | +2. After cloning ``oe-layersetup``, uncomment the ``meta-cyclonedx`` line in |
| 81 | + the layer configuration file, for example: |
| 82 | + |
| 83 | + .. code-block:: text |
| 84 | +
|
| 85 | + meta-cyclonedx,https://github.com/iris-GmbH/meta-cyclonedx.git,main,0170751b487162f8e476fd32d441ddfcf24ca78a,layers= |
| 86 | +
|
| 87 | +3. Add the following line to your ``local.conf``: |
| 88 | + |
| 89 | + .. code-block:: text |
| 90 | +
|
| 91 | + INHERIT += "cyclonedx-export" |
| 92 | +
|
| 93 | +4. Continue to build Yocto according to the build instructions in :ref:`Processor SDK - Building the SDK with Yocto <building-the-sdk-with-yocto>`. |
| 94 | + |
| 95 | +The following artifacts will be generated in the Yocto deploy directory: |
| 96 | + |
| 97 | +.. list-table:: |
| 98 | + :header-rows: 1 |
| 99 | + :widths: 50 50 |
| 100 | + |
| 101 | + * - File |
| 102 | + - Description |
| 103 | + * - ``${IMAGE_NAME}.rootfs.cyclonedx.bom.json`` |
| 104 | + - The CycloneDX SBOM file |
| 105 | + * - ``${IMAGE_NAME}.rootfs.cyclonedx.vex.json`` |
| 106 | + - The CycloneDX VEX file |
| 107 | + |
| 108 | +Working with SBOM |
| 109 | +================= |
| 110 | + |
| 111 | +It is recommended to use open-source tools for working with SBOMs. |
| 112 | +The following open-source tools are recommended for working with SBOMs: |
| 113 | + |
| 114 | +.. list-table:: |
| 115 | + :header-rows: 1 |
| 116 | + :widths: 20 40 40 |
| 117 | + |
| 118 | + * - Format |
| 119 | + - Tool |
| 120 | + - Description |
| 121 | + * - CycloneDX |
| 122 | + - `CycloneDX Sunshine <https://github.com/CycloneDX/Sunshine/>`_ |
| 123 | + - Visualize CycloneDX SBOMs in a human-readable format |
| 124 | + * - CycloneDX |
| 125 | + - `CycloneDX CLI <https://github.com/CycloneDX/cyclonedx-cli>`_ |
| 126 | + - BOM analysis, modification, diffing, merging, format conversion, signing and verification. |
| 127 | + * - SPDX |
| 128 | + - `SPDX Open Source Tools <https://spdx.dev/tools/open-source-tools/>`_ |
| 129 | + - A collection of open-source tools for working with SPDX SBOMs |
| 130 | + |
| 131 | +.. note:: |
| 132 | + |
| 133 | + SPDX 3.0 is not yet widely supported by SPDX tools. Using such tools with |
| 134 | + SPDX 3.0 files may give varied or unexpected results. |
| 135 | + |
| 136 | +CVE Analysis |
| 137 | +============ |
| 138 | + |
| 139 | +The `sbom-cve-check <https://pypi.org/project/sbom-cve-check/>`_ tool can be |
| 140 | +used to perform CVE analysis on the generated SPDX SBOM. |
| 141 | + |
| 142 | +1. Install the tool: |
| 143 | + |
| 144 | + .. code-block:: console |
| 145 | +
|
| 146 | + pip install sbom-cve-check |
| 147 | +
|
| 148 | + .. note:: |
| 149 | + |
| 150 | + It is recommended to install this tool in a Python virtual environment. |
| 151 | + |
| 152 | +2. Retrieve the following artifacts from the Yocto deploy directory: |
| 153 | + |
| 154 | + .. list-table:: |
| 155 | + :header-rows: 1 |
| 156 | + :widths: 50 50 |
| 157 | + |
| 158 | + * - File |
| 159 | + - Description |
| 160 | + * - ``${IMAGE_NAME}.rootfs.spdx.json`` |
| 161 | + - The SPDX v3.0 SBOM file |
| 162 | + * - ``${IMAGE_NAME}.rootfs.json`` |
| 163 | + - Vulnerability information file generated by ``vex.bbclass`` |
| 164 | + |
| 165 | +3. Run the CVE analysis: |
| 166 | + |
| 167 | + .. code-block:: console |
| 168 | +
|
| 169 | + sbom-cve-check --sbom-path ${IMAGE_NAME}.rootfs.spdx.json \ |
| 170 | + --yocto-vex-manifest ${IMAGE_NAME}.rootfs.json \ |
| 171 | + --export-type yocto-cve-check-manifest \ |
| 172 | + --export-path cve-check.json |
| 173 | +
|
| 174 | +.. note:: |
| 175 | + |
| 176 | + ``sbom-cve-check`` only supports SPDX format and does not support CycloneDX. |
0 commit comments