Skip to content

google/sbom-conformance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

sbom-conformance

A tool to check the conformance of SBOMs to specifications. A checker for the NTIA Minimum Elements Specification, SPDX v2.3 requirements, and the Google style guide is provided with the library.

Note

This library only supports SPDX v2.3 and JSON encoded SBOMs.

How to use

sbom-conformance is a library and a CLI.

Interactive

go install github.com/google/sbom-conformance@latest

sbom-conformance -specs eo -sbom <path to sbom>

Run sbom-conformance -h to see the supported options.

Programmatic

Initialization

The BaseChecker does the analysis of SBOMs. The following code creates a base checker, runs it, and generates the results.

import (
	"github.com/google/sbom-conformance/pkg/checkers/base"
)

checker := base.NewChecker(base.WithGoogleChecker(),
                           base.WithEOChecker(),
                           base.WithSPDXChecker())
checker.SetSBOM(sbom)
checker.RunChecks()
results := checker.Results()

You can choose any of the supported specs.

Accessing the Results

Text Summary:

results.TextSummary

Structured summary of the SBOM and the conformance checks:

results.Summary

Results of the top-level conformance checks:

results.TopLevelChecks

There are two ways to get the results of the package-level conformance checks.

Get conformance checks per-package:

results.PkgResults

Get the conformance checks directly, with statistics on the number of passed packages.

results.PackageLevelChecks

Supported Specifications

NTIA Minimum Elements

name: EO

A PDF of the specification can be found in https://www.ntia.doc.gov/files/ntia/publications/sbom_minimum_elements_report.pdf. The checker in this library verifies the minimum required "Data Fields", but not the minimum required "Automation Support" or the minimum required "Practices and Processes".

This checker considers NOASSERTION to be invalid for the Version, Supplier, and Relationships checks.

Author

This refers to the "Author of SBOM Data" data field in the NTIA specification. It is a top-level check that passes if the Creator field contains at least one entry.

Timestamp

This refers to the "Timestamp" data field in the NTIA specification. It is a top-level check that passes if the Created field is present and non-empty.

Relationships

This refers to the "Dependency Relationship" data field in the NTIA specification. It is a top-level check that passes if, for every package, there exists a relationship where the package is either spdxElementId or relatedSpdxElement and where the other side of the relationship is not NOASSERTION or the package itself.

Note that the relationshipType is not considered. In the case that a package has no relationships, NONE can be used for spdxElementId or for relatedSpdxElement, and the check will pass for the package.

This is one interpretation of the NTIA specification. It differs from the SPDX intepretation (defined here), possibly because this library's intepretation does not factor in documents such as Framing Software Component Transparency: Establishing a Common Software Bill of Material (SBOM).

Name

This refers to the "Component Name" data field in the NTIA specification. It is a package-level check that passes if the Name field is present and non-empty.

Version

This refers to the "Version of the Component" data field in the NTIA specification. It is a package-level check that passes if all of the following are true for the Version field:

  • it is present
  • it is not empty
  • it is not NOASSERTION

Supplier

This refers to the "Supplier Name" data field in the NTIA specification. It is a package-level check that passes if all of the following are true for the Package Supplier field:

  • it is present
  • it is not empty
  • it is not NOASSERTION

External References

This refers to the "Other Unique Identifiers" data field in the NTIA specification. It is a package-level check that passes if the External References field is present and non-empty.

SPDX 2.3

name: SPDX

The SPDX 2.3 specification (https://spdx.github.io/spdx-spec/v2.3/) requires that some fields are present and/or meet certain syntactic constraints.

Document Name

This is a top-level check that passes if the Document Name field is present and not empty.

Document Namespace

This is a top-level check that passes if the Document Namespace field is present and is a RFC 3986 URL with a scheme and without # characters.

Document SPDXID

This is a top-level check that passes if the Document SPDX Identifier field is SPDXRef-DOCUMENT.

Creator

This is a top-level check that passes if the Creator contains one or more entries and each entry is formatted correctly. The last parenthesis group in the creator is interpreted as the email.

Created

This is a top-level check that passes if the Created field is present and conforms to YYYY-MM-DDThh:mm:ssZ.

Other License Information

This is a top-level check that passes if, for each entry in the Other Licensing Information section, all of the following are true:

The licenses are not checked against the SPDX license list.

Data License

This is a top-level check that passes if the Data License field is CC0-1.0.

Package Name

This is a package-level check that passes if the Name field is present and non-empty.

Package SPDXID

This is a package-level check that passes if the Package SPDX Identifier field is present and conforms to SPDXRef-<idstring> where idstring only contains letters, numbers, ., and/or -.

Package SPDXID Uniqueness

This is a top-level check that passes if the Package SPDX Identifier field is unique among all packages.

Download Location

This is a package-level check that passes if the Package Download Location field is present and not empty.

Files Analyzed

This is a package-level check that passes if either of the following are true:

Google Style Guide

name: google

The Google SBOM Style Guide is similar to the SPDX requirements with a few additional restrictions for SBOMs authored by Google.

Document Name

This is a top-level check that passes if the Document Name field is present and not empty.

Document Name

This is a top-level check that passes if the Document Namespace field is present and conforms to https://spdx.google/<uuid>.

Data License

This is a top-level check that passes if the Data License field is CC0-1.0.

Document SPDXID

This is a top-level check that passes if the Document SPDX Identifier field is SPDXRef-DOCUMENT.

Creator

This is a top-level check that passes if the Creator contains an "Organization: Google LLC entry, contains a Tool entry, and does not contain a Person entry.

Created

This is a top-level check that passes if the Created field is present and conforms to YYYY-MM-DDThh:mm:ssZ.

Other License Information

This is a top-level check that passes if, for each entry in the Other Licensing Information section, all of the following are true:

Package Name

This is a package-level check that passes if the Name field is present and non-empty.

Package SPDXID

This is a package-level check that passes if the Package SPDX Identifier field is present and conforms to SPDXRef-<idstring> where idstring only contains letters, numbers, ., and/or -.

Package Supplier

This is a package-level check that passes if the Package Supplier field is one of NOASSERTION, Organization: ..., and Person: ....

Package Licenses

This is a package-level check that passes if either the Package Concluded License field or the Package License Info From Files field is present and contains a reference to custom license text (or more than one, for the latter field). References to licenses in other SPDX documents are not allowed.

Disclaimer

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors