From 5374a1dc6ff642e95a40c9001208b2217716b306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Galv=C3=A3o=20Xavier?= Date: Fri, 3 Dec 2021 17:06:23 -0800 Subject: [PATCH] add cyclone-json output format (#635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add cyclone json format Signed-off-by: Jonas Galvão Xavier * adapt format to sbom.SBOM structure Signed-off-by: Jonas Galvão Xavier * cycloneDX json output with official lib Signed-off-by: Jonas Galvão Xavier * add cycloneDX 1.3 schema output in xml Signed-off-by: Jonas Galvão Xavier * fix lints errors Signed-off-by: Jonas Galvão Xavier * tidying go mod Signed-off-by: Jonas Galvão Xavier * remove cycloneDX 1.2 format Signed-off-by: Jonas Galvão Xavier * update cycloneDX xml schema Signed-off-by: Jonas Galvão Xavier * fix cyclone according to schema Signed-off-by: Jonas Galvão Xavier * use RFC 2141 URN form of uuid for serial number add schema validation for cycloneDX 1.3 JSON output add yajsv cli for JSON schema validation during tests Signed-off-by: Jonas Galvão Xavier * tidying go mod up Signed-off-by: Jonas Galvão Xavier * go get json schema validator Signed-off-by: Jonas Galvão Xavier * install yajsv without mess with go mod Signed-off-by: Jonas Galvão Xavier * reuse code between cycloneDX json & xml encoders Signed-off-by: Jonas Galvão Xavier * add output options for cyclone XML add bom.json to .gitignore Signed-off-by: Jonas Galvão Xavier * add cyclone json format Signed-off-by: Jonas Galvão Xavier * adapt format to sbom.SBOM structure Signed-off-by: Jonas Galvão Xavier * cycloneDX json output with official lib Signed-off-by: Jonas Galvão Xavier * add cycloneDX 1.3 schema output in xml Signed-off-by: Jonas Galvão Xavier * fix lints errors Signed-off-by: Jonas Galvão Xavier * tidying go mod Signed-off-by: Jonas Galvão Xavier * remove cycloneDX 1.2 format Signed-off-by: Jonas Galvão Xavier * update cycloneDX xml schema Signed-off-by: Jonas Galvão Xavier * fix cyclone according to schema Signed-off-by: Jonas Galvão Xavier * use RFC 2141 URN form of uuid for serial number add schema validation for cycloneDX 1.3 JSON output add yajsv cli for JSON schema validation during tests Signed-off-by: Jonas Galvão Xavier * tidying go mod up Signed-off-by: Jonas Galvão Xavier * go get json schema validator Signed-off-by: Jonas Galvão Xavier * install yajsv without mess with go mod Signed-off-by: Jonas Galvão Xavier * reuse code between cycloneDX json & xml encoders Signed-off-by: Jonas Galvão Xavier * add output options for cyclone XML add bom.json to .gitignore Signed-off-by: Jonas Galvão Xavier * fix cyclone12xml removal Signed-off-by: Jonas Galvão Xavier * feedback changes Signed-off-by: Jonas Galvão Xavier * go mod tidy Signed-off-by: Jonas Galvão Xavier --- Makefile | 2 +- go.mod | 1 + go.sum | 4 + .../formats/common/cyclonedxhelpers/format.go | 93 + internal/formats/common/testutils/utils.go | 4 + internal/formats/cyclonedx12xml/encoder.go | 26 - .../cyclonedx12xml/model/bom_descriptor.go | 31 - .../formats/cyclonedx12xml/model/component.go | 20 - .../formats/cyclonedx12xml/model/document.go | 17 - .../formats/cyclonedx12xml/model/license.go | 10 - .../formats/cyclonedx12xml/to_format_model.go | 95 - internal/formats/cyclonedx13json/encoder.go | 18 + .../formats/cyclonedx13json/encoder_test.go | 39 + internal/formats/cyclonedx13json/format.go | 12 + .../test-fixtures/image-simple/Dockerfile | 0 .../test-fixtures/image-simple/file-1.txt | 0 .../test-fixtures/image-simple/file-2.txt | 0 .../TestCycloneDxDirectoryPresenter.golden | 42 + .../TestCycloneDxImagePresenter.golden | 42 + .../stereoscope-fixture-image-simple.golden | Bin 0 -> 15360 bytes internal/formats/cyclonedx13xml/encoder.go | 18 + .../encoder_test.go | 2 +- .../format.go | 4 +- .../test-fixtures/image-simple/Dockerfile | 4 + .../test-fixtures/image-simple/file-1.txt | 1 + .../test-fixtures/image-simple/file-2.txt | 1 + .../TestCycloneDxDirectoryPresenter.golden | 6 +- .../TestCycloneDxImagePresenter.golden | 6 +- .../stereoscope-fixture-image-simple.golden | Bin 0 -> 15360 bytes internal/formats/formats.go | 6 +- schema/cyclonedx/.gitignore | 3 +- schema/cyclonedx/Makefile | 4 +- schema/cyclonedx/bom-1.3.schema.json | 1054 ++++++++ schema/cyclonedx/cyclonedx.xsd | 325 ++- schema/cyclonedx/spdx.xsd | 2372 +++++++++-------- syft/format/option.go | 14 +- 36 files changed, 2857 insertions(+), 1419 deletions(-) create mode 100644 internal/formats/common/cyclonedxhelpers/format.go delete mode 100644 internal/formats/cyclonedx12xml/encoder.go delete mode 100644 internal/formats/cyclonedx12xml/model/bom_descriptor.go delete mode 100644 internal/formats/cyclonedx12xml/model/component.go delete mode 100644 internal/formats/cyclonedx12xml/model/document.go delete mode 100644 internal/formats/cyclonedx12xml/model/license.go delete mode 100644 internal/formats/cyclonedx12xml/to_format_model.go create mode 100644 internal/formats/cyclonedx13json/encoder.go create mode 100644 internal/formats/cyclonedx13json/encoder_test.go create mode 100644 internal/formats/cyclonedx13json/format.go rename internal/formats/{cyclonedx12xml => cyclonedx13json}/test-fixtures/image-simple/Dockerfile (100%) rename internal/formats/{cyclonedx12xml => cyclonedx13json}/test-fixtures/image-simple/file-1.txt (100%) rename internal/formats/{cyclonedx12xml => cyclonedx13json}/test-fixtures/image-simple/file-2.txt (100%) create mode 100644 internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxDirectoryPresenter.golden create mode 100644 internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden create mode 100644 internal/formats/cyclonedx13json/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden create mode 100644 internal/formats/cyclonedx13xml/encoder.go rename internal/formats/{cyclonedx12xml => cyclonedx13xml}/encoder_test.go (97%) rename internal/formats/{cyclonedx12xml => cyclonedx13xml}/format.go (71%) create mode 100644 internal/formats/cyclonedx13xml/test-fixtures/image-simple/Dockerfile create mode 100644 internal/formats/cyclonedx13xml/test-fixtures/image-simple/file-1.txt create mode 100644 internal/formats/cyclonedx13xml/test-fixtures/image-simple/file-2.txt rename internal/formats/{cyclonedx12xml => cyclonedx13xml}/test-fixtures/snapshot/TestCycloneDxDirectoryPresenter.golden (79%) rename internal/formats/{cyclonedx12xml => cyclonedx13xml}/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden (81%) create mode 100644 internal/formats/cyclonedx13xml/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden create mode 100644 schema/cyclonedx/bom-1.3.schema.json diff --git a/Makefile b/Makefile index b5cdb3cd0..0923efc84 100644 --- a/Makefile +++ b/Makefile @@ -82,7 +82,7 @@ help: .PHONY: ci-bootstrap ci-bootstrap: - DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y bc jq libxml2-utils + DEBIAN_FRONTEND=noninteractive sudo apt update && sudo -E apt install -y bc jq libxml2-utils && go install github.com/neilpa/yajsv@latest .PHONY: ci-bootstrap-mac: diff --git a/go.mod b/go.mod index 0be8da9c8..207342e57 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/anchore/syft go 1.16 require ( + github.com/CycloneDX/cyclonedx-go v0.4.0 github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d github.com/adrg/xdg v0.2.1 github.com/alecthomas/jsonschema v0.0.0-20210301060011-54c507b6f074 diff --git a/go.sum b/go.sum index 246d37e9b..1d40a165e 100644 --- a/go.sum +++ b/go.sum @@ -60,6 +60,8 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CycloneDX/cyclonedx-go v0.4.0 h1:Wz4QZ9B4RXGWIWTypVLEOVJgOdFfy5mcS5PGNzUkZxU= +github.com/CycloneDX/cyclonedx-go v0.4.0/go.mod h1:rmRcf//gT7PIzovatusbWi377xqCg1FS4jyST0GH20E= github.com/Microsoft/go-winio v0.4.11/go.mod h1:VhR8bwka0BXejwEJY73c50VrPtXAaKcyvVC4A4RozmA= github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5/go.mod h1:tTuCMEN+UleMWgg9dVx4Hu52b1bJo+59jBh3ajtinzw= @@ -138,6 +140,8 @@ github.com/bmatcuk/doublestar/v2 v2.0.4/go.mod h1:QMmcs3H2AUQICWhfzLXz+IYln8lRQm github.com/bmatcuk/doublestar/v4 v4.0.2 h1:X0krlUVAVmtr2cRoTqR8aDMrDqnB36ht8wpWTiQ3jsA= github.com/bmatcuk/doublestar/v4 v4.0.2/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= +github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= diff --git a/internal/formats/common/cyclonedxhelpers/format.go b/internal/formats/common/cyclonedxhelpers/format.go new file mode 100644 index 000000000..96397af7f --- /dev/null +++ b/internal/formats/common/cyclonedxhelpers/format.go @@ -0,0 +1,93 @@ +package cyclonedxhelpers + +import ( + "time" + + "github.com/CycloneDX/cyclonedx-go" + "github.com/anchore/syft/internal" + "github.com/anchore/syft/internal/version" + "github.com/anchore/syft/syft/pkg" + "github.com/anchore/syft/syft/sbom" + "github.com/anchore/syft/syft/source" + "github.com/google/uuid" +) + +func ToFormatModel(s sbom.SBOM) *cyclonedx.BOM { + cdxBOM := cyclonedx.NewBOM() + versionInfo := version.FromBuild() + + // NOTE(jonasagx): cycloneDX requires URN uuids (URN returns the RFC 2141 URN form of uuid): + // https://github.com/CycloneDX/specification/blob/master/schema/bom-1.3-strict.schema.json#L36 + // "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + cdxBOM.SerialNumber = uuid.New().URN() + cdxBOM.Metadata = toBomDescriptor(internal.ApplicationName, versionInfo.Version, s.Source) + + packages := s.Artifacts.PackageCatalog.Sorted() + components := make([]cyclonedx.Component, len(packages)) + for i, p := range packages { + components[i] = toComponent(p) + } + cdxBOM.Components = &components + + return cdxBOM +} + +// NewBomDescriptor returns a new BomDescriptor tailored for the current time and "syft" tool details. +func toBomDescriptor(name, version string, srcMetadata source.Metadata) *cyclonedx.Metadata { + return &cyclonedx.Metadata{ + Timestamp: time.Now().Format(time.RFC3339), + Tools: &[]cyclonedx.Tool{ + { + Vendor: "anchore", + Name: name, + Version: version, + }, + }, + Component: toBomDescriptorComponent(srcMetadata), + } +} + +func toComponent(p pkg.Package) cyclonedx.Component { + return cyclonedx.Component{ + Type: cyclonedx.ComponentTypeLibrary, + Name: p.Name, + Version: p.Version, + PackageURL: p.PURL, + Licenses: toLicenses(p.Licenses), + } +} + +func toBomDescriptorComponent(srcMetadata source.Metadata) *cyclonedx.Component { + switch srcMetadata.Scheme { + case source.ImageScheme: + return &cyclonedx.Component{ + Type: cyclonedx.ComponentTypeContainer, + Name: srcMetadata.ImageMetadata.UserInput, + Version: srcMetadata.ImageMetadata.ManifestDigest, + } + case source.DirectoryScheme, source.FileScheme: + return &cyclonedx.Component{ + Type: cyclonedx.ComponentTypeFile, + Name: srcMetadata.Path, + } + } + + return nil +} + +func toLicenses(ls []string) *cyclonedx.Licenses { + if len(ls) == 0 { + return nil + } + + lc := make(cyclonedx.Licenses, len(ls)) + for i, licenseName := range ls { + lc[i] = cyclonedx.LicenseChoice{ + License: &cyclonedx.License{ + Name: licenseName, + }, + } + } + + return &lc +} diff --git a/internal/formats/common/testutils/utils.go b/internal/formats/common/testutils/utils.go index d24162c83..8d1a4df6b 100644 --- a/internal/formats/common/testutils/utils.go +++ b/internal/formats/common/testutils/utils.go @@ -60,6 +60,8 @@ func AssertPresenterAgainstGoldenImageSnapshot(t *testing.T, pres presenter.Pres if !bytes.Equal(expected, actual) { dmp := diffmatchpatch.New() diffs := dmp.DiffMain(string(expected), string(actual), true) + t.Logf("len: %d\nexpected: %v", len(expected), expected) + t.Logf("len: %d\nactual: %v", len(actual), actual) t.Errorf("mismatched output:\n%s", dmp.DiffPrettyText(diffs)) } } @@ -87,6 +89,8 @@ func AssertPresenterAgainstGoldenSnapshot(t *testing.T, pres presenter.Presenter if !bytes.Equal(expected, actual) { dmp := diffmatchpatch.New() diffs := dmp.DiffMain(string(expected), string(actual), true) + t.Logf("len: %d\nexpected: %s", len(expected), expected) + t.Logf("len: %d\nactual: %s", len(actual), actual) t.Errorf("mismatched output:\n%s", dmp.DiffPrettyText(diffs)) } } diff --git a/internal/formats/cyclonedx12xml/encoder.go b/internal/formats/cyclonedx12xml/encoder.go deleted file mode 100644 index a371ce052..000000000 --- a/internal/formats/cyclonedx12xml/encoder.go +++ /dev/null @@ -1,26 +0,0 @@ -package cyclonedx12xml - -import ( - "encoding/xml" - "io" - - "github.com/anchore/syft/syft/sbom" -) - -func encoder(output io.Writer, s sbom.SBOM) error { - enc := xml.NewEncoder(output) - enc.Indent("", " ") - - _, err := output.Write([]byte(xml.Header)) - if err != nil { - return err - } - - err = enc.Encode(toFormatModel(s)) - if err != nil { - return err - } - - _, err = output.Write([]byte("\n")) - return err -} diff --git a/internal/formats/cyclonedx12xml/model/bom_descriptor.go b/internal/formats/cyclonedx12xml/model/bom_descriptor.go deleted file mode 100644 index 77406f5a5..000000000 --- a/internal/formats/cyclonedx12xml/model/bom_descriptor.go +++ /dev/null @@ -1,31 +0,0 @@ -package model - -import ( - "encoding/xml" -) - -// Source: https://cyclonedx.org/ext/bom-descriptor/ - -// BomDescriptor represents all metadata surrounding the BOM report (such as when the BOM was made, with which tool, and the item being cataloged). -type BomDescriptor struct { - XMLName xml.Name `xml:"metadata"` - Timestamp string `xml:"timestamp,omitempty"` // The date and time (timestamp) when the document was created - Tools []BomDescriptorTool `xml:"tools>tool"` // The tool used to create the BOM. - Component *BomDescriptorComponent `xml:"component"` // The component that the BOM describes. -} - -// BomDescriptorTool represents the tool that created the BOM report. -type BomDescriptorTool struct { - XMLName xml.Name `xml:"tool"` - Vendor string `xml:"vendor,omitempty"` // The vendor of the tool used to create the BOM. - Name string `xml:"name,omitempty"` // The name of the tool used to create the BOM. - Version string `xml:"version,omitempty"` // The version of the tool used to create the BOM. - // TODO: hashes, author, manufacture, supplier - // TODO: add user-defined fields for the remaining build/version parameters -} - -// BomDescriptorComponent represents the software/package being cataloged. -type BomDescriptorComponent struct { - XMLName xml.Name `xml:"component"` - Component -} diff --git a/internal/formats/cyclonedx12xml/model/component.go b/internal/formats/cyclonedx12xml/model/component.go deleted file mode 100644 index ea5efbae1..000000000 --- a/internal/formats/cyclonedx12xml/model/component.go +++ /dev/null @@ -1,20 +0,0 @@ -package model - -import "encoding/xml" - -// Component represents a single element in the CycloneDX BOM -type Component struct { - XMLName xml.Name `xml:"component"` - Type string `xml:"type,attr"` // Required; Describes if the component is a library, framework, application, container, operating system, firmware, hardware device, or file - Supplier string `xml:"supplier,omitempty"` // The organization that supplied the component. The supplier may often be the manufacture, but may also be a distributor or repackager. - Author string `xml:"author,omitempty"` // The person(s) or organization(s) that authored the component - Publisher string `xml:"publisher,omitempty"` // The person(s) or organization(s) that published the component - Group string `xml:"group,omitempty"` // The high-level classification that a project self-describes as. This will often be a shortened, single name of the company or project that produced the component, or the source package or domain name. - Name string `xml:"name"` // Required; The name of the component as defined by the project - Version string `xml:"version"` // Required; The version of the component as defined by the project - Description string `xml:"description,omitempty"` // A description of the component - Licenses *[]License `xml:"licenses>license"` // A node describing zero or more license names, SPDX license IDs or expressions - PackageURL string `xml:"purl,omitempty"` // Specifies the package-url (PackageURL). The purl, if specified, must be valid and conform to the specification defined at: https://github.com/package-url/purl-spec - // TODO: source, hashes, copyright, cpe, purl, swid, modified, pedigree, externalReferences - // TODO: add user-defined parameters for syft-specific values (image layer index, cataloger, location path, etc.) -} diff --git a/internal/formats/cyclonedx12xml/model/document.go b/internal/formats/cyclonedx12xml/model/document.go deleted file mode 100644 index 6ba8a08ca..000000000 --- a/internal/formats/cyclonedx12xml/model/document.go +++ /dev/null @@ -1,17 +0,0 @@ -package model - -import ( - "encoding/xml" -) - -// Source: https://github.com/CycloneDX/specification - -// Document represents a CycloneDX BOM Document. -type Document struct { - XMLName xml.Name `xml:"bom"` - XMLNs string `xml:"xmlns,attr"` - Version int `xml:"version,attr"` - SerialNumber string `xml:"serialNumber,attr"` - BomDescriptor *BomDescriptor `xml:"metadata"` // The BOM descriptor extension - Components []Component `xml:"components>component"` // The BOM contents -} diff --git a/internal/formats/cyclonedx12xml/model/license.go b/internal/formats/cyclonedx12xml/model/license.go deleted file mode 100644 index c833e28d0..000000000 --- a/internal/formats/cyclonedx12xml/model/license.go +++ /dev/null @@ -1,10 +0,0 @@ -package model - -import "encoding/xml" - -// License represents a single software license for a Component -type License struct { - XMLName xml.Name `xml:"license"` - ID string `xml:"id,omitempty"` // A valid SPDX license ID - Name string `xml:"name,omitempty"` // If SPDX does not define the license used, this field may be used to provide the license name -} diff --git a/internal/formats/cyclonedx12xml/to_format_model.go b/internal/formats/cyclonedx12xml/to_format_model.go deleted file mode 100644 index 2ffbf3c1a..000000000 --- a/internal/formats/cyclonedx12xml/to_format_model.go +++ /dev/null @@ -1,95 +0,0 @@ -package cyclonedx12xml - -import ( - "encoding/xml" - "time" - - "github.com/anchore/syft/syft/sbom" - - "github.com/anchore/syft/internal" - "github.com/anchore/syft/internal/formats/cyclonedx12xml/model" - "github.com/anchore/syft/internal/version" - "github.com/anchore/syft/syft/pkg" - "github.com/anchore/syft/syft/source" - "github.com/google/uuid" -) - -// toFormatModel creates and populates a new in-memory representation of a CycloneDX 1.2 document -func toFormatModel(s sbom.SBOM) model.Document { - versionInfo := version.FromBuild() - - doc := model.Document{ - XMLNs: "http://cyclonedx.org/schema/bom/1.2", - Version: 1, - SerialNumber: uuid.New().URN(), - BomDescriptor: toBomDescriptor(internal.ApplicationName, versionInfo.Version, s.Source), - } - - // attach components - for _, p := range s.Artifacts.PackageCatalog.Sorted() { - doc.Components = append(doc.Components, toComponent(p)) - } - - return doc -} - -func toComponent(p pkg.Package) model.Component { - return model.Component{ - Type: "library", // TODO: this is not accurate - Name: p.Name, - Version: p.Version, - PackageURL: p.PURL, - Licenses: toLicenses(p.Licenses), - } -} - -// NewBomDescriptor returns a new BomDescriptor tailored for the current time and "syft" tool details. -func toBomDescriptor(name, version string, srcMetadata source.Metadata) *model.BomDescriptor { - return &model.BomDescriptor{ - XMLName: xml.Name{}, - Timestamp: time.Now().Format(time.RFC3339), - Tools: []model.BomDescriptorTool{ - { - Vendor: "anchore", - Name: name, - Version: version, - }, - }, - Component: toBomDescriptorComponent(srcMetadata), - } -} - -func toBomDescriptorComponent(srcMetadata source.Metadata) *model.BomDescriptorComponent { - switch srcMetadata.Scheme { - case source.ImageScheme: - return &model.BomDescriptorComponent{ - Component: model.Component{ - Type: "container", - Name: srcMetadata.ImageMetadata.UserInput, - Version: srcMetadata.ImageMetadata.ManifestDigest, - }, - } - case source.DirectoryScheme, source.FileScheme: - return &model.BomDescriptorComponent{ - Component: model.Component{ - Type: "file", - Name: srcMetadata.Path, - }, - } - } - return nil -} - -func toLicenses(licenses []string) *[]model.License { - if len(licenses) == 0 { - return nil - } - - var result []model.License - for _, licenseName := range licenses { - result = append(result, model.License{ - Name: licenseName, - }) - } - return &result -} diff --git a/internal/formats/cyclonedx13json/encoder.go b/internal/formats/cyclonedx13json/encoder.go new file mode 100644 index 000000000..b405a2ca2 --- /dev/null +++ b/internal/formats/cyclonedx13json/encoder.go @@ -0,0 +1,18 @@ +package cyclonedx13json + +import ( + "io" + + "github.com/CycloneDX/cyclonedx-go" + "github.com/anchore/syft/internal/formats/common/cyclonedxhelpers" + "github.com/anchore/syft/syft/sbom" +) + +func encoder(output io.Writer, s sbom.SBOM) error { + bom := cyclonedxhelpers.ToFormatModel(s) + enc := cyclonedx.NewBOMEncoder(output, cyclonedx.BOMFileFormatJSON) + enc.SetPretty(true) + + err := enc.Encode(bom) + return err +} diff --git a/internal/formats/cyclonedx13json/encoder_test.go b/internal/formats/cyclonedx13json/encoder_test.go new file mode 100644 index 000000000..880b3d021 --- /dev/null +++ b/internal/formats/cyclonedx13json/encoder_test.go @@ -0,0 +1,39 @@ +package cyclonedx13json + +import ( + "flag" + "regexp" + "testing" + + "github.com/anchore/syft/internal/formats/common/testutils" +) + +var updateCycloneDx = flag.Bool("update-cyclonedx", false, "update the *.golden files for cyclone-dx presenters") + +func TestCycloneDxDirectoryPresenter(t *testing.T) { + testutils.AssertPresenterAgainstGoldenSnapshot(t, + Format().Presenter(testutils.DirectoryInput(t)), + *updateCycloneDx, + cycloneDxRedactor, + ) +} + +func TestCycloneDxImagePresenter(t *testing.T) { + testImage := "image-simple" + testutils.AssertPresenterAgainstGoldenImageSnapshot(t, + Format().Presenter(testutils.ImageInput(t, testImage)), + testImage, + *updateCycloneDx, + cycloneDxRedactor, + ) +} + +func cycloneDxRedactor(s []byte) []byte { + serialPattern := regexp.MustCompile(`urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}`) + rfc3339Pattern := regexp.MustCompile(`([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))`) + + for _, pattern := range []*regexp.Regexp{serialPattern, rfc3339Pattern} { + s = pattern.ReplaceAll(s, []byte("redacted")) + } + return s +} diff --git a/internal/formats/cyclonedx13json/format.go b/internal/formats/cyclonedx13json/format.go new file mode 100644 index 000000000..afbe4336f --- /dev/null +++ b/internal/formats/cyclonedx13json/format.go @@ -0,0 +1,12 @@ +package cyclonedx13json + +import "github.com/anchore/syft/syft/format" + +func Format() format.Format { + return format.NewFormat( + format.CycloneDxJSONOption, + encoder, + nil, + nil, + ) +} diff --git a/internal/formats/cyclonedx12xml/test-fixtures/image-simple/Dockerfile b/internal/formats/cyclonedx13json/test-fixtures/image-simple/Dockerfile similarity index 100% rename from internal/formats/cyclonedx12xml/test-fixtures/image-simple/Dockerfile rename to internal/formats/cyclonedx13json/test-fixtures/image-simple/Dockerfile diff --git a/internal/formats/cyclonedx12xml/test-fixtures/image-simple/file-1.txt b/internal/formats/cyclonedx13json/test-fixtures/image-simple/file-1.txt similarity index 100% rename from internal/formats/cyclonedx12xml/test-fixtures/image-simple/file-1.txt rename to internal/formats/cyclonedx13json/test-fixtures/image-simple/file-1.txt diff --git a/internal/formats/cyclonedx12xml/test-fixtures/image-simple/file-2.txt b/internal/formats/cyclonedx13json/test-fixtures/image-simple/file-2.txt similarity index 100% rename from internal/formats/cyclonedx12xml/test-fixtures/image-simple/file-2.txt rename to internal/formats/cyclonedx13json/test-fixtures/image-simple/file-2.txt diff --git a/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxDirectoryPresenter.golden b/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxDirectoryPresenter.golden new file mode 100644 index 000000000..76b0c7a15 --- /dev/null +++ b/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxDirectoryPresenter.golden @@ -0,0 +1,42 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.3", + "serialNumber": "urn:uuid:a81dc685-cf22-48e0-bda5-65ea1a8bca5b", + "version": 1, + "metadata": { + "timestamp": "2021-12-03T13:17:26-08:00", + "tools": [ + { + "vendor": "anchore", + "name": "syft", + "version": "[not provided]" + } + ], + "component": { + "type": "file", + "name": "/some/path", + "version": "" + } + }, + "components": [ + { + "type": "library", + "name": "package-1", + "version": "1.0.1", + "licenses": [ + { + "license": { + "name": "MIT" + } + } + ], + "purl": "a-purl-2" + }, + { + "type": "library", + "name": "package-2", + "version": "2.0.1", + "purl": "a-purl-2" + } + ] +} diff --git a/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden b/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden new file mode 100644 index 000000000..8c17c2948 --- /dev/null +++ b/internal/formats/cyclonedx13json/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden @@ -0,0 +1,42 @@ +{ + "bomFormat": "CycloneDX", + "specVersion": "1.3", + "serialNumber": "urn:uuid:2156ac1f-c838-4e93-8dc5-a3874ffeb967", + "version": 1, + "metadata": { + "timestamp": "2021-12-03T13:17:26-08:00", + "tools": [ + { + "vendor": "anchore", + "name": "syft", + "version": "[not provided]" + } + ], + "component": { + "type": "container", + "name": "user-image-input", + "version": "sha256:2731251dc34951c0e50fcc643b4c5f74922dad1a5d98f302b504cf46cd5d9368" + } + }, + "components": [ + { + "type": "library", + "name": "package-1", + "version": "1.0.1", + "licenses": [ + { + "license": { + "name": "MIT" + } + } + ], + "purl": "a-purl-1" + }, + { + "type": "library", + "name": "package-2", + "version": "2.0.1", + "purl": "a-purl-2" + } + ] +} diff --git a/internal/formats/cyclonedx13json/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden b/internal/formats/cyclonedx13json/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden new file mode 100644 index 0000000000000000000000000000000000000000..3d93b6d3ad1c86098e440073bcf8cfdf5eea53e1 GIT binary patch literal 15360 zcmeHOTW{Mo6wdR0g{Qs7Ht(bi?4fH4v_P>GZPo!Rih$xJ(P~SEBo_&S{P!Knj$?am z)kLz<3k3t>^@#iqk90mB8hfg2qL?y9Ag3+2)O%%-k1=6b3(TYz+QdS}i7?nu&ZWUT z<^=Ir$#{I!ej&t=cx7{l9(o`pt{eKfg3wgb@-9^t!xu?@&s&^-mBifTKZYoqTCfcXdCz{znHv`3~)H z|HcsLZ2$k3dDb$g7W>B>i(UH{6bJinfwhBff zwKA4_DW$hqdvGlzPZCF&N<{2pNC@I;XT!z@dL`Ox?m?C*oUU9wFoFmkVmw6j46zBr z6Q)L-63h|*r*4>Ml}f0eFS);y^yZ7$zb zHqD}m*VED+N9(eD0aMv6bOm%>6`obs>-6c|W!rL^+-YWD5UcjjvX9XuTTG|N(bE~s zY?*v9(-*6OzRjnLnJe#V{?3aJX?Agvu15PTtBUJ+p4JdA`<`ZhEYj&()JvVX>8kr} zgUq*&$Ghm&le6c)j~8Vzp5{hR$7Pacla2g3dtcEMEwhk}-aiJ=F|3S-BB~2>nO4qJ zi=tMUo>{>_Ob(bw(==OLMYp|}~ZU%O&d`_P}gTHgN*9KfCTKjs{T_y1=B z?XjZFXU?ZnHzcF#s_IejhNu?(BSaegQ;9GWk^uk1k^%oah-dnf`~OSb59;qIe7(zG zH`ErA0fB%(Kp-IS10x`Tomqxs=_#?)VM>uVf|g`oH}@hGqEvA7a_vM4zEG_k6lxu01ieEmm8Tuq_f>)7GzL{+DT4Awd*?=uU+9~{v|i>P=K#&uiM+@U;@A zWK-|YQww$PqViG`E+)n*2nQ(UF~QghZg6ZIY}gnM4tZiMF-|2q7KxxxOhrs%5o_3v zk+ES6age%_#E2zMb8LiCPFN!or?94oYm+#L23P`NCFhYLLOXb*@)lWU9AjR@MDXbS z?RQ9~4`Hx9Kcnkr-Cp8#YC1#Q$J_H}L;YXsiDs9O8fdgZdpw z>}>zt{eL6~-r4^p2nGNDAggE<|LeL8Y8QF!xdWR-Lj*B9e1_1Z`Gr{Bmtu7r9{Zua z-mZ$@PyB~SN&^2s#0y}X^zP@0?eU-H{Kr=OhX?)dM;SX(E7(VAc0mT0x?G2Wb{d6j zKp-Fx5C{nTa0twFmU>rKUlYf9?Bv_N|D4miGvW0K@#g#o4&VRB!u_Cr5IuRiIyo8j z5(@+-_}b0$Gkvj)EL5&=d1>;w8~XIBK07x|>qC#jGM&w*ZlWNvC?LRqlu9gw1(=sw z!P(Fl!UQZvUO+92oh06y82)^Mq_M(b<&h)A@T5Nf_p&~N);z91Is^0Q?`#}|Gv5F5 zAiW%_aRIt2Q;4LcuH4r%+w7m*|2OE){)Gtkzb|!c$-Rln77MLohn - + - 2021-06-23T13:40:33-04:00 + 2021-12-03T13:16:45-08:00 anchore @@ -31,4 +31,4 @@ a-purl-2 - + \ No newline at end of file diff --git a/internal/formats/cyclonedx12xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden b/internal/formats/cyclonedx13xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden similarity index 81% rename from internal/formats/cyclonedx12xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden rename to internal/formats/cyclonedx13xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden index d81de3a32..d3531d0c9 100644 --- a/internal/formats/cyclonedx12xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden +++ b/internal/formats/cyclonedx13xml/test-fixtures/snapshot/TestCycloneDxImagePresenter.golden @@ -1,7 +1,7 @@ - + - 2021-06-23T13:40:33-04:00 + 2021-12-03T13:16:45-08:00 anchore @@ -31,4 +31,4 @@ a-purl-2 - + \ No newline at end of file diff --git a/internal/formats/cyclonedx13xml/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden b/internal/formats/cyclonedx13xml/test-fixtures/snapshot/stereoscope-fixture-image-simple.golden new file mode 100644 index 0000000000000000000000000000000000000000..3d93b6d3ad1c86098e440073bcf8cfdf5eea53e1 GIT binary patch literal 15360 zcmeHOTW{Mo6wdR0g{Qs7Ht(bi?4fH4v_P>GZPo!Rih$xJ(P~SEBo_&S{P!Knj$?am z)kLz<3k3t>^@#iqk90mB8hfg2qL?y9Ag3+2)O%%-k1=6b3(TYz+QdS}i7?nu&ZWUT z<^=Ir$#{I!ej&t=cx7{l9(o`pt{eKfg3wgb@-9^t!xu?@&s&^-mBifTKZYoqTCfcXdCz{znHv`3~)H z|HcsLZ2$k3dDb$g7W>B>i(UH{6bJinfwhBff zwKA4_DW$hqdvGlzPZCF&N<{2pNC@I;XT!z@dL`Ox?m?C*oUU9wFoFmkVmw6j46zBr z6Q)L-63h|*r*4>Ml}f0eFS);y^yZ7$zb zHqD}m*VED+N9(eD0aMv6bOm%>6`obs>-6c|W!rL^+-YWD5UcjjvX9XuTTG|N(bE~s zY?*v9(-*6OzRjnLnJe#V{?3aJX?Agvu15PTtBUJ+p4JdA`<`ZhEYj&()JvVX>8kr} zgUq*&$Ghm&le6c)j~8Vzp5{hR$7Pacla2g3dtcEMEwhk}-aiJ=F|3S-BB~2>nO4qJ zi=tMUo>{>_Ob(bw(==OLMYp|}~ZU%O&d`_P}gTHgN*9KfCTKjs{T_y1=B z?XjZFXU?ZnHzcF#s_IejhNu?(BSaegQ;9GWk^uk1k^%oah-dnf`~OSb59;qIe7(zG zH`ErA0fB%(Kp-IS10x`Tomqxs=_#?)VM>uVf|g`oH}@hGqEvA7a_vM4zEG_k6lxu01ieEmm8Tuq_f>)7GzL{+DT4Awd*?=uU+9~{v|i>P=K#&uiM+@U;@A zWK-|YQww$PqViG`E+)n*2nQ(UF~QghZg6ZIY}gnM4tZiMF-|2q7KxxxOhrs%5o_3v zk+ES6age%_#E2zMb8LiCPFN!or?94oYm+#L23P`NCFhYLLOXb*@)lWU9AjR@MDXbS z?RQ9~4`Hx9Kcnkr-Cp8#YC1#Q$J_H}L;YXsiDs9O8fdgZdpw z>}>zt{eL6~-r4^p2nGNDAggE<|LeL8Y8QF!xdWR-Lj*B9e1_1Z`Gr{Bmtu7r9{Zua z-mZ$@PyB~SN&^2s#0y}X^zP@0?eU-H{Kr=OhX?)dM;SX(E7(VAc0mT0x?G2Wb{d6j zKp-Fx5C{nTa0twFmU>rKUlYf9?Bv_N|D4miGvW0K@#g#o4&VRB!u_Cr5IuRiIyo8j z5(@+-_}b0$Gkvj)EL5&=d1>;w8~XIBK07x|>qC#jGM&w*ZlWNvC?LRqlu9gw1(=sw z!P(Fl!UQZvUO+92oh06y82)^Mq_M(b<&h)A@T5Nf_p&~N);z91Is^0Q?`#}|Gv5F5 zAiW%_aRIt2Q;4LcuH4r%+w7m*|2OE){)Gtkzb|!c$-Rln77MLohn bom.xml - xmllint --noout --schema ./cyclonedx.xsd bom.xml \ No newline at end of file + xmllint --noout --schema ./cyclonedx.xsd bom.xml + go run ../../main.go ubuntu:latest -vv -o cyclonedx-json > bom.json + yajsv -s bom-1.3.schema.json bom.json diff --git a/schema/cyclonedx/bom-1.3.schema.json b/schema/cyclonedx/bom-1.3.schema.json new file mode 100644 index 000000000..fdec97367 --- /dev/null +++ b/schema/cyclonedx/bom-1.3.schema.json @@ -0,0 +1,1054 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://cyclonedx.org/schema/bom-1.3.schema.json", + "type": "object", + "title": "CycloneDX Software Bill-of-Material Specification", + "$comment" : "CycloneDX JSON schema is published under the terms of the Apache License 2.0.", + "required": [ + "bomFormat", + "specVersion", + "version" + ], + "properties": { + "bomFormat": { + "$id": "#/properties/bomFormat", + "type": "string", + "title": "BOM Format", + "description": "Specifies the format of the BOM. This helps to identify the file as CycloneDX since BOMs do not have a filename convention nor does JSON schema support namespaces.", + "enum": [ + "CycloneDX" + ] + }, + "specVersion": { + "$id": "#/properties/specVersion", + "type": "string", + "title": "CycloneDX Specification Version", + "description": "The version of the CycloneDX specification a BOM is written to (starting at version 1.2)", + "examples": ["1.3"] + }, + "serialNumber": { + "$id": "#/properties/serialNumber", + "type": "string", + "title": "BOM Serial Number", + "description": "Every BOM generated should have a unique serial number, even if the contents of the BOM being generated have not changed over time. The process or tool responsible for creating the BOM should create random UUID's for every BOM generated.", + "examples": ["urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79"], + "pattern": "^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" + }, + "version": { + "$id": "#/properties/version", + "type": "integer", + "title": "BOM Version", + "description": "The version allows component publishers/authors to make changes to existing BOMs to update various aspects of the document such as description or licenses. When a system is presented with multiple BOMs for the same component, the system should use the most recent version of the BOM. The default version is '1' and should be incremented for each version of the BOM that is published. Each version of a component should have a unique BOM and if no changes are made to the BOMs, then each BOM will have a version of '1'.", + "default": 1, + "examples": [1] + }, + "metadata": { + "$id": "#/properties/metadata", + "$ref": "#/definitions/metadata", + "title": "BOM Metadata", + "description": "Provides additional information about a BOM." + }, + "components": { + "$id": "#/properties/components", + "type": "array", + "items": {"$ref": "#/definitions/component"}, + "uniqueItems": true, + "title": "Components" + }, + "services": { + "$id": "#/properties/services", + "type": "array", + "items": {"$ref": "#/definitions/service"}, + "uniqueItems": true, + "title": "Services" + }, + "externalReferences": { + "$id": "#/properties/externalReferences", + "type": "array", + "items": {"$ref": "#/definitions/externalReference"}, + "title": "External References", + "description": "External references provide a way to document systems, sites, and information that may be relevant but which are not included with the BOM." + }, + "dependencies": { + "$id": "#/properties/dependencies", + "type": "array", + "items": {"$ref": "#/definitions/dependency"}, + "uniqueItems": true, + "title": "Dependencies", + "description": "Provides the ability to document dependency relationships." + }, + "compositions": { + "$id": "#/properties/compositions", + "type": "array", + "items": {"$ref": "#/definitions/compositions"}, + "uniqueItems": true, + "title": "Compositions", + "description": "Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness." + } + }, + "definitions": { + "metadata": { + "type": "object", + "title": "BOM Metadata Object", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time", + "title": "Timestamp", + "description": "The date and time (timestamp) when the document was created." + }, + "tools": { + "type": "array", + "title": "Creation Tools", + "description": "The tool(s) used in the creation of the BOM.", + "items": {"$ref": "#/definitions/tool"} + }, + "authors" :{ + "type": "array", + "title": "Authors", + "description": "The person(s) who created the BOM. Authors are common in BOMs created through manual processes. BOMs created through automated means may not have authors.", + "items": {"$ref": "#/definitions/organizationalContact"} + }, + "component": { + "title": "Component", + "description": "The component that the BOM describes.", + "$ref": "#/definitions/component" + }, + "manufacture": { + "title": "Manufacture", + "description": "The organization that manufactured the component that the BOM describes.", + "$ref": "#/definitions/organizationalEntity" + }, + "supplier": { + "title": "Supplier", + "description": " The organization that supplied the component that the BOM describes. The supplier may often be the manufacturer, but may also be a distributor or repackager.", + "$ref": "#/definitions/organizationalEntity" + }, + "licenses": { + "type": "array", + "title": "BOM License(s)", + "items": {"$ref": "#/definitions/licenseChoice"} + }, + "properties": { + "type": "array", + "title": "Properties", + "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values.", + "items": {"$ref": "#/definitions/property"} + } + } + }, + "tool": { + "type": "object", + "title": "Tool", + "description": "The tool used to create the BOM.", + "properties": { + "vendor": { + "type": "string", + "title": "Tool Vendor", + "description": "The date and time (timestamp) when the document was created." + }, + "name": { + "type": "string", + "title": "Tool Name", + "description": "The date and time (timestamp) when the document was created." + }, + "version": { + "type": "string", + "title": "Tool Version", + "description": "The date and time (timestamp) when the document was created." + }, + "hashes": { + "$id": "#/properties/hashes", + "type": "array", + "items": {"$ref": "#/definitions/hash"}, + "title": "Hashes", + "description": "The hashes of the tool (if applicable)." + } + } + }, + "organizationalEntity": { + "type": "object", + "title": "Organizational Entity Object", + "description": "", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "The name of the organization", + "examples": [ + "Example Inc." + ] + }, + "url": { + "type": "array", + "items": { + "type": "string", + "format": "iri-reference" + }, + "title": "URL", + "description": "The URL of the organization. Multiple URLs are allowed.", + "examples": ["https://example.com"] + }, + "contact": { + "type": "array", + "title": "Contact", + "description": "A contact at the organization. Multiple contacts are allowed.", + "items": {"$ref": "#/definitions/organizationalContact"} + } + } + }, + "organizationalContact": { + "type": "object", + "title": "Organizational Contact Object", + "description": "", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "The name of a contact", + "examples": ["Contact name"] + }, + "email": { + "type": "string", + "title": "Email Address", + "description": "The email address of the contact.", + "examples": ["firstname.lastname@example.com"] + }, + "phone": { + "type": "string", + "title": "Phone", + "description": "The phone number of the contact.", + "examples": ["800-555-1212"] + } + } + }, + "component": { + "type": "object", + "title": "Component Object", + "required": [ + "type", + "name", + "version" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "application", + "framework", + "library", + "container", + "operating-system", + "device", + "firmware", + "file" + ], + "title": "Component Type", + "description": "Specifies the type of component. For software components, classify as application if no more specific appropriate classification is available or cannot be determined for the component.", + "examples": ["library"] + }, + "mime-type": { + "type": "string", + "title": "Mime-Type", + "description": "The optional mime-type of the component. When used on file components, the mime-type can provide additional context about the kind of file being represented such as an image, font, or executable. Some library or framework components may also have an associated mime-type.", + "examples": ["image/jpeg"], + "pattern": "^[-+a-z0-9.]+/[-+a-z0-9.]+$" + }, + "bom-ref": { + "type": "string", + "title": "BOM Reference", + "description": "An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref should be unique." + }, + "supplier": { + "title": "Component Supplier", + "description": " The organization that supplied the component. The supplier may often be the manufacturer, but may also be a distributor or repackager.", + "$ref": "#/definitions/organizationalEntity" + }, + "author": { + "type": "string", + "title": "Component Author", + "description": "The person(s) or organization(s) that authored the component", + "examples": ["Acme Inc"] + }, + "publisher": { + "type": "string", + "title": "Component Publisher", + "description": "The person(s) or organization(s) that published the component", + "examples": ["Acme Inc"] + }, + "group": { + "type": "string", + "title": "Component Group", + "description": "The grouping name or identifier. This will often be a shortened, single name of the company or project that produced the component, or the source package or domain name. Whitespace and special characters should be avoided. Examples include: apache, org.apache.commons, and apache.org.", + "examples": ["com.acme"] + }, + "name": { + "type": "string", + "title": "Component Name", + "description": "The name of the component. This will often be a shortened, single name of the component. Examples: commons-lang3 and jquery", + "examples": ["tomcat-catalina"] + }, + "version": { + "type": "string", + "title": "Component Version", + "description": "The component version. The version should ideally comply with semantic versioning but is not enforced.", + "examples": ["9.0.14"] + }, + "description": { + "type": "string", + "title": "Component Description", + "description": "Specifies a description for the component" + }, + "scope": { + "type": "string", + "enum": [ + "required", + "optional", + "excluded" + ], + "title": "Component Scope", + "description": "Specifies the scope of the component. If scope is not specified, 'required' scope should be assumed by the consumer of the BOM", + "default": "required" + }, + "hashes": { + "type": "array", + "title": "Component Hashes", + "items": {"$ref": "#/definitions/hash"} + }, + "licenses": { + "type": "array", + "items": {"$ref": "#/definitions/licenseChoice"}, + "title": "Component License(s)" + }, + "copyright": { + "type": "string", + "title": "Component Copyright", + "description": "An optional copyright notice informing users of the underlying claims to copyright ownership in a published work.", + "examples": ["Acme Inc"] + }, + "cpe": { + "type": "string", + "title": "Component Common Platform Enumeration (CPE)", + "description": "DEPRECATED - DO NOT USE. This will be removed in a future version. Specifies a well-formed CPE name. See https://nvd.nist.gov/products/cpe", + "examples": ["cpe:2.3:a:acme:component_framework:-:*:*:*:*:*:*:*"] + }, + "purl": { + "type": "string", + "title": "Component Package URL (purl)", + "examples": ["pkg:maven/com.acme/tomcat-catalina@9.0.14?packaging=jar"] + }, + "swid": { + "$ref": "#/definitions/swid", + "title": "SWID Tag", + "description": "Specifies metadata and content for ISO-IEC 19770-2 Software Identification (SWID) Tags." + }, + "modified": { + "type": "boolean", + "title": "Component Modified From Original", + "description": "DEPRECATED - DO NOT USE. This will be removed in a future version. Use the pedigree element instead to supply information on exactly how the component was modified. A boolean value indicating is the component has been modified from the original. A value of true indicates the component is a derivative of the original. A value of false indicates the component has not been modified from the original." + }, + "pedigree": { + "type": "object", + "title": "Component Pedigree", + "description": "Component pedigree is a way to document complex supply chain scenarios where components are created, distributed, modified, redistributed, combined with other components, etc. Pedigree supports viewing this complex chain from the beginning, the end, or anywhere in the middle. It also provides a way to document variants where the exact relation may not be known.", + "properties": { + "ancestors": { + "type": "array", + "title": "Ancestors", + "description": "Describes zero or more components in which a component is derived from. This is commonly used to describe forks from existing projects where the forked version contains a ancestor node containing the original component it was forked from. For example, Component A is the original component. Component B is the component being used and documented in the BOM. However, Component B contains a pedigree node with a single ancestor documenting Component A - the original component from which Component B is derived from.", + "items": {"$ref": "#/definitions/component"} + }, + "descendants": { + "type": "array", + "title": "Descendants", + "description": "Descendants are the exact opposite of ancestors. This provides a way to document all forks (and their forks) of an original or root component.", + "items": {"$ref": "#/definitions/component"} + }, + "variants": { + "type": "array", + "title": "Variants", + "description": "Variants describe relations where the relationship between the components are not known. For example, if Component A contains nearly identical code to Component B. They are both related, but it is unclear if one is derived from the other, or if they share a common ancestor.", + "items": {"$ref": "#/definitions/component"} + }, + "commits": { + "type": "array", + "title": "Commits", + "description": "A list of zero or more commits which provide a trail describing how the component deviates from an ancestor, descendant, or variant.", + "items": {"$ref": "#/definitions/commit"} + }, + "patches": { + "type": "array", + "title": "Patches", + "description": ">A list of zero or more patches describing how the component deviates from an ancestor, descendant, or variant. Patches may be complimentary to commits or may be used in place of commits.", + "items": {"$ref": "#/definitions/patch"} + }, + "notes": { + "type": "string", + "title": "Notes", + "description": "Notes, observations, and other non-structured commentary describing the components pedigree." + } + } + }, + "externalReferences": { + "type": "array", + "items": {"$ref": "#/definitions/externalReference"}, + "title": "External References" + }, + "components": { + "$id": "#/properties/components", + "type": "array", + "items": {"$ref": "#/definitions/component"}, + "uniqueItems": true, + "title": "Components" + }, + "evidence": { + "$ref": "#/definitions/componentEvidence", + "title": "Evidence", + "description": "Provides the ability to document evidence collected through various forms of extraction or analysis." + }, + "properties": { + "type": "array", + "title": "Properties", + "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values.", + "items": {"$ref": "#/definitions/property"} + } + } + }, + "swid": { + "type": "object", + "title": "SWID Tag", + "description": "Specifies metadata and content for ISO-IEC 19770-2 Software Identification (SWID) Tags.", + "required": [ + "tagId", + "name" + ], + "properties": { + "tagId": { + "type": "string", + "title": "Tag ID", + "description": "Maps to the tagId of a SoftwareIdentity." + }, + "name": { + "type": "string", + "title": "Name", + "description": "Maps to the name of a SoftwareIdentity." + }, + "version": { + "type": "string", + "title": "Version", + "default": "0.0", + "description": "Maps to the version of a SoftwareIdentity." + }, + "tagVersion": { + "type": "integer", + "title": "Tag Version", + "default": 0, + "description": "Maps to the tagVersion of a SoftwareIdentity." + }, + "patch": { + "type": "boolean", + "title": "Patch", + "default": false, + "description": "Maps to the patch of a SoftwareIdentity." + }, + "text": { + "title": "Attachment text", + "description": "Specifies the metadata and content of the SWID tag.", + "$ref": "#/definitions/attachment" + }, + "url": { + "type": "string", + "title": "URL", + "description": "The URL to the SWID file.", + "format": "iri-reference" + } + } + }, + "attachment": { + "type": "object", + "title": "Attachment", + "description": "Specifies the metadata and content for an attachment.", + "required": [ + "content" + ], + "properties": { + "contentType": { + "type": "string", + "title": "Content-Type", + "description": "Specifies the content type of the text. Defaults to text/plain if not specified.", + "default": "text/plain" + }, + "encoding": { + "type": "string", + "title": "Encoding", + "description": "Specifies the optional encoding the text is represented in.", + "enum": [ + "base64" + ] + }, + "content": { + "type": "string", + "title": "Attachment Text", + "description": "The attachment data" + } + } + }, + "hash": { + "type": "object", + "title": "Hash Objects", + "required": [ + "alg", + "content" + ], + "properties": { + "alg": { + "$ref": "#/definitions/hash-alg" + }, + "content": { + "$ref": "#/definitions/hash-content" + } + } + }, + "hash-alg": { + "type": "string", + "enum": [ + "MD5", + "SHA-1", + "SHA-256", + "SHA-384", + "SHA-512", + "SHA3-256", + "SHA3-384", + "SHA3-512", + "BLAKE2b-256", + "BLAKE2b-384", + "BLAKE2b-512", + "BLAKE3" + ], + "title": "Hash Algorithm" + }, + "hash-content": { + "type": "string", + "title": "Hash Content (value)", + "examples": ["3942447fac867ae5cdb3229b658f4d48"], + "pattern": "^([a-fA-F0-9]{32}|[a-fA-F0-9]{40}|[a-fA-F0-9]{64}|[a-fA-F0-9]{96}|[a-fA-F0-9]{128})$" + }, + "license": { + "type": "object", + "title": "License Object", + "oneOf": [ + { + "required": ["id"] + }, + { + "required": ["name"] + } + ], + "properties": { + "id": { + "$ref": "spdx.schema.json", + "title": "License ID (SPDX)", + "description": "A valid SPDX license ID", + "examples": ["Apache-2.0"] + }, + "name": { + "type": "string", + "title": "License Name", + "description": "If SPDX does not define the license used, this field may be used to provide the license name", + "examples": ["Acme Software License"] + }, + "text": { + "title": "License text", + "description": "An optional way to include the textual content of a license.", + "$ref": "#/definitions/attachment" + }, + "url": { + "type": "string", + "title": "License URL", + "description": "The URL to the license file. If specified, a 'license' externalReference should also be specified for completeness", + "examples": ["https://www.apache.org/licenses/LICENSE-2.0.txt"], + "format": "iri-reference" + } + } + }, + "licenseChoice": { + "type": "object", + "title": "License(s)", + "properties": { + "license": { + "$ref": "#/definitions/license" + }, + "expression": { + "type": "string", + "title": "SPDX License Expression", + "examples": [ + "Apache-2.0 AND (MIT OR GPL-2.0-only)", + "GPL-3.0-only WITH Classpath-exception-2.0" + ] + } + }, + "oneOf":[ + { + "required": ["license"] + }, + { + "required": ["expression"] + } + ] + }, + "commit": { + "type": "object", + "title": "Commit", + "description": "Specifies an individual commit", + "properties": { + "uid": { + "type": "string", + "title": "UID", + "description": "A unique identifier of the commit. This may be version control specific. For example, Subversion uses revision numbers whereas git uses commit hashes." + }, + "url": { + "type": "string", + "title": "URL", + "description": "The URL to the commit. This URL will typically point to a commit in a version control system.", + "format": "iri-reference" + }, + "author": { + "title": "Author", + "description": "The author who created the changes in the commit", + "$ref": "#/definitions/identifiableAction" + }, + "committer": { + "title": "Committer", + "description": "The person who committed or pushed the commit", + "$ref": "#/definitions/identifiableAction" + }, + "message": { + "type": "string", + "title": "Message", + "description": "The text description of the contents of the commit" + } + } + }, + "patch": { + "type": "object", + "title": "Patch", + "description": "Specifies an individual patch", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "unofficial", + "monkey", + "backport", + "cherry-pick" + ], + "title": "Type", + "description": "Specifies the purpose for the patch including the resolution of defects, security issues, or new behavior or functionality" + }, + "diff": { + "title": "Diff", + "description": "The patch file (or diff) that show changes. Refer to https://en.wikipedia.org/wiki/Diff", + "$ref": "#/definitions/diff" + }, + "resolves": { + "type": "array", + "items": {"$ref": "#/definitions/issue"}, + "title": "Resolves", + "description": "A collection of issues the patch resolves" + } + } + }, + "diff": { + "type": "object", + "title": "Diff", + "description": "The patch file (or diff) that show changes. Refer to https://en.wikipedia.org/wiki/Diff", + "properties": { + "text": { + "title": "Diff text", + "description": "Specifies the optional text of the diff", + "$ref": "#/definitions/attachment" + }, + "url": { + "type": "string", + "title": "URL", + "description": "Specifies the URL to the diff", + "format": "iri-reference" + } + } + }, + "issue": { + "type": "object", + "title": "Diff", + "description": "The patch file (or diff) that show changes. Refer to https://en.wikipedia.org/wiki/Diff", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "defect", + "enhancement", + "security" + ], + "title": "Type", + "description": "Specifies the type of issue" + }, + "id": { + "type": "string", + "title": "ID", + "description": "The identifier of the issue assigned by the source of the issue" + }, + "name": { + "type": "string", + "title": "Name", + "description": "The name of the issue" + }, + "description": { + "type": "string", + "title": "Description", + "description": "A description of the issue" + }, + "source": { + "type": "object", + "title": "Source", + "description": "The source of the issue where it is documented", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "The name of the source. For example 'National Vulnerability Database', 'NVD', and 'Apache'" + }, + "url": { + "type": "string", + "title": "URL", + "description": "The url of the issue documentation as provided by the source", + "format": "iri-reference" + } + } + }, + "references": { + "type": "array", + "items": { + "type": "string", + "format": "iri-reference" + }, + "title": "References", + "description": "A collection of URL's for reference. Multiple URLs are allowed.", + "examples": ["https://example.com"] + } + } + }, + "identifiableAction": { + "type": "object", + "title": "Identifiable Action", + "description": "Specifies an individual commit", + "properties": { + "timestamp": { + "type": "string", + "format": "date-time", + "title": "Timestamp", + "description": "The timestamp in which the action occurred" + }, + "name": { + "type": "string", + "title": "Name", + "description": "The name of the individual who performed the action" + }, + "email": { + "type": "string", + "format": "idn-email", + "title": "E-mail", + "description": "The email address of the individual who performed the action" + } + } + }, + "externalReference": { + "type": "object", + "title": "External Reference", + "description": "Specifies an individual external reference", + "required": [ + "url", + "type" + ], + "properties": { + "url": { + "type": "string", + "title": "URL", + "description": "The URL to the external reference", + "format": "iri-reference" + }, + "comment": { + "type": "string", + "title": "Comment", + "description": "An optional comment describing the external reference" + }, + "type": { + "type": "string", + "title": "Type", + "description": "Specifies the type of external reference. There are built-in types to describe common references. If a type does not exist for the reference being referred to, use the \"other\" type.", + "enum": [ + "vcs", + "issue-tracker", + "website", + "advisories", + "bom", + "mailing-list", + "social", + "chat", + "documentation", + "support", + "distribution", + "license", + "build-meta", + "build-system", + "other" + ] + }, + "hashes": { + "$id": "#/properties/hashes", + "type": "array", + "items": {"$ref": "#/definitions/hash"}, + "title": "Hashes", + "description": "The hashes of the external reference (if applicable)." + } + } + }, + "dependency": { + "type": "object", + "title": "Dependency", + "description": "Defines the direct dependencies of a component. Components that do not have their own dependencies MUST be declared as empty elements within the graph. Components that are not represented in the dependency graph MAY have unknown dependencies. It is RECOMMENDED that implementations assume this to be opaque and not an indicator of a component being dependency-free.", + "required": [ + "ref" + ], + "properties": { + "ref": { + "type": "string", + "title": "Reference", + "description": "References a component by the components bom-ref attribute" + }, + "dependsOn": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "title": "Depends On", + "description": "The bom-ref identifiers of the components that are dependencies of this dependency object." + } + } + }, + "service": { + "type": "object", + "title": "Service Object", + "required": [ + "name" + ], + "properties": { + "bom-ref": { + "type": "string", + "title": "BOM Reference", + "description": "An optional identifier which can be used to reference the service elsewhere in the BOM. Every bom-ref should be unique." + }, + "provider": { + "title": "Provider", + "description": "The organization that provides the service.", + "$ref": "#/definitions/organizationalEntity" + }, + "group": { + "type": "string", + "title": "Service Group", + "description": "The grouping name, namespace, or identifier. This will often be a shortened, single name of the company or project that produced the service or domain name. Whitespace and special characters should be avoided.", + "examples": ["com.acme"] + }, + "name": { + "type": "string", + "title": "Service Name", + "description": "The name of the service. This will often be a shortened, single name of the service.", + "examples": ["ticker-service"] + }, + "version": { + "type": "string", + "title": "Service Version", + "description": "The service version.", + "examples": ["1.0.0"] + }, + "description": { + "type": "string", + "title": "Service Description", + "description": "Specifies a description for the service" + }, + "endpoints": { + "type": "array", + "items": { + "type": "string", + "format": "iri-reference" + }, + "title": "Endpoints", + "description": "The endpoint URIs of the service. Multiple endpoints are allowed.", + "examples": ["https://example.com/api/v1/ticker"] + }, + "authenticated": { + "type": "boolean", + "title": "Authentication Required", + "description": "A boolean value indicating if the service requires authentication. A value of true indicates the service requires authentication prior to use. A value of false indicates the service does not require authentication." + }, + "x-trust-boundary": { + "type": "boolean", + "title": "Crosses Trust Boundary", + "description": "A boolean value indicating if use of the service crosses a trust zone or boundary. A value of true indicates that by using the service, a trust boundary is crossed. A value of false indicates that by using the service, a trust boundary is not crossed." + }, + "data": { + "type": "array", + "items": {"$ref": "#/definitions/dataClassification"}, + "title": "Data Classification", + "description": "Specifies the data classification." + }, + "licenses": { + "type": "array", + "items": {"$ref": "#/definitions/licenseChoice"}, + "title": "Component License(s)" + }, + "externalReferences": { + "type": "array", + "items": {"$ref": "#/definitions/externalReference"}, + "title": "External References" + }, + "services": { + "$id": "#/properties/services", + "type": "array", + "items": {"$ref": "#/definitions/service"}, + "uniqueItems": true, + "title": "Services" + }, + "properties": { + "type": "array", + "title": "Properties", + "description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values.", + "items": {"$ref": "#/definitions/property"} + } + } + }, + "dataClassification": { + "type": "object", + "title": "Hash Objects", + "required": [ + "flow", + "classification" + ], + "properties": { + "flow": { + "$ref": "#/definitions/dataFlow" + }, + "classification": { + "type": "string" + } + } + }, + "dataFlow": { + "type": "string", + "enum": [ + "inbound", + "outbound", + "bi-directional", + "unknown" + ], + "title": "Data flow direction" + }, + + "copyright": { + "type": "object", + "title": "Copyright", + "required": [ + "text" + ], + "properties": { + "text": { + "type": "string", + "title": "Copyright Text" + } + } + }, + + "componentEvidence": { + "type": "object", + "title": "Evidence", + "description": "Provides the ability to document evidence collected through various forms of extraction or analysis.", + "properties": { + "licenses": { + "type": "array", + "items": {"$ref": "#/definitions/licenseChoice"}, + "title": "Component License(s)" + }, + "copyright": { + "type": "array", + "items": {"$ref": "#/definitions/copyright"}, + "title": "Copyright" + } + } + }, + "compositions": { + "type": "object", + "title": "Compositions", + "required": [ + "aggregate" + ], + "properties": { + "aggregate": { + "$ref": "#/definitions/aggregateType", + "title": "Aggregate", + "description": "Specifies an aggregate type that describe how complete a relationship is." + }, + "assemblies": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "title": "BOM references", + "description": "The bom-ref identifiers of the components or services being described. Assemblies refer to nested relationships whereby a constituent part may include other constituent parts. References do not cascade to child parts. References are explicit for the specified constituent part only." + }, + "dependencies": { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string" + }, + "title": "BOM references", + "description": "The bom-ref identifiers of the components or services being described. Dependencies refer to a relationship whereby an independent constituent part requires another independent constituent part. References do not cascade to transitive dependencies. References are explicit for the specified dependency only." + } + } + }, + "aggregateType": { + "type": "string", + "default": "not_specified", + "enum": [ + "complete", + "incomplete", + "incomplete_first_party_only", + "incomplete_third_party_only", + "unknown", + "not_specified" + ] + }, + "property": { + "type": "object", + "title": "Lightweight name-value pair", + "properties": { + "name": { + "type": "string", + "title": "Name", + "description": "The name of the property. Duplicate names are allowed, each potentially having a different value." + }, + "value": { + "type": "string", + "title": "Value", + "description": "The value of the property." + } + } + } + } +} diff --git a/schema/cyclonedx/cyclonedx.xsd b/schema/cyclonedx/cyclonedx.xsd index 795b0f820..968d03e37 100644 --- a/schema/cyclonedx/cyclonedx.xsd +++ b/schema/cyclonedx/cyclonedx.xsd @@ -16,13 +16,13 @@ limitations under the License. --> + version="1.3"> @@ -32,9 +32,6 @@ limitations under the License. https://cyclonedx.org/ Apache License, Version 2.0 - - Steve Springett - @@ -71,15 +68,23 @@ limitations under the License. The component that the BOM describes. - + The organization that manufactured the component that the BOM describes. - + The organization that supplied the component that the BOM describes. The - supplier may often be the manufacture, but may also be a distributor or repackager. + supplier may often be the manufacturer, but may also be a distributor or repackager. + + + + + + Provides the ability to document properties in a key/value store. + This provides flexibility to include data not officially supported in the standard + without having to use additional namespaces or create extensions. @@ -181,14 +186,14 @@ limitations under the License. The name of the contact - + - The email address of the contact. Multiple email addresses are allowed. + The email address of the contact. - + - The phone number of the contact. Multiple phone numbers are allowed. + The phone number of the contact. @@ -231,7 +236,7 @@ limitations under the License. The organization that supplied the component. The supplier may often - be the manufacture, but may also be a distributor or repackager. + be the manufacturer, but may also be a distributor or repackager. @@ -282,19 +287,7 @@ limitations under the License. - - - - - - - A valid SPDX license expression. - Refer to https://spdx.org/specifications for syntax requirements - - - - - + An optional copyright notice informing users of the underlying claims to @@ -349,6 +342,13 @@ limitations under the License. component or to the project the component describes. + + + Provides the ability to document properties in a key/value store. + This provides flexibility to include data not officially supported in the standard + without having to use additional namespaces or create extensions. + + @@ -370,6 +370,11 @@ limitations under the License. + + + Provides the ability to document evidence collected through various forms of extraction or analysis. + + @@ -512,45 +517,45 @@ limitations under the License. - - A software application. Refer to https://en.wikipedia.org/wiki/Application_software + + A software application. Refer to https://en.wikipedia.org/wiki/Application_software for information about applications. - + A software framework. Refer to https://en.wikipedia.org/wiki/Software_framework - for information on how frameworks vary slightly from libraries. + for information on how frameworks vary slightly from libraries. A software library. Refer to https://en.wikipedia.org/wiki/Library_(computing) - for information about libraries. All third-party and open source reusable components will likely - be a library. If the library also has key features of a framework, then it should be classified - as a framework. If not, or is unknown, then specifying library is recommended. + for information about libraries. All third-party and open source reusable components will likely + be a library. If the library also has key features of a framework, then it should be classified + as a framework. If not, or is unknown, then specifying library is recommended. A packaging and/or runtime format, not specific to any particular technology, - which isolates software inside the container from software outside of a container through - virtualization technology. Refer to https://en.wikipedia.org/wiki/OS-level_virtualization + which isolates software inside the container from software outside of a container through + virtualization technology. Refer to https://en.wikipedia.org/wiki/OS-level_virtualization A software operating system without regard to deployment model - (i.e. installed on physical hardware, virtual machine, image, etc) Refer to - https://en.wikipedia.org/wiki/Operating_system + (i.e. installed on physical hardware, virtual machine, image, etc) Refer to + https://en.wikipedia.org/wiki/Operating_system A hardware device such as a processor, or chip-set. A hardware device - containing firmware should include a component for the physical hardware itself, and another - component of type 'firmware' or 'operating-system' (whichever is relevant), describing - information about the software running on the device. + containing firmware should include a component for the physical hardware itself, and another + component of type 'firmware' or 'operating-system' (whichever is relevant), describing + information about the software running on the device. @@ -562,7 +567,7 @@ limitations under the License. A computer file. Refer to https://en.wikipedia.org/wiki/Computer_file - for information about files. + for information about files. @@ -782,6 +787,13 @@ limitations under the License. An optional comment describing the external reference + + + + + + + @@ -927,7 +939,7 @@ limitations under the License. A patch which takes code from a newer version of software and applies - it to older versions of the same software. Refer to https://en.wikipedia.org/wiki/Backporting + it to older versions of the same software. Refer to https://en.wikipedia.org/wiki/Backporting @@ -1255,24 +1267,19 @@ limitations under the License. - - - - - - - A valid SPDX license expression. - Refer to https://spdx.org/specifications for syntax requirements - - - - - + Provides the ability to document external references related to the service. + + + Provides the ability to document properties in a key/value store. + This provides flexibility to include data not officially supported in the standard + without having to use additional namespaces or create extensions. + + @@ -1349,6 +1356,199 @@ limitations under the License. + + + + + + A valid SPDX license expression. + Refer to https://spdx.org/specifications for syntax requirements + + + + + + + + + + + + + + + + + + + Allows any undeclared elements as long as the elements are placed in a different namespace. + + + + + + + User-defined attributes may be used on this element as long as they + do not have the same name as an existing attribute used by the schema. + + + + + + + + + + + Allows any undeclared elements as long as the elements are placed in a different namespace. + + + + + + + User-defined attributes may be used on this element as long as they + do not have the same name as an existing attribute used by the schema. + + + + + + + + + Specifies an aggregate type that describe how complete a relationship is. + + + + + + The bom-ref identifiers of the components or services being described. Assemblies refer to + nested relationships whereby a constituent part may include other constituent parts. References + do not cascade to child parts. References are explicit for the specified constituent part only. + + + + + + + + + Allows any undeclared elements as long as the elements are placed in a different namespace. + + + + + + + + + + The bom-ref identifiers of the components or services being described. Dependencies refer to a + relationship whereby an independent constituent part requires another independent constituent + part. References do not cascade to transitive dependencies. References are explicit for the + specified dependency only. + + + + + + + + + Allows any undeclared elements as long as the elements are placed in a different namespace. + + + + + + + + + + + + + + The relationship is complete. No further relationships including constituent components, services, or dependencies exist. + + + + + The relationship is incomplete. Additional relationships exist and may include constituent components, services, or dependencies. + + + + + The relationship is incomplete. Only relationships for first-party components, services, or their dependencies are represented. + + + + + The relationship is incomplete. Only relationships for third-party components, services, or their dependencies are represented. + + + + + The relationship may be complete or incomplete. This usually signifies a 'best-effort' to obtain constituent components, services, or dependencies but the completeness is inconclusive. + + + + + The relationship completeness is not specified. + + + + + + + + + References a component or service by the its bom-ref attribute + + + + + User-defined attributes may be used on this element as long as they + do not have the same name as an existing attribute used by the schema. + + + + + + + + + + + Allows any undeclared elements as long as the elements are placed in a different namespace. + + + + + + + User-defined attributes may be used on this element as long as they + do not have the same name as an existing attribute used by the schema. + + + + + + + Specifies an individual property with a name and value. + + + + + + The name of the property. Duplicate names are allowed, each potentially having a different value. + + + + + + @@ -1378,6 +1578,19 @@ limitations under the License. Provides the ability to document dependency relationships. + + + Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. + + + + + Provides the ability to document properties in a name-value store. + This provides flexibility to include data not officially supported in the standard + without having to use additional namespaces or create extensions. Unlike key-value + stores, properties support duplicate names, each potentially having different values. + + diff --git a/schema/cyclonedx/spdx.xsd b/schema/cyclonedx/spdx.xsd index dbd61b161..b45e2de06 100644 --- a/schema/cyclonedx/spdx.xsd +++ b/schema/cyclonedx/spdx.xsd @@ -2,14 +2,14 @@ + version="1.0-3.12"> - + - BSD Zero Clause License + Academic Free License v2.0 @@ -17,29 +17,9 @@ Attribution Assurance License - + - Amazon Digital Services License - - - - - Academic Free License v1.1 - - - - - Academic Free License v1.2 - - - - - Academic Free License v2.0 - - - - - Academic Free License v2.1 + Adobe Systems Incorporated Source Code License Agreement @@ -47,14 +27,24 @@ Academic Free License v3.0 - + - Affero General Public License v1.0 + Amazon Digital Services License - + - Affero General Public License v1.0 only + BSD Zero Clause License + + + + + Afmparse License + + + + + Academic Free License v1.2 @@ -62,19 +52,24 @@ Affero General Public License v1.0 or later - + - GNU Affero General Public License v3.0 + Academic Free License v2.1 - + - GNU Affero General Public License v3.0 only + Academic Free License v1.1 - + - GNU Affero General Public License v3.0 or later + Affero General Public License v1.0 + + + + + Adobe Glyph List License @@ -82,14 +77,9 @@ AMD's plpa_map.c License - + - Apple MIT License - - - - - Academy of Motion Picture Arts and Sciences BSD + Aladdin Free Public License @@ -97,16 +87,36 @@ ANTLR Software Rights Notice + + + Apple MIT License + + + + + Apache License 1.0 + + + + + ANTLR Software Rights Notice with license fallback + + + + + Abstyles License + + + + + Affero General Public License v1.0 only + + Adobe Postscript AFM License - - - Adaptive Public License 1.0 - - Apple Public Source License 1.0 @@ -117,44 +127,14 @@ Apple Public Source License 1.1 - - - Apple Public Source License 1.2 - - Apple Public Source License 2.0 - + - Abstyles License - - - - - Adobe Systems Incorporated Source Code License Agreement - - - - - Adobe Glyph List License - - - - - Afmparse License - - - - - Aladdin Free Public License - - - - - Apache License 1.0 + GNU Affero General Public License v3.0 only @@ -167,119 +147,9 @@ Apache License 2.0 - + - Artistic License 1.0 - - - - - Artistic License 1.0 (Perl) - - - - - Artistic License 1.0 w/clause 8 - - - - - Artistic License 2.0 - - - - - BSD 1-Clause License - - - - - BSD 2-Clause "Simplified" License - - - - - BSD 2-Clause FreeBSD License - - - - - BSD 2-Clause NetBSD License - - - - - BSD-2-Clause Plus Patent License - - - - - BSD 2-Clause with views sentence - - - - - BSD 3-Clause "New" or "Revised" License - - - - - BSD with attribution - - - - - BSD 3-Clause Clear License - - - - - Lawrence Berkeley National Labs BSD variant license - - - - - BSD 3-Clause No Nuclear License - - - - - BSD 3-Clause No Nuclear License 2014 - - - - - BSD 3-Clause No Nuclear Warranty - - - - - BSD 3-Clause Open MPI variant - - - - - BSD 4-Clause "Original" or "Old" License - - - - - BSD-4-Clause (University of California-Specific) - - - - - BSD Protection License - - - - - BSD Source Code Attribution - - - - - Boost Software License 1.0 + Adaptive Public License 1.0 @@ -287,24 +157,24 @@ Bahyph License + + + Artistic License 1.0 + + + + + Academy of Motion Picture Arts and Sciences BSD + + Barr License - + - Beerware License - - - - - BitTorrent Open Source License v1.0 - - - - - BitTorrent Open Source License v1.1 + GNU Affero General Public License v3.0 or later @@ -312,14 +182,144 @@ Blue Oak Model License 1.0.0 + + + Beerware License + + + + + Artistic License 1.0 w/clause 8 + + + + + SQLite Blessing + + Borceux license - + - Cryptographic Autonomy License 1.0 + BSD 2-Clause NetBSD License + + + + + BSD 1-Clause License + + + + + BSD-2-Clause Plus Patent License + + + + + BitTorrent Open Source License v1.0 + + + + + BSD 2-Clause FreeBSD License + + + + + BSD with attribution + + + + + BSD 2-Clause "Simplified" License + + + + + Apple Public Source License 1.2 + + + + + Lawrence Berkeley National Labs BSD variant license + + + + + Artistic License 2.0 + + + + + BSD 3-Clause No Nuclear License 2014 + + + + + BSD 3-Clause Modification + + + + + BSD 4 Clause Shortened + + + + + BSD 3-Clause "New" or "Revised" License + + + + + BSD 3-Clause Open MPI variant + + + + + BitTorrent Open Source License v1.1 + + + + + BSD 3-Clause No Nuclear Warranty + + + + + BSD Source Code Attribution + + + + + BSD Protection License + + + + + GNU Affero General Public License v3.0 + + + + + Business Source License 1.1 + + + + + Artistic License 1.0 (Perl) + + + + + Boost Software License 1.0 + + + + + BSD 2-Clause with views sentence @@ -332,14 +332,14 @@ Computer Associates Trusted Open Source License 1.1 - + - Creative Commons Attribution 1.0 Generic + bzip2 and libbzip2 License v1.0.5 - + - Creative Commons Attribution 2.0 Generic + bzip2 and libbzip2 License v1.0.6 @@ -347,19 +347,24 @@ Creative Commons Attribution 2.5 Generic - - - Creative Commons Attribution 3.0 Unported - - Creative Commons Attribution 3.0 Austria - + - Creative Commons Attribution 4.0 International + Computational Use of Data Agreement v1.0 + + + + + Creative Commons Attribution 3.0 United States + + + + + Creative Commons Attribution 1.0 Generic @@ -377,9 +382,9 @@ Creative Commons Attribution Non Commercial 2.5 Generic - + - Creative Commons Attribution Non Commercial 3.0 Unported + Creative Commons Attribution 2.0 Generic @@ -397,14 +402,9 @@ Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic - + - Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic - - - - - Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported + Creative Commons Attribution Non Commercial 3.0 Unported @@ -412,16 +412,21 @@ Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO + + + Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported + + + + + BSD 3-Clause No Nuclear License + + Creative Commons Attribution Non Commercial No Derivatives 4.0 International - - - Creative Commons Attribution Non Commercial Share Alike 1.0 Generic - - Creative Commons Attribution Non Commercial Share Alike 2.0 Generic @@ -447,9 +452,9 @@ Creative Commons Attribution No Derivatives 1.0 Generic - + - Creative Commons Attribution No Derivatives 2.0 Generic + BSD 3-Clause Clear License @@ -472,19 +477,24 @@ Creative Commons Attribution Share Alike 1.0 Generic + + + Creative Commons Attribution Share Alike 2.0 England and Wales + + Creative Commons Attribution Share Alike 2.0 Generic - + - Creative Commons Attribution Share Alike 2.5 Generic + Creative Commons Attribution Share Alike 2.1 Japan - + - Creative Commons Attribution Share Alike 3.0 Unported + Creative Commons Attribution No Derivatives 2.0 Generic @@ -492,19 +502,24 @@ Creative Commons Attribution-Share Alike 3.0 Austria + + + Creative Commons Attribution Share Alike 3.0 Unported + + Creative Commons Attribution Share Alike 4.0 International - + - Creative Commons Public Domain Dedication and Certification + Creative Commons Attribution Share Alike 2.5 Generic - + - Creative Commons Zero v1.0 Universal + Creative Commons Attribution 3.0 Unported @@ -512,9 +527,24 @@ Common Development and Distribution License 1.0 - + - Common Development and Distribution License 1.1 + Creative Commons Zero v1.0 Universal + + + + + Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic + + + + + Creative Commons Attribution Non Commercial Share Alike 1.0 Generic + + + + + Caldera License @@ -522,44 +552,34 @@ Community Data License Agreement Permissive 1.0 - + - Community Data License Agreement Sharing 1.0 + Creative Commons Attribution 4.0 International - + - CeCILL Free Software License Agreement v1.0 + Creative Commons Public Domain Dedication and Certification - + - CeCILL Free Software License Agreement v1.1 + BSD-4-Clause (University of California-Specific) - + - CeCILL Free Software License Agreement v2.0 + BSD 4-Clause "Original" or "Old" License - + - CeCILL Free Software License Agreement v2.1 + Cryptographic Autonomy License 1.0 - + - CeCILL-B Free Software License Agreement - - - - - CeCILL-C Free Software License Agreement - - - - - CERN Open Hardware Licence v1.1 + Common Development and Distribution License 1.1 @@ -567,6 +587,11 @@ CERN Open Hardware Licence v1.2 + + + CERN Open Hardware Licence v1.1 + + CERN Open Hardware Licence Version 2 - Permissive @@ -577,14 +602,19 @@ CERN Open Hardware Licence Version 2 - Strongly Reciprocal - + - CERN Open Hardware Licence Version 2 - Weakly Reciprocal + CeCILL Free Software License Agreement v1.1 - + - CNRI Jython License + CeCILL Free Software License Agreement v2.0 + + + + + CeCILL Free Software License Agreement v1.0 @@ -597,59 +627,69 @@ CNRI Python Open Source GPL Compatible License Agreement + + + copyleft-next 0.3.0 + + Common Public Attribution License 1.0 + + + copyleft-next 0.3.1 + + Common Public License 1.0 - - - Code Project Open License 1.02 - - - - - CUA Office Public License v1.0 - - - - - Caldera License - - Clarified Artistic License + + + CeCILL-C Free Software License Agreement + + + + + CNRI Jython License + + Condor Public License v1.1 + + + Code Project Open License 1.02 + + + + + curl License + + + + + diffmark license + + Crossword License - + - CrystalStacker License - - - - - Cube License - - - - - Deutsche Freie Software Lizenz + Dotseqn License @@ -662,9 +702,9 @@ DSDP License - + - Dotseqn License + Detection Rule License 1.0 @@ -677,14 +717,29 @@ Educational Community License v2.0 - + - Eiffel Forum License v1.0 + eCos license version 2.0 - + - Eiffel Forum License v2.0 + CrystalStacker License + + + + + CERN Open Hardware Licence Version 2 - Weakly Reciprocal + + + + + Deutsche Freie Software Lizenz + + + + + eGenix.com Public License 1.1.0 @@ -692,19 +747,29 @@ EPICS Open License + + + Entessa Public License v1.0 + + Eclipse Public License 1.0 - + - Eclipse Public License 2.0 + Eiffel Forum License v2.0 - + - EU DataGrid Software License + CUA Office Public License v1.0 + + + + + Etalab Open License 2.0 @@ -712,24 +777,34 @@ European Union Public License 1.0 + + + Erlang Public License v1.1 + + + + + EU DataGrid Software License + + European Union Public License 1.1 - + - European Union Public License 1.2 + Cube License - + - Entessa Public License v1.0 + dvipdfm License - + - Erlang Public License v1.1 + FreeBSD Documentation License @@ -742,9 +817,9 @@ FSF All Permissive License - + - FSF Unlimited License + FreeImage Public License v1.0 @@ -752,29 +827,14 @@ FSF Unlimited License (with License Retention) - + - Freetype Project License + FSF Unlimited License - + - Fair License - - - - - Frameworx Open License 1.0 - - - - - FreeImage Public License v1.0 - - - - - GNU Free Documentation License v1.1 + GD License @@ -782,14 +842,14 @@ GNU Free Documentation License v1.1 only - invariants - + - GNU Free Documentation License v1.1 or later - invariants + European Union Public License 1.2 - + - GNU Free Documentation License v1.1 only - no invariants + Eclipse Public License 2.0 @@ -807,14 +867,14 @@ GNU Free Documentation License v1.1 or later - + - GNU Free Documentation License v1.2 + GNU Free Documentation License v1.1 - + - GNU Free Documentation License v1.2 only - invariants + Freetype Project License @@ -822,14 +882,14 @@ GNU Free Documentation License v1.2 or later - invariants - + - GNU Free Documentation License v1.2 only - no invariants + GNU Free Documentation License v1.1 or later - invariants - + - GNU Free Documentation License v1.2 or later - no invariants + GNU Free Documentation License v1.2 only - invariants @@ -842,9 +902,14 @@ GNU Free Documentation License v1.2 or later - + - GNU Free Documentation License v1.3 + GNU Free Documentation License v1.2 + + + + + GNU Free Documentation License v1.2 only - no invariants @@ -852,29 +917,39 @@ GNU Free Documentation License v1.3 only - invariants - - - GNU Free Documentation License v1.3 or later - invariants - - GNU Free Documentation License v1.3 only - no invariants - + - GNU Free Documentation License v1.3 or later - no invariants + GNU Free Documentation License v1.3 or later - invariants - + - GNU Free Documentation License v1.3 only + GNU Free Documentation License v1.2 or later - no invariants - + - GNU Free Documentation License v1.3 or later + Fair License + + + + + Frameworx Open License 1.0 + + + + + Giftware License + + + + + GNU Free Documentation License v1.1 only - no invariants @@ -882,21 +957,26 @@ GL2PS License + + + Glulxe License + + + + + 3dfx Glide License + + + + + gnuplot License + + Good Luck With That Public License - - - GNU General Public License v1.0 only - - - - - GNU General Public License v1.0 or later - - GNU General Public License v1.0 only @@ -907,14 +987,14 @@ GNU General Public License v1.0 or later - + - GNU General Public License v2.0 only + GNU General Public License v1.0 only - + - GNU General Public License v2.0 or later + GNU Free Documentation License v1.3 only @@ -927,19 +1007,29 @@ GNU General Public License v2.0 or later - - - GNU General Public License v2.0 w/GCC Runtime Library exception - - GNU General Public License v2.0 w/Autoconf exception - + - GNU General Public License v2.0 w/Bison exception + GNU General Public License v2.0 or later + + + + + GNU Free Documentation License v1.3 + + + + + GNU General Public License v1.0 or later + + + + + Community Data License Agreement Sharing 1.0 @@ -947,11 +1037,31 @@ GNU General Public License v2.0 w/Classpath exception + + + GNU General Public License v2.0 w/GCC Runtime Library exception + + + + + GNU General Public License v2.0 w/Bison exception + + GNU General Public License v2.0 w/Font exception + + + GNU General Public License v2.0 only + + + + + CeCILL Free Software License Agreement v2.1 + + GNU General Public License v3.0 only @@ -962,54 +1072,14 @@ GNU General Public License v3.0 or later - - - GNU General Public License v3.0 only - - - - - GNU General Public License v3.0 or later - - - - - GNU General Public License v3.0 w/GCC Runtime Library exception - - GNU General Public License v3.0 w/Autoconf exception - + - Giftware License - - - - - 3dfx Glide License - - - - - Glulxe License - - - - - Historical Permission Notice and Disclaimer - - - - - Historical Permission Notice and Disclaimer - sell variant - - - - - Haskell Language Report License + GNU General Public License v3.0 only @@ -1017,9 +1087,29 @@ Hippocratic License 2.1 - + - IBM PowerPC Initialization and Boot Software + Historical Permission Notice and Disclaimer + + + + + HTML Tidy License + + + + + GNU General Public License v3.0 w/GCC Runtime Library exception + + + + + Haskell Language Report License + + + + + GNU General Public License v3.0 or later @@ -1027,44 +1117,19 @@ ICU License - - - Independent JPEG Group License - - - - - IPA Font License - - - - - IBM Public License v1.0 - - - - - ISC License - - ImageMagick License - + - Imlib2 License + iMatix Standard Function Library Agreement - + - Info-ZIP License - - - - - Intel Open Source License + IBM PowerPC Initialization and Boot Software @@ -1072,9 +1137,34 @@ Intel ACPI Software License Agreement - + - Interbase Public License v1.0 + Intel Open Source License + + + + + Info-ZIP License + + + + + IPA Font License + + + + + Independent JPEG Group License + + + + + ISC License + + + + + JasPer License @@ -1087,11 +1177,6 @@ JSON License - - - JasPer License - - Licence Art Libre 1.2 @@ -1102,106 +1187,6 @@ Licence Art Libre 1.3 - - - GNU Library General Public License v2 only - - - - - GNU Library General Public License v2 or later - - - - - GNU Library General Public License v2 only - - - - - GNU Library General Public License v2 or later - - - - - GNU Lesser General Public License v2.1 only - - - - - GNU Library General Public License v2.1 or later - - - - - GNU Lesser General Public License v2.1 only - - - - - GNU Lesser General Public License v2.1 or later - - - - - GNU Lesser General Public License v3.0 only - - - - - GNU Lesser General Public License v3.0 or later - - - - - GNU Lesser General Public License v3.0 only - - - - - GNU Lesser General Public License v3.0 or later - - - - - Lesser General Public License For Linguistic Resources - - - - - Lucent Public License Version 1.0 - - - - - Lucent Public License v1.02 - - - - - LaTeX Project Public License v1.0 - - - - - LaTeX Project Public License v1.1 - - - - - LaTeX Project Public License v1.2 - - - - - LaTeX Project Public License v1.3a - - - - - LaTeX Project Public License v1.3c - - Latex2e License @@ -1212,19 +1197,74 @@ Leptonica License - + - Licence Libre du Québec – Permissive version 1.1 + Historical Permission Notice and Disclaimer - sell variant - + - Licence Libre du Québec – Réciprocité version 1.1 + GNU Library General Public License v2 only - + - Licence Libre du Québec – Réciprocité forte version 1.1 + GNU Library General Public License v2 or later + + + + + Imlib2 License + + + + + IBM Public License v1.0 + + + + + GNU Lesser General Public License v2.1 only + + + + + GNU Lesser General Public License v2.1 or later + + + + + GNU Library General Public License v2 or later + + + + + GNU Library General Public License v2 only + + + + + CeCILL-B Free Software License Agreement + + + + + GNU Lesser General Public License v3.0 or later + + + + + GNU Lesser General Public License v3.0 only + + + + + Lesser General Public License For Linguistic Resources + + + + + PNG Reference Library version 2 @@ -1232,19 +1272,94 @@ libpng License + + + libselinux public domain notice + + + + + GNU Lesser General Public License v3.0 or later + + + + + Eiffel Forum License v1.0 + + + + + libtiff License + + + + + GNU Free Documentation License v1.3 or later - no invariants + + + + + Licence Libre du Québec – Réciprocité forte version 1.1 + + + + + Licence Libre du Québec – Réciprocité version 1.1 + + + + + Lucent Public License Version 1.0 + + + + + Licence Libre du Québec – Permissive version 1.1 + + Linux Kernel Variant of OpenIB.org license - + - MIT License + LaTeX Project Public License v1.0 - + - MIT No Attribution + LaTeX Project Public License v1.2 + + + + + LaTeX Project Public License v1.3a + + + + + Lucent Public License v1.02 + + + + + LaTeX Project Public License v1.3c + + + + + MakeIndex License + + + + + GNU Library General Public License v2.1 or later + + + + + LaTeX Project Public License v1.1 @@ -1252,16 +1367,36 @@ CMU License + + + The MirOS Licence + + Enlightenment License (e16) + + + MIT License Modern Variant + + + + + MIT License + + enna License + + + MIT Open Group variant + + feh License @@ -1277,9 +1412,9 @@ Mozilla Public License 1.0 - + - Mozilla Public License 1.1 + mpich2 License @@ -1292,11 +1427,6 @@ Mozilla Public License 2.0 (no copyleft exception) - - - Microsoft Public License - - Microsoft Reciprocal License @@ -1307,24 +1437,9 @@ Matrix Template Library License - + - MakeIndex License - - - - - The MirOS Licence - - - - - Motosoto License - - - - - Mulan Permissive Software License, Version 1 + Mozilla Public License 1.1 @@ -1332,9 +1447,9 @@ Mulan Permissive Software License, Version 2 - + - Multics License + Motosoto License @@ -1342,9 +1457,24 @@ Mup License - + - NASA Open Source Agreement 1.3 + Mulan Permissive Software License, Version 1 + + + + + Nara Institute of Science and Technology License (2003) + + + + + Naumen Public License + + + + + Multics License @@ -1352,81 +1482,11 @@ Net Boolean Public License v1 - - - Non-Commercial Government Licence - - University of Illinois/NCSA Open Source License - - - Nethack General Public License - - - - - NIST Public Domain Notice - - - - - NIST Public Domain Notice with license fallback - - - - - Norwegian Licence for Open Government Data - - - - - No Limit Public License - - - - - Netizen Open Source License - - - - - Netscape Public License v1.0 - - - - - Netscape Public License v1.1 - - - - - Non-Profit Open Software License 3.0 - - - - - NRL License - - - - - NTP License - - - - - NTP No Attribution - - - - - Naumen Public License - - Net-SNMP License @@ -1437,21 +1497,86 @@ NetCDF license + + + NASA Open Source Agreement 1.3 + + + + + Nethack General Public License + + + + + NIST Public Domain Notice with license fallback + + + + + NIST Public Domain Notice + + Newsletr License + + + No Limit Public License + + Nokia Open Source License + + + Netizen Open Source License + + Noweb License + + + Norwegian Licence for Open Government Data + + + + + Netscape Public License v1.0 + + + + + Non-Commercial Government Licence + + + + + NRL License + + + + + NTP No Attribution + + + + + NTP License + + + + + GNU Free Documentation License v1.3 or later + + Nunit License @@ -1462,29 +1587,29 @@ Open Use of Data Agreement v1.0 + + + Netscape Public License v1.1 + + Open CASCADE Technology Public License - - - OCLC Research Public License 2.0 - - Open Data Commons Attribution License v1.0 - + - ODC Open Database License v1.0 + SIL Open Font License 1.0 with no Reserved Font Name - + - SIL Open Font License 1.0 + OCLC Research Public License 2.0 @@ -1492,19 +1617,9 @@ SIL Open Font License 1.0 with Reserved Font Name - + - SIL Open Font License 1.0 with no Reserved Font Name - - - - - SIL Open Font License 1.1 - - - - - SIL Open Font License 1.1 with Reserved Font Name + SIL Open Font License 1.0 @@ -1512,16 +1627,26 @@ SIL Open Font License 1.1 with no Reserved Font Name + + + SIL Open Font License 1.1 with Reserved Font Name + + + + + SIL Open Font License 1.1 + + + + + Taiwan Open Government Data License, version 1.0 + + OGC Software License, Version 1.0 - - - Open Government Licence - Canada - - Open Government Licence v1.0 @@ -1557,14 +1682,9 @@ Open LDAP Public License v1.3 - + - Open LDAP Public License v1.4 - - - - - Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B) + Open Government Licence - Canada @@ -1572,16 +1692,16 @@ Open LDAP Public License v2.0.1 + + + Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B) + + Open LDAP Public License v2.1 - - - Open LDAP Public License v2.2 - - Open LDAP Public License v2.2.1 @@ -1592,9 +1712,14 @@ Open LDAP Public License 2.2.2 - + - Open LDAP Public License v2.3 + Open LDAP Public License v2.2 + + + + + Open Data Commons Open Database License v1.0 @@ -1602,14 +1727,14 @@ Open LDAP Public License v2.4 - + - Open LDAP Public License v2.5 + Open LDAP Public License v1.4 - + - Open LDAP Public License v2.6 + Open LDAP Public License v2.3 @@ -1627,16 +1752,21 @@ Open Market License + + + OpenSSL License + + + + + Open LDAP Public License v2.6 + + Open Public License v1.0 - - - OSET Public License version 2.1 - - Open Software License 1.0 @@ -1652,41 +1782,16 @@ Open Software License 2.0 + + + OSET Public License version 2.1 + + Open Software License 2.1 - - - Open Software License 3.0 - - - - - OpenSSL License - - - - - ODC Public Domain Dedication & License 1.0 - - - - - PHP License v3.0 - - - - - PHP License v3.01 - - - - - Python Software Foundation License 2.0 - - The Parity Public License 6.0.0 @@ -1697,14 +1802,29 @@ The Parity Public License 7.0.0 + + + Open Data Commons Public Domain Dedication & License 1.0 + + + + + PHP License v3.0 + + + + + Open Software License 3.0 + + Plexus Classworlds License - + - PolyForm Noncommercial License 1.0.0 + Microsoft Public License @@ -1712,19 +1832,29 @@ PolyForm Small Business License 1.0.0 + + + PolyForm Noncommercial License 1.0.0 + + + + + Python Software Foundation License 2.0 + + + + + psfrag License + + PostgreSQL License - + - Python License 2.0 - - - - - Q Public License 1.0 + psutils License @@ -1732,9 +1862,19 @@ Qhull License - + - Red Hat eCos Public License v1.1 + Q Public License 1.0 + + + + + Rdisc License + + + + + Python License 2.0 @@ -1747,9 +1887,9 @@ Reciprocal Public License 1.5 - + - RealNetworks Public Source License v1.0 + Red Hat eCos Public License v1.1 @@ -1762,11 +1902,6 @@ Ricoh Source Code Public License - - - Rdisc License - - Ruby License @@ -1777,11 +1912,26 @@ Sax Public Domain Notice + + + Saxpath License + + SCEA Shared Source License + + + Sendmail License 8.23 + + + + + Sendmail License + + SGI Free Software License B v1.0 @@ -1807,9 +1957,9 @@ Solderpad Hardware License, Version 0.51 - + - Sun Industry Standards Source License v1.1 + Simple Public License 2.0 @@ -1817,6 +1967,16 @@ Sun Industry Standards Source License v1.2 + + + Sun Industry Standards Source License v1.1 + + + + + Sleepycat License + + Standard ML of New Jersey License @@ -1832,56 +1992,6 @@ SNIA Public License 1.1 - - - Sun Public License v1.0 - - - - - SSH OpenSSH license - - - - - SSH short notice - - - - - Server Side Public License, v 1 - - - - - Scheme Widget Library (SWL) Software License Agreement - - - - - Saxpath License - - - - - Sendmail License - - - - - Sendmail License 8.23 - - - - - Simple Public License 2.0 - - - - - Sleepycat License - - Spencer License 86 @@ -1897,9 +2007,39 @@ Spencer License 99 - + - Standard ML of New Jersey License + Sun Public License v1.0 + + + + + SSH OpenSSH license + + + + + PHP License v3.01 + + + + + SSH short notice + + + + + MIT No Attribution + + + + + RealNetworks Public Source License v1.0 + + + + + Scheme Widget Library (SWL) Software License Agreement @@ -1907,11 +2047,6 @@ SugarCRM Public License v1.1.3 - - - TAPR Open Hardware License v1.0 - - TCL/TK License @@ -1922,29 +2057,29 @@ TCP Wrappers License + + + Server Side Public License, v 1 + + TMate Open Source License - - - TORQUE v2.5+ Software License v1.1 - - Trusster Open Source License - + - Technische Universitaet Berlin License 1.0 + TORQUE v2.5+ Software License v1.1 - + - Technische Universitaet Berlin License 2.0 + TAPR Open Hardware License v1.0 @@ -1952,11 +2087,6 @@ Upstream Compatibility License v1.0 - - - Universal Permissive License v1.0 - - Unicode License Agreement - Data Files and Software (2015) @@ -1972,6 +2102,16 @@ Unicode Terms of Use + + + Technische Universitaet Berlin License 1.0 + + + + + Universal Permissive License v1.0 + + The Unlicense @@ -1982,14 +2122,19 @@ VOSTROM Public License for Open Source + + + Vim License + + Vovida Software License v1.0 - + - Vim License + W3C Software Notice and Document License (2015-05-13) @@ -2002,14 +2147,9 @@ W3C Software Notice and License (1998-07-20) - + - W3C Software Notice and Document License (2015-05-13) - - - - - Do What The F*ck You Want To Public License + Wsuipa License @@ -2017,9 +2157,9 @@ Sybase Open Watcom Public License 1.0 - + - Wsuipa License + Do What The F*ck You Want To Public License @@ -2027,26 +2167,36 @@ X11 License - - - XFree86 License 1.1 - - - - - XSkat License - - Xerox License + + + XFree86 License 1.1 + + + + + xinetd License + + X.Net License + + + XPP License + + + + + XSkat License + + Yahoo! Public License v1.0 @@ -2057,6 +2207,36 @@ Yahoo! Public License v1.1 + + + Zed License + + + + + Zend License v2.0 + + + + + Technische Universitaet Berlin License 2.0 + + + + + Zimbra Public License v1.4 + + + + + zlib/libpng License with Acknowledgement + + + + + zlib License + + Zope Public License 1.1 @@ -2072,14 +2252,9 @@ Zope Public License 2.1 - + - Zed License - - - - - Zend License v2.0 + wxWindows Library License @@ -2087,297 +2262,237 @@ Zimbra Public License v1.3 - - - Zimbra Public License v1.4 - - - - - zlib License - - - - - SQLite Blessing - - - - - bzip2 and libbzip2 License v1.0.5 - - - - - bzip2 and libbzip2 License v1.0.6 - - - - - copyleft-next 0.3.0 - - - - - copyleft-next 0.3.1 - - - - - curl License - - - - - diffmark license - - - - - dvipdfm License - - - - - eCos license version 2.0 - - - - - eGenix.com Public License 1.1.0 - - - - - Etalab Open License 2.0 - - gSOAP Public License v1.3b - + - gnuplot License + Interbase Public License v1.0 - + - iMatix Standard Function Library Agreement + GNU Lesser General Public License v2.1 only - + - PNG Reference Library version 2 + GNU Lesser General Public License v3.0 only - + - libselinux public domain notice + Non-Profit Open Software License 3.0 - + - libtiff License + Open LDAP Public License v2.5 - + - mpich2 License - - - - - psfrag License - - - - - psutils License - - - - - wxWindows Library License - - - - - xinetd License - - - - - XPP License - - - - - zlib/libpng License with Acknowledgement + Standard ML of New Jersey License - - - GCC Runtime Library exception 2.0 - - - - - OpenVPN OpenSSL Exception - - - - - Nokia Qt LGPL exception 1.1 - - - - - GPL-3.0 Linking Exception - - - - - Fawkes Runtime Exception - - - - - U-Boot exception 2.0 - - - - - PS/PDF font exception (2017-08-17) - - - - - GNU JavaMail exception - - - - - LGPL-3.0 Linking Exception - - - - - DigiRule FOSS License Exception - - - - - LLVM Exception - - - - - Linux Syscall Note - - - - - GPL-3.0 Linking Exception (with Corresponding Source) - - - - - Qwt exception 1.0 - - 389 Directory Server Exception - - - Macros and Inline Functions Exception - - - - - eCos exception 2.0 - - - - - CLISP exception 2.0 - - - - - Bison exception 2.2 - - - - - Libtool Exception - - - - - LZMA exception - - - - - OpenJDK Assembly exception 1.0 - - - - - Font exception 2.0 - - - - - OCaml LGPL Linking Exception - - - - - GCC Runtime Library exception 3.1 - - - - - Bootloader Distribution Exception - - - - - Solderpad Hardware License v2.0 - - - - - Classpath exception 2.0 - - - - - Swift Exception - - Autoconf exception 2.0 + + + Autoconf exception 3.0 + + + + + Bison exception 2.2 + + + + + Bootloader Distribution Exception + + + + + Classpath exception 2.0 + + + + + CLISP exception 2.0 + + + + + DigiRule FOSS License Exception + + + + + eCos exception 2.0 + + + + + Fawkes Runtime Exception + + FLTK exception + + + Font exception 2.0 + + FreeRTOS Exception 2.0 + + + GCC Runtime Library exception 2.0 + + + + + GCC Runtime Library exception 3.1 + + + + + GNU JavaMail exception + + + + + GPL-3.0 Linking Exception + + + + + GPL-3.0 Linking Exception (with Corresponding Source) + + + + + GPL Cooperation Commitment 1.0 + + + + + i2p GPL+Java Exception + + + + + LGPL-3.0 Linking Exception + + + + + Libtool Exception + + + + + Linux Syscall Note + + + + + LLVM Exception + + + + + LZMA exception + + + + + Macros and Inline Functions Exception + + + + + Nokia Qt LGPL exception 1.1 + + + + + OCaml LGPL Linking Exception + + + + + Open CASCADE Exception 1.0 + + + + + OpenJDK Assembly exception 1.0 + + + + + OpenVPN OpenSSL Exception + + + + + PS/PDF font exception (2017-08-17) + + + + + Qt GPL exception 1.0 + + + + + Qt LGPL exception 1.1 + + + + + Qwt exception 1.0 + + + + + Solderpad Hardware License v2.0 + + + + + Solderpad Hardware License v2.1 + + + + + Swift Exception + + + + + U-Boot exception 2.0 + + Universal FOSS Exception, Version 1.0 @@ -2388,41 +2503,6 @@ WxWindows Library Exception 3.1 - - - Open CASCADE Exception 1.0 - - - - - Autoconf exception 3.0 - - - - - i2p GPL+Java Exception - - - - - GPL Cooperation Commitment 1.0 - - - - - Qt LGPL exception 1.1 - - - - - Solderpad Hardware License v2.1 - - - - - Qt GPL exception 1.0 - - diff --git a/syft/format/option.go b/syft/format/option.go index 184649e91..8d85b1386 100644 --- a/syft/format/option.go +++ b/syft/format/option.go @@ -7,7 +7,8 @@ const ( JSONOption Option = "json" TextOption Option = "text" TableOption Option = "table" - CycloneDxOption Option = "cyclonedx" + CycloneDxXMLOption Option = "cyclonedx" + CycloneDxJSONOption Option = "cyclonedx-json" SPDXTagValueOption Option = "spdx-tag-value" SPDXJSONOption Option = "spdx-json" ) @@ -16,7 +17,8 @@ var AllOptions = []Option{ JSONOption, TextOption, TableOption, - CycloneDxOption, + CycloneDxXMLOption, + CycloneDxJSONOption, SPDXTagValueOption, SPDXJSONOption, } @@ -31,8 +33,12 @@ func ParseOption(userStr string) Option { return TextOption case string(TableOption): return TableOption - case string(CycloneDxOption), "cyclone", "cyclone-dx": - return CycloneDxOption + case string(CycloneDxXMLOption), "cyclone", "cyclone-dx", "cyclone-dx-xml", "cyclone-xml": + // NOTE(jonasagx): setting "cyclone" to XML by default for retro-compatibility. + // If we want to show no preference between XML and JSON please remove it. + return CycloneDxXMLOption + case string(CycloneDxJSONOption), "cyclone-json", "cyclone-dx-json": + return CycloneDxJSONOption case string(SPDXTagValueOption), "spdx", "spdx-tagvalue", "spdxtagvalue", "spdx-tv", "spdxtv": return SPDXTagValueOption case string(SPDXJSONOption), "spdxjson":