You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There had been some confusion around when to use the Package
verification code field vs Package checksum. A small group of us got
together and tried to provide more clarity around the two fields in a
new section, Annex K.3 Verifying SPDX Packages. We also updated the
`Description` and `Intent` fields for sections 7.9 and 7.10.
Signed-off-by: Jeff Schutt <[email protected]>
Signed-off-by: Ivana Atanasova <[email protected]>
Signed-off-by: Nisha Kumar <[email protected]>
Signed-off-by: Gary ONeall <[email protected]>
Signed-off-by: Adolfo Veytia <[email protected]>
Signed-off-by: Rose Judge <[email protected]>
| Relationship | (11.1) Relationship: `CONTAINS`, `DESCRIBES` <br>The document must `DESCRIBES` at least one package.</br> |
230
230
| Timestamp | (6.9) Created |
231
+
232
+
233
+
## K.3 Verifying SPDX Packages
234
+
235
+
Several use cases for SPDX depend on the consumer being able to verify the provenance and integrity of their software. SPDX can support several different scenarios depending on what information is available to the producer, what information is available to the consumer, and how the SPDX document is delivered. These scenarios are described below along with recommended approaches to verifying the SPDX packages.
236
+
237
+
### K.3.1 General Guidance
238
+
239
+
If a Package can be represented as a single blob of bytes, such as a tar archive:
240
+
*`PackageChecksum` must be computed by applying one of the supported hashing algorithms to the package blob.
241
+
*`PackageDownloadLocation` should be a download locator that retrieves the package blob.
242
+
* A supplier can define a `PackageChecksum` in a Package without providing a `PackageDownloadLocation`. This lets consumers perform an offline verification of private blobs.
243
+
244
+
If a Package represents an artifact that logically binds a number of single files together (such as a zip file or a directory):
245
+
* If the files bound by the Package are described in the document, `PackageVerificationCode` should be computed by using the files' [SHA1](https://www.rfc-editor.org/rfc/rfc3174) checksums. Additionally, the `FilesAnalyzed` field in the Package **MUST** be set to `true`.
246
+
* If the SHA1 checksum of any files bound by the Package is not available or the File needs to be excluded from the computation, it MUST be marked so by appending `(excludes: FileName)` at the end of the package verification code value.
247
+
248
+
249
+
### K.3.2 Examples
250
+
251
+
#### K.3.2.1 SPDX Package and SPDX Document both contained in Archive File
252
+
Examples include: tarball binding one or more files to a SPDX package, installation file which installs the package and extracts SPDX document in the same directory
253
+
254
+
SPDX Field To Use: [7.9 Package verification code](package-information.md#79-package-verification-code-field-)
255
+
256
+
Guidance:
257
+
* With the SPDX document included in the archive, it is not possible for the SPDX document to include a checksum for the archive itself. Generate a Package verification code and include the SPDX Document file name in the Excluded Files field.
258
+
259
+
260
+
#### K.3.2.2 SPDX Package Delivered as an Archive File Separate from the SPDX Document
261
+
Examples include: tarball, installation file
262
+
263
+
SPDX Field to Use: [7.10 Package checksum](package-information.md#710-package-checksum-field-)
264
+
265
+
Guidance:
266
+
* Generate a checksum for the archive file and include it in the SPDX Package checksum field. The archive file name should also be included in the [Package file name](package-information.md#74-package-file-name-field-) field.
267
+
* If source files for the Package are included in the Package distribution archive, the Package verification code for that Package should also be included in the SPDX document and the [Files analyzed](package-information.md#78-files-analyzed-field-) field should be set to `true`.
268
+
269
+
#### K.3.2.3 A Single File Represented as a SPDX Package
270
+
271
+
Examples include: tarball, binary image, single executable
272
+
273
+
SPDX Field To Use: [7.10 Package checksum](package-information.md#710-package-checksum-field-)
274
+
275
+
Guidance:
276
+
* If a [Package download location](package-information.md#77-package-download-location-field-) exists, the Package checksum should be the cryptographic hash of the Package blob at the Package download location specified.
277
+
* If the Package download location is not known, not available, or not accessible to the software consumer, the producer should include a Package checksum for the included Package file.
278
+
279
+
280
+
#### K.3.2.4 Directory of Software Represented as a SPDX Package
281
+
282
+
Examples include: source code, containers
283
+
284
+
SPDX Field To Use: [7.9 Package verification code](package-information.md#79-package-verification-code-field-)
285
+
286
+
Guidance:
287
+
* Include [File name](file-information.md#81-file-name-field-) field in the SPDX document for every file in the directory, include each file’s cryptographic hash as a [File checksum](file-information.md#84-file-checksum-field-), create a [CONTAINS relationship](relationships-between-SPDX-elements.md#111-relationship-field-) between the Package and the files, and set [Files analyzed](package-information.md#78-files-analyzed-field-) to `true` on the Package. **Note**: if Files analyzed is set to `false` you __cannot__ provide a Package verification code.
Copy file name to clipboardexpand all lines: chapters/package-information.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -629,7 +629,7 @@ EXAMPLE 2 RDF: Property `spdx:filesAnalyzed` in class `spdx:Package`
629
629
630
630
### 7.9.1 Description
631
631
632
-
This field provides an independently reproducible mechanism identifying specific contents of a package based on the actual files (except the SPDX document itself, if it is included in the package) that make up each package and that correlates to the data in this SPDX document. This identifier enables a recipient to determine if any file in the original package (that the analysis was done on) has been changed and permits inclusion of an SPDX document as part of a package. The metadata for the package verification code field is shown in Table 21.
632
+
This field provides an independently reproducible mechanism that permits unique identification of a package and the files contained within it (except the SPDX document itself, if it is included in the package). The metadata for the package verification code field is shown in Table 21. For more specific use cases and examples of how to apply the package verification code field, see [Annex K.3 Verifying SPDX Packages](how-to-use.md#k3-verifying-spdx-packages).
633
633
634
634
**Table 21 — Metadata for the package verification code field**
Provide a unique identifier based on the files inside each package, eliminating confusion over which version or modification of a specific package the SPDX document refers to. This field also permits embedding the SPDX document within the package without altering the identifier.
665
+
Identify, based on the files inside each package, which version or modification of a specific package the SPDX document references. This field also permits embedding the SPDX document within the package without altering the identifier. This identifier enables a recipient to determine which, if any, files in the original package have been changed.
666
666
667
667
### 7.9.3 Examples
668
668
@@ -695,7 +695,7 @@ EXAMPLE 2 RDF: Properties `spdx:packageVerificationCodeValue`, `spdx:packageVeri
695
695
696
696
### 7.10.1 Description
697
697
698
-
Provide an independently reproducible mechanism that permits unique identification of a specific package that correlates to the data in this SPDX document. This identifier enables a recipient to determine if any file in the original package has been changed. If the SPDX document is to be included in a package, this value should not be calculated. The [SHA1][SHA-1] algorithm shall be used to provide the checksum by default. The metadata for the package checksum field is shown in Table 22.
698
+
Provide an independently reproducible mechanism that permits unique identification of a specific package in this SPDX document. If the SPDX document is to be included in the package, the `PackageVerificationCode` field should be used instead. The metadata for the package checksum field is shown in Table 22. For more specific use cases and examples of how to apply the package checksum field, see [Annex K.3 Verifying SPDX Packages](how-to-use.md#k3-verifying-spdx-packages).
699
699
700
700
**Table 22 — Metadata for the package checksum field**
701
701
@@ -708,7 +708,7 @@ Provide an independently reproducible mechanism that permits unique identificati
708
708
709
709
### 7.10.2 Intent
710
710
711
-
Eliminate confusion over which version or modification of a specific package the SPDX document references by providing a unique identifier of the package.
711
+
Identify, based on the binary blob, which version or modification of a specific package the SPDX document references. This identifier enables a recipient to determine if any bits in the original package have been changed but does not specify which bits.
0 commit comments