Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CycloneDX v1.5 JSON schema and update resource config #41

Merged
merged 3 commits into from
Jun 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion cmd/validate_cdx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ const (
// CycloneDX - Test versioned documents meet min. schema requirements
TEST_CDX_1_3_MIN_REQUIRED = "test/cyclonedx/cdx-1-3-min-required.json"
TEST_CDX_1_4_MIN_REQUIRED = "test/cyclonedx/cdx-1-4-min-required.json"
TEST_CDX_1_5_MIN_REQUIRED = "test/cyclonedx/cdx-1-5-min-required.json"
)

// Mature SBOMs used to test various schemas and queries
const (
TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-3-mature-example-1.json"
TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-4-mature-example-1.json"
TEST_CDX_1_5_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-5-mature-example-1.json"
)

const (
// (invalid) schema tests
TEST_SCHEMA_CDX_1_3_INVALID_LICENSE_CHOICE = "test/cyclonedx/cdx-1-3-invalid-license-choice-oneof.json"
TEST_SCHEMA_CDX_1_3_INVALID_LICENSE_ID = "test/cyclonedx/cdx-1-3-invalid-spdx-license-id.json"
Expand All @@ -33,7 +43,7 @@ const (
)

// -----------------------------------------------------------
// CycloneDX - Min. req. tests
// CycloneDX - Min. requirement & Mature tests
// -----------------------------------------------------------

func TestValidateCdx13MinRequiredBasic(t *testing.T) {
Expand All @@ -44,6 +54,22 @@ func TestValidateCdx14MinRequiredBasic(t *testing.T) {
innerValidateError(t, TEST_CDX_1_4_MIN_REQUIRED, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx15MinRequiredBasic(t *testing.T) {
innerValidateError(t, TEST_CDX_1_5_MIN_REQUIRED, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx13Mature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx14MMature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

func TestValidateCdx15Mature(t *testing.T) {
innerValidateError(t, TEST_CDX_1_5_MATURITY_EXAMPLE_1_BASE, SCHEMA_VARIANT_NONE, FORMAT_TEXT, nil)
}

// -----------------------------------------------------------
// CycloneDX - (invalid) schema tests
// -----------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions cmd/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ const (
TEST_CDX_1_3_SYNTAX_ERR_2 = "test/cyclonedx/cdx-1-3-syntax-err-2.json"
)

// Mature SBOMs used to test various schemas and queries
const (
TEST_CDX_1_3_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-3-mature-example-1.json"
TEST_CDX_1_4_MATURITY_EXAMPLE_1_BASE = "test/cyclonedx/cdx-1-4-mature-example-1.json"
)

const (
TEST_CDX_1_4_VALIDATE_ERR_COMPONENTS_UNIQUE = "test/validation/cdx-1-4-validate-err-components-unique-items-1.json"
TEST_CDX_1_4_VALIDATE_ERR_FORMAT_IRI_REFERENCE = "test/validation/cdx-1-4-validate-err-components-format-iri-reference.json"
Expand Down
9 changes: 9 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@
"url": "https://raw.githubusercontent.com/CycloneDX/specification/v1.5-dev/schema/bom-1.5.schema.json",
"default": false
},
{
"version": "1.5",
"variant": "",
"name": "CycloneDX v1.5",
"file": "schema/cyclonedx/1.5/bom-1.5.schema.json",
"development": "https://github.com/CycloneDX/specification/blob/master/schema/bom-1.5.schema.json",
"url": "https://raw.githubusercontent.com/CycloneDX/specification/master/schema/bom-1.5.schema.json",
"default": false
},
{
"version": "1.3",
"variant": "custom",
Expand Down
Loading