Skip to content

Commit 2e51f67

Browse files
committed
Add version info to layer Packages in SPDX reports
The NTIA minimum requirements for an SBOM require that all Packages have version information. Since Tern represents container layers as SPDX Packages, these package elements must have version information in order to satisfy NTIA minimums. This commit adds version information to layer "Packages" using the layer indexes (i.e. the base OS layer has version "1") Works towards #1205 Signed-off-by: Rose Judge <[email protected]>
1 parent 700df46 commit 2e51f67

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

tern/formats/spdx/spdxjson/layer_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def get_layer_dict(layer_obj):
149149
layer_dict = {
150150
'name': os.path.basename(layer_obj.tar_file),
151151
'SPDXID': spdx_common.get_layer_spdxref(layer_obj),
152+
'versionInfo': layer_obj.layer_index,
152153
'packageFileName': layer_obj.tar_file,
153154
'downloadLocation': 'NONE',
154155
'filesAnalyzed': bool(layer_obj.files_analyzed),

tern/formats/spdx/spdxtagvalue/layer_helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ def get_layer_block(layer_obj, template):
115115
block += 'PackageName: {}\n'.format(os.path.basename(layer_obj.tar_file))
116116
# Package SPDXID
117117
block += 'SPDXID: {}\n'.format(spdx_common.get_layer_spdxref(layer_obj))
118+
# Package Version. For Layer objects, this is just the layer_index
119+
block += 'PackageVersion: {}\n'.format(layer_obj.layer_index)
118120
# Package File Name
119121
block += 'PackageFileName: {}\n'.format(layer_obj.tar_file)
120122
# Package Download Location (always NONE for layers)

0 commit comments

Comments
 (0)