Skip to content

Commit 0b6acf7

Browse files
committed
sbom rfc refinement
Signed-off-by: Brian DeHamer <[email protected]>
1 parent fac44c2 commit 0b6acf7

File tree

1 file changed

+12
-22
lines changed

1 file changed

+12
-22
lines changed

accepted/0000-sbom-command.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Summary
44

5-
Update the npm CLI with a new command which will generate a Software Bill of Materials (SBOM) for the current project. Users will have the option to generate an SBOM conforming to either the [Software Package Data Exchange (SPDX](https://spdx.github.io/spdx-spec/v2.3/)) or [CycloneDX](https://cyclonedx.org/specification/overview/) specifications.
5+
Update the npm CLI with a new command which will generate a Software Bill of Materials (SBOM) containing an inventory of the current project's dependencies. Users will have the option to generate an SBOM conforming to either the [Software Package Data Exchange (SPDX](https://spdx.github.io/spdx-spec/v2.3/)) or [CycloneDX](https://cyclonedx.org/specification/overview/) specifications.
66

77

88
## Motivation
@@ -23,9 +23,9 @@ A new `sbom` command will be added to the npm CLI which will generate an SBOM fo
2323

2424
Supported command options:
2525

26-
`--sbom-format` - SBOM format to use for output. Valid values are “spdx” or “cyclonedx”.
26+
`--sbom-format` - SBOM format to use for output. Valid values are “spdx” or “cyclonedx”. In the future, the set of valid values can be expanded to select differents versions of the supported output formats (e.g. "cyclonedx1.4" vs "cyclonedx1.5")
2727

28-
`--omit` - Dependency types to omit from generated SBOM. Valid values are “dev”, “optional”, and “peer” (can be set multiple times).
28+
`--omit` - Dependency types to omit from generated SBOM. Valid values are “dev”, “optional”, and “peer” (can be set multiple times). By default, all development, optional, and peer dependencies will be included in the generated SBOM unless explicitly excluded.
2929

3030
`--package-lock-only` - Constructs the SBOM based on the tree described by the _package-lock.json_, rather than the contents of _node_modules_. Defaults to _false_. If the _node_modules_ folder is not present, this flag will be required in order to generate an SBOM.
3131

@@ -35,6 +35,8 @@ Supported command options:
3535

3636
If the user runs the `sbom` command without first installing the dependencies for the project (i.e. there is no _node_modules_ folder present) an error will be displayed. An SBOM can be generated solely based on the contents of the _package-lock.json_ but requires the user to explicitly specify the `--package-lock-only` flag.
3737

38+
Initially, we'll support the most widely used versions of the SPDX and CycloneDX specifications (likely v2.3 for SPDX and v1.4 for CycloneDX). Best effort will be made to support new versions as they gain adoption across the ecosystem.
39+
3840

3941
## Rationale and Alternatives
4042

@@ -85,24 +87,12 @@ Both of the SBOM formats present a flat list of dependencies (CycloneDX groups t
8587
}
8688
```
8789

88-
Scoped packages will have a <code>[group](https://cyclonedx.org/docs/1.5/json/#components_items_group)</code> field which identifies just the scope portion of the package name. For example:
89-
90-
```json
91-
{
92-
"type": "library",
93-
"name": "node14",
94-
"group": "@tsconfig",
95-
"version": "1.0.3",
96-
"bom-ref": "@tsconfig/[email protected]"
97-
}
98-
```
99-
100-
The <code>[properties](https://cyclonedx.org/docs/1.5/json/#components_items_properties)</code> collection also provides for a standard property under the [npm taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy/blob/main/cdx/npm.md) for annotating development dependencies. For any package which was determined to be a development dependency of the root project, we would add the following to the <code>properties</code> collection:
90+
The <code>[properties](https://cyclonedx.org/docs/1.4/json/#components_items_properties)</code> collection also provides for a standard property under the [npm taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy/blob/main/cdx/npm.md) for annotating development dependencies. For any package which was determined to be a development dependency of the root project, we would add the following to the <code>properties</code> collection:
10191

10292
```json
10393
{
10494
"name": "cdx:npm:package:development",
105-
"value": true
95+
"value": "true"
10696
}
10797
```
10898

@@ -208,9 +198,9 @@ The proposed CycloneDX SBOM generated for the project above would look like the
208198

209199
```json
210200
{
211-
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
201+
"$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
212202
"bomFormat": "CycloneDX",
213-
"specVersion": "1.5",
203+
"specVersion": "1.4",
214204
"serialNumber": "urn:uuid:1b4cd070-3f4c-4f63-965e-4ab302ad7b41",
215205
"version": 1,
216206
"metadata": {
@@ -239,8 +229,7 @@ The proposed CycloneDX SBOM generated for the project above would look like the
239229
"components": [
240230
{
241231
"type": "library",
242-
"name": "node14",
243-
"group": "@tsconfig",
232+
"name": "@tsconfig/node14",
244233
"version": "1.0.3",
245234
"bom-ref": "@tsconfig/[email protected]",
246235
"purl": "pkg:npm/%40tsconfig/[email protected]",
@@ -251,7 +240,7 @@ The proposed CycloneDX SBOM generated for the project above would look like the
251240
},
252241
{
253242
"name": "cdx:npm:package:development",
254-
"value": true
243+
"value": "true"
255244
}
256245
],
257246
"hashes": [
@@ -422,6 +411,7 @@ The proposed SPDX SBOM generated for the project above would look like the follo
422411
## References
423412

424413
* [NTIA Software Bill of Materials](https://ntia.gov/page/software-bill-materials)
414+
* [Types of Sofware Bill of Materials (SBOM) Documents](https://www.cisa.gov/sites/default/files/2023-04/sbom-types-document-508c.pdf)
425415
* [OSSF - SBOM Everywhere SIG](https://github.com/ossf/sbom-everywhere)
426416
* [Authoritative Guide to SBOM](https://cyclonedx.org/guides/sbom/OWASP_CycloneDX-SBOM-Guide-en.pdf)
427417
* [SPDX Spec v2.3](https://spdx.github.io/spdx-spec/v2.3/)

0 commit comments

Comments
 (0)