sbom-cyclonedx 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +15 -0
- data/.gitlab-ci.yml +49 -0
- data/.rspec +3 -0
- data/.rubocop.yml +72 -0
- data/.vscode/settings.json +6 -0
- data/CHANGELOG.md +9 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +179 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +36 -0
- data/Steepfile +14 -0
- data/bin/console +11 -0
- data/bin/rbs_spec +9 -0
- data/bin/setup +8 -0
- data/bom-1.6.schema.json +7334 -0
- data/lib/email_address_extension.rb +26 -0
- data/lib/sbom/cyclone_dx/enum.rb +2178 -0
- data/lib/sbom/cyclone_dx/field.rb +404 -0
- data/lib/sbom/cyclone_dx/pattern.rb +43 -0
- data/lib/sbom/cyclone_dx/record/advisory.rb +17 -0
- data/lib/sbom/cyclone_dx/record/annotation.rb +46 -0
- data/lib/sbom/cyclone_dx/record/attachment.rb +21 -0
- data/lib/sbom/cyclone_dx/record/base.rb +244 -0
- data/lib/sbom/cyclone_dx/record/cipher_suite.rb +23 -0
- data/lib/sbom/cyclone_dx/record/co2_measure.rb +18 -0
- data/lib/sbom/cyclone_dx/record/command.rb +18 -0
- data/lib/sbom/cyclone_dx/record/commit.rb +25 -0
- data/lib/sbom/cyclone_dx/record/component.rb +126 -0
- data/lib/sbom/cyclone_dx/record/component_data.rb +46 -0
- data/lib/sbom/cyclone_dx/record/component_evidence.rb +68 -0
- data/lib/sbom/cyclone_dx/record/component_identity_evidence.rb +36 -0
- data/lib/sbom/cyclone_dx/record/composition.rb +33 -0
- data/lib/sbom/cyclone_dx/record/condition.rb +20 -0
- data/lib/sbom/cyclone_dx/record/copyright.rb +16 -0
- data/lib/sbom/cyclone_dx/record/crypto_properties.rb +137 -0
- data/lib/sbom/cyclone_dx/record/data_governance.rb +21 -0
- data/lib/sbom/cyclone_dx/record/data_governance_responsible_party.rb +22 -0
- data/lib/sbom/cyclone_dx/record/declarations.rb +193 -0
- data/lib/sbom/cyclone_dx/record/definitions.rb +17 -0
- data/lib/sbom/cyclone_dx/record/dependency.rb +21 -0
- data/lib/sbom/cyclone_dx/record/diff.rb +18 -0
- data/lib/sbom/cyclone_dx/record/energy_consumption.rb +31 -0
- data/lib/sbom/cyclone_dx/record/energy_measure.rb +18 -0
- data/lib/sbom/cyclone_dx/record/energy_provider.rb +31 -0
- data/lib/sbom/cyclone_dx/record/environmental_consideration.rb +20 -0
- data/lib/sbom/cyclone_dx/record/event.rb +31 -0
- data/lib/sbom/cyclone_dx/record/external_reference.rb +25 -0
- data/lib/sbom/cyclone_dx/record/fairness_assessment.rb +22 -0
- data/lib/sbom/cyclone_dx/record/formula.rb +29 -0
- data/lib/sbom/cyclone_dx/record/graphic.rb +19 -0
- data/lib/sbom/cyclone_dx/record/graphics_collection.rb +19 -0
- data/lib/sbom/cyclone_dx/record/hash_data.rb +18 -0
- data/lib/sbom/cyclone_dx/record/identifiable_action.rb +21 -0
- data/lib/sbom/cyclone_dx/record/input.rb +34 -0
- data/lib/sbom/cyclone_dx/record/input_output_ml_parameter.rb +17 -0
- data/lib/sbom/cyclone_dx/record/issue.rb +36 -0
- data/lib/sbom/cyclone_dx/record/license.rb +90 -0
- data/lib/sbom/cyclone_dx/record/license_choice.rb +35 -0
- data/lib/sbom/cyclone_dx/record/metadata.rb +55 -0
- data/lib/sbom/cyclone_dx/record/model_card.rb +89 -0
- data/lib/sbom/cyclone_dx/record/note.rb +20 -0
- data/lib/sbom/cyclone_dx/record/organizational_contact.rb +26 -0
- data/lib/sbom/cyclone_dx/record/organizational_entity.rb +28 -0
- data/lib/sbom/cyclone_dx/record/output.rb +34 -0
- data/lib/sbom/cyclone_dx/record/parameter.rb +20 -0
- data/lib/sbom/cyclone_dx/record/patch.rb +23 -0
- data/lib/sbom/cyclone_dx/record/performance_metric.rb +30 -0
- data/lib/sbom/cyclone_dx/record/postal_address.rb +34 -0
- data/lib/sbom/cyclone_dx/record/property.rb +18 -0
- data/lib/sbom/cyclone_dx/record/rating.rb +27 -0
- data/lib/sbom/cyclone_dx/record/release_notes.rb +44 -0
- data/lib/sbom/cyclone_dx/record/resource_reference_choice.rb +22 -0
- data/lib/sbom/cyclone_dx/record/risk.rb +18 -0
- data/lib/sbom/cyclone_dx/record/root.rb +63 -0
- data/lib/sbom/cyclone_dx/record/secured_by.rb +20 -0
- data/lib/sbom/cyclone_dx/record/service.rb +54 -0
- data/lib/sbom/cyclone_dx/record/service_data.rb +32 -0
- data/lib/sbom/cyclone_dx/record/signature.rb +85 -0
- data/lib/sbom/cyclone_dx/record/standard.rb +72 -0
- data/lib/sbom/cyclone_dx/record/step.rb +24 -0
- data/lib/sbom/cyclone_dx/record/swid.rb +29 -0
- data/lib/sbom/cyclone_dx/record/task.rb +56 -0
- data/lib/sbom/cyclone_dx/record/tools.rb +20 -0
- data/lib/sbom/cyclone_dx/record/trigger.rb +48 -0
- data/lib/sbom/cyclone_dx/record/version.rb +24 -0
- data/lib/sbom/cyclone_dx/record/volume.rb +33 -0
- data/lib/sbom/cyclone_dx/record/vulnerability.rb +119 -0
- data/lib/sbom/cyclone_dx/record/vulnerability_source.rb +20 -0
- data/lib/sbom/cyclone_dx/record/workflow.rb +59 -0
- data/lib/sbom/cyclone_dx/record/workspace.rb +45 -0
- data/lib/sbom/cyclone_dx/record.rb +12 -0
- data/lib/sbom/cyclone_dx/validator/array_validator.rb +66 -0
- data/lib/sbom/cyclone_dx/validator/base_validator.rb +43 -0
- data/lib/sbom/cyclone_dx/validator/boolean_validator.rb +16 -0
- data/lib/sbom/cyclone_dx/validator/date_time_validator.rb +29 -0
- data/lib/sbom/cyclone_dx/validator/email_address_validator.rb +31 -0
- data/lib/sbom/cyclone_dx/validator/float_validator.rb +30 -0
- data/lib/sbom/cyclone_dx/validator/integer_validator.rb +30 -0
- data/lib/sbom/cyclone_dx/validator/record_validator.rb +26 -0
- data/lib/sbom/cyclone_dx/validator/string_validator.rb +33 -0
- data/lib/sbom/cyclone_dx/validator/union_validator.rb +39 -0
- data/lib/sbom/cyclone_dx/validator/uri_validator.rb +32 -0
- data/lib/sbom/cyclone_dx/validator.rb +32 -0
- data/lib/sbom/cyclone_dx/version.rb +7 -0
- data/lib/sbom/cyclone_dx.rb +39 -0
- data/rbs_collection.lock.yaml +288 -0
- data/rbs_collection.yaml +31 -0
- data/sbom-cyclone_dx.gemspec +32 -0
- data/sig/email_address_extension.rbs +14 -0
- data/sig/sbom/cyclone_dx/enum.rbs +93 -0
- data/sig/sbom/cyclone_dx/field.rbs +434 -0
- data/sig/sbom/cyclone_dx/pattern.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/advisory.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/annotation.rbs +63 -0
- data/sig/sbom/cyclone_dx/record/attachment.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/base.rbs +62 -0
- data/sig/sbom/cyclone_dx/record/cipher_suite.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/co2_measure.rbs +14 -0
- data/sig/sbom/cyclone_dx/record/command.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/commit.rbs +34 -0
- data/sig/sbom/cyclone_dx/record/component.rbs +203 -0
- data/sig/sbom/cyclone_dx/record/component_data.rbs +73 -0
- data/sig/sbom/cyclone_dx/record/component_evidence.rbs +115 -0
- data/sig/sbom/cyclone_dx/record/component_identity_evidence.rbs +53 -0
- data/sig/sbom/cyclone_dx/record/composition.rbs +39 -0
- data/sig/sbom/cyclone_dx/record/condition.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/copyright.rbs +14 -0
- data/sig/sbom/cyclone_dx/record/crypto_properties.rbs +268 -0
- data/sig/sbom/cyclone_dx/record/data_governance.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/data_governance_responsible_party.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/declarations.rbs +352 -0
- data/sig/sbom/cyclone_dx/record/definitions.rbs +14 -0
- data/sig/sbom/cyclone_dx/record/dependency.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/diff.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/energy_consumption.rbs +39 -0
- data/sig/sbom/cyclone_dx/record/energy_measure.rbs +14 -0
- data/sig/sbom/cyclone_dx/record/energy_provider.rbs +39 -0
- data/sig/sbom/cyclone_dx/record/environmental_consideration.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/event.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/external_reference.rbs +29 -0
- data/sig/sbom/cyclone_dx/record/fairness_assessment.rbs +29 -0
- data/sig/sbom/cyclone_dx/record/formula.rbs +34 -0
- data/sig/sbom/cyclone_dx/record/graphic.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/graphics_collection.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/hash_data.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/identifiable_action.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/input.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/input_output_ml_parameter.rbs +14 -0
- data/sig/sbom/cyclone_dx/record/issue.rbs +53 -0
- data/sig/sbom/cyclone_dx/record/license.rbs +134 -0
- data/sig/sbom/cyclone_dx/record/license_choice.rbs +39 -0
- data/sig/sbom/cyclone_dx/record/metadata.rbs +82 -0
- data/sig/sbom/cyclone_dx/record/model_card.rbs +143 -0
- data/sig/sbom/cyclone_dx/record/note.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/organizational_contact.rbs +29 -0
- data/sig/sbom/cyclone_dx/record/organizational_entity.rbs +34 -0
- data/sig/sbom/cyclone_dx/record/output.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/parameter.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/patch.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/performance_metric.rbs +43 -0
- data/sig/sbom/cyclone_dx/record/postal_address.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/property.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/rating.rbs +39 -0
- data/sig/sbom/cyclone_dx/record/release_notes.rbs +64 -0
- data/sig/sbom/cyclone_dx/record/resource_reference_choice.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/risk.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/root.rbs +84 -0
- data/sig/sbom/cyclone_dx/record/secured_by.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/service.rbs +99 -0
- data/sig/sbom/cyclone_dx/record/service_data.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/signature.rbs +130 -0
- data/sig/sbom/cyclone_dx/record/standard.rbs +132 -0
- data/sig/sbom/cyclone_dx/record/step.rbs +29 -0
- data/sig/sbom/cyclone_dx/record/swid.rbs +44 -0
- data/sig/sbom/cyclone_dx/record/task.rbs +84 -0
- data/sig/sbom/cyclone_dx/record/tools.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/trigger.rbs +69 -0
- data/sig/sbom/cyclone_dx/record/version.rbs +24 -0
- data/sig/sbom/cyclone_dx/record/volume.rbs +49 -0
- data/sig/sbom/cyclone_dx/record/vulnerability.rbs +209 -0
- data/sig/sbom/cyclone_dx/record/vulnerability_source.rbs +19 -0
- data/sig/sbom/cyclone_dx/record/workflow.rbs +94 -0
- data/sig/sbom/cyclone_dx/record/workspace.rbs +69 -0
- data/sig/sbom/cyclone_dx/record.rbs +161 -0
- data/sig/sbom/cyclone_dx/type.rbs +16 -0
- data/sig/sbom/cyclone_dx/validator/array_validator.rbs +31 -0
- data/sig/sbom/cyclone_dx/validator/base_validator.rbs +21 -0
- data/sig/sbom/cyclone_dx/validator/boolean_validator.rbs +9 -0
- data/sig/sbom/cyclone_dx/validator/date_time_validator.rbs +10 -0
- data/sig/sbom/cyclone_dx/validator/email_address_validator.rbs +10 -0
- data/sig/sbom/cyclone_dx/validator/float_validator.rbs +12 -0
- data/sig/sbom/cyclone_dx/validator/integer_validator.rbs +12 -0
- data/sig/sbom/cyclone_dx/validator/record_validator.rbs +12 -0
- data/sig/sbom/cyclone_dx/validator/string_validator.rbs +14 -0
- data/sig/sbom/cyclone_dx/validator/union_validator.rbs +24 -0
- data/sig/sbom/cyclone_dx/validator/uri_validator.rbs +10 -0
- data/sig/sbom/cyclone_dx/validator.rbs +66 -0
- data/sig/sbom/cyclone_dx.rbs +13 -0
- data/sig/types.rbs +45 -0
- data/spec/email_address_extension_spec.rb +27 -0
- data/spec/factories/factory_helper.rb +78 -0
- data/spec/factories/record/advisory_factory.rb +11 -0
- data/spec/factories/record/annotation_factory.rb +63 -0
- data/spec/factories/record/attachment_factory.rb +9 -0
- data/spec/factories/record/cipher_suite_factory.rb +26 -0
- data/spec/factories/record/co2_measure_factory.rb +9 -0
- data/spec/factories/record/command_factory.rb +10 -0
- data/spec/factories/record/commit_factory.rb +13 -0
- data/spec/factories/record/component_data_factory.rb +28 -0
- data/spec/factories/record/component_evidence_factory.rb +44 -0
- data/spec/factories/record/component_factory.rb +102 -0
- data/spec/factories/record/component_identity_evidence_factory.rb +25 -0
- data/spec/factories/record/composition_factory.rb +20 -0
- data/spec/factories/record/condition_factory.rb +11 -0
- data/spec/factories/record/copyright_factory.rb +9 -0
- data/spec/factories/record/crypto_properties_factory.rb +191 -0
- data/spec/factories/record/data_governance_factory.rb +11 -0
- data/spec/factories/record/data_governance_responsible_party_factory.rb +31 -0
- data/spec/factories/record/declarations_factory.rb +145 -0
- data/spec/factories/record/definitions_factory.rb +9 -0
- data/spec/factories/record/dependency_factory.rb +12 -0
- data/spec/factories/record/diff_factory.rb +24 -0
- data/spec/factories/record/energy_consumption_factory.rb +15 -0
- data/spec/factories/record/energy_measure_factory.rb +9 -0
- data/spec/factories/record/energy_provider_factory.rb +15 -0
- data/spec/factories/record/environmental_consideration_factory.rb +10 -0
- data/spec/factories/record/event_factory.rb +15 -0
- data/spec/factories/record/external_reference_factory.rb +13 -0
- data/spec/factories/record/fairness_assessment_factory.rb +12 -0
- data/spec/factories/record/formula_factory.rb +13 -0
- data/spec/factories/record/graphic_factory.rb +10 -0
- data/spec/factories/record/graphics_collection_factory.rb +10 -0
- data/spec/factories/record/hash_data_factory.rb +10 -0
- data/spec/factories/record/identifiable_action_factory.rb +11 -0
- data/spec/factories/record/input_factory.rb +36 -0
- data/spec/factories/record/input_output_ml_parameter_factory.rb +9 -0
- data/spec/factories/record/issue_factory.rb +22 -0
- data/spec/factories/record/license_choice_factory.rb +23 -0
- data/spec/factories/record/license_factory.rb +99 -0
- data/spec/factories/record/metadata_factory.rb +38 -0
- data/spec/factories/record/model_card_factory.rb +59 -0
- data/spec/factories/record/note_factory.rb +11 -0
- data/spec/factories/record/organizational_contact_factory.rb +12 -0
- data/spec/factories/record/organizational_entity_factory.rb +13 -0
- data/spec/factories/record/output_factory.rb +32 -0
- data/spec/factories/record/parameter_factory.rb +11 -0
- data/spec/factories/record/patch_factory.rb +12 -0
- data/spec/factories/record/performance_metric_factory.rb +20 -0
- data/spec/factories/record/postal_address_factory.rb +14 -0
- data/spec/factories/record/property_factory.rb +11 -0
- data/spec/factories/record/rating_factory.rb +14 -0
- data/spec/factories/record/release_notes_factory.rb +20 -0
- data/spec/factories/record/resource_reference_choice_factory.rb +27 -0
- data/spec/factories/record/risk_factory.rb +10 -0
- data/spec/factories/record/root_factory.rb +23 -0
- data/spec/factories/record/secured_by_factory.rb +10 -0
- data/spec/factories/record/service_data_factory.rb +16 -0
- data/spec/factories/record/service_factory.rb +27 -0
- data/spec/factories/record/signature_factory.rb +50 -0
- data/spec/factories/record/standard_factory.rb +37 -0
- data/spec/factories/record/step_factory.rb +12 -0
- data/spec/factories/record/swid_factory.rb +16 -0
- data/spec/factories/record/task_factory.rb +24 -0
- data/spec/factories/record/tools_factory.rb +10 -0
- data/spec/factories/record/trigger_factory.rb +21 -0
- data/spec/factories/record/version_factory.rb +19 -0
- data/spec/factories/record/volume_factory.rb +16 -0
- data/spec/factories/record/vulnerability_factory.rb +70 -0
- data/spec/factories/record/vulnerability_source_factory.rb +10 -0
- data/spec/factories/record/workflow_factory.rb +26 -0
- data/spec/factories/record/workspace_factory.rb +21 -0
- data/spec/factories/record_factory.rb +159 -0
- data/spec/fixtures/cipher_info.yml +948 -0
- data/spec/fixtures/purl_data.yml +0 -0
- data/spec/sbom/cyclone_dx/enum_spec.rb +30 -0
- data/spec/sbom/cyclone_dx/field_spec.rb +104 -0
- data/spec/sbom/cyclone_dx/pattern_spec.rb +18 -0
- data/spec/sbom/cyclone_dx/record/advisory_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/annotation_spec.rb +31 -0
- data/spec/sbom/cyclone_dx/record/attachment_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/base_spec.rb +363 -0
- data/spec/sbom/cyclone_dx/record/cipher_suite_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/co2_measure_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/command_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/commit_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/component_data_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/component_evidence_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/component_identity_evidence_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/component_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/composition_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/condition_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/copyright_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/crypto_properties_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/data_governance_responsible_party_spec.rb +19 -0
- data/spec/sbom/cyclone_dx/record/data_governance_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/declarations_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/definitions_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/dependency_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/diff_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/energy_consumption_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/energy_measure_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/energy_provider_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/environmental_consideration_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/event_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/external_reference_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/fairness_assessment_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/formula_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/graphic_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/graphics_collection_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/hash_data_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/identifiable_action_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/input_output_ml_parameter_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/input_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/issue_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/license_choice_spec.rb +26 -0
- data/spec/sbom/cyclone_dx/record/license_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/metadata_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/model_card_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/note_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/organizational_contact_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/organizational_entity_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/output_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/parameter_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/patch_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/performance_metric_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/postal_address_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/property_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/rating_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/release_notes_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/resource_reference_choice_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/risk_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/root_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/secured_by_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/service_data_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/service_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/signature_spec.rb +26 -0
- data/spec/sbom/cyclone_dx/record/standard_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/step_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/swid_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/task_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/tools_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/trigger_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/version_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/volume_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/vulnerability_source_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/vulnerability_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/workflow_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record/workspace_spec.rb +14 -0
- data/spec/sbom/cyclone_dx/record_spec.rb +7 -0
- data/spec/sbom/cyclone_dx/validator/array_validator_spec.rb +184 -0
- data/spec/sbom/cyclone_dx/validator/base_validator_spec.rb +71 -0
- data/spec/sbom/cyclone_dx/validator/boolean_validator_spec.rb +26 -0
- data/spec/sbom/cyclone_dx/validator/date_time_validator_spec.rb +28 -0
- data/spec/sbom/cyclone_dx/validator/email_address_validator_spec.rb +23 -0
- data/spec/sbom/cyclone_dx/validator/float_validator_spec.rb +71 -0
- data/spec/sbom/cyclone_dx/validator/integer_validator_spec.rb +71 -0
- data/spec/sbom/cyclone_dx/validator/record_validator_spec.rb +35 -0
- data/spec/sbom/cyclone_dx/validator/string_validator_spec.rb +94 -0
- data/spec/sbom/cyclone_dx/validator/union_validator_spec.rb +65 -0
- data/spec/sbom/cyclone_dx/validator/uri_validator_spec.rb +21 -0
- data/spec/sbom/cyclone_dx/validator_spec.rb +38 -0
- data/spec/sbom/cyclone_dx/version_spec.rb +9 -0
- data/spec/sbom/cyclone_dx_spec.rb +7 -0
- data/spec/spec_helper.rb +39 -0
- metadata +377 -6
@@ -0,0 +1,244 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/all"
|
4
|
+
require_relative "../../../email_address_extension"
|
5
|
+
require_relative "../enum"
|
6
|
+
require_relative "../pattern"
|
7
|
+
require_relative "../validator"
|
8
|
+
|
9
|
+
module SBOM
|
10
|
+
module CycloneDX
|
11
|
+
module Record
|
12
|
+
class Base # rubocop:disable Metrics/ClassLength
|
13
|
+
include Comparable
|
14
|
+
|
15
|
+
attr_reader :errors
|
16
|
+
|
17
|
+
def initialize(**args)
|
18
|
+
raise "Cannot instantiate abstract Record" unless self.class < Base
|
19
|
+
|
20
|
+
populate_fields(**args)
|
21
|
+
valid?
|
22
|
+
end
|
23
|
+
|
24
|
+
def <=>(other)
|
25
|
+
return nil unless other.is_a?(self.class)
|
26
|
+
|
27
|
+
as_json <=> other.as_json
|
28
|
+
end
|
29
|
+
|
30
|
+
def valid?
|
31
|
+
@errors = @_fields.transform_values do |field|
|
32
|
+
field.valid?
|
33
|
+
field.errors
|
34
|
+
end
|
35
|
+
@errors[:_base] = []
|
36
|
+
|
37
|
+
self.class.custom_validators.each do |props, message, block|
|
38
|
+
@errors[:_base] += validate_custom(*props, message: message, &block)
|
39
|
+
end
|
40
|
+
|
41
|
+
@errors.values.all?(&:empty?)
|
42
|
+
end
|
43
|
+
|
44
|
+
def valid!
|
45
|
+
raise ArgumentError, formatted_errors
|
46
|
+
end
|
47
|
+
|
48
|
+
def formatted_errors
|
49
|
+
errors.filter_map do |field_name, field_errors|
|
50
|
+
next if field_errors.empty?
|
51
|
+
|
52
|
+
field_name = self.class.json_name if field_name == :_base
|
53
|
+
field_errors.map { |error| "#{field_name} #{error}" }
|
54
|
+
end.flatten
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.json_create(object)
|
58
|
+
new(**object.deep_symbolize_keys)
|
59
|
+
end
|
60
|
+
|
61
|
+
private
|
62
|
+
|
63
|
+
attr_reader :_fields
|
64
|
+
|
65
|
+
def populate_fields(**args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
66
|
+
@_fields = self.class.fields.to_h do |name, field_class|
|
67
|
+
arg_name =
|
68
|
+
if args.key?(name)
|
69
|
+
name
|
70
|
+
elsif args.key?(field_class.json_name.to_sym)
|
71
|
+
field_class.json_name.to_sym
|
72
|
+
end
|
73
|
+
|
74
|
+
unless arg_name.nil?
|
75
|
+
if field_class < Field::ConstBase
|
76
|
+
const_object = field_class.new
|
77
|
+
input_object_value = args.delete(arg_name)
|
78
|
+
if const_object.value != input_object_value
|
79
|
+
raise ArgumentError,
|
80
|
+
"Sbom value does not match const field ('#{const_object.value}' != '#{input_object_value}')"
|
81
|
+
end
|
82
|
+
|
83
|
+
next [name, const_object]
|
84
|
+
end
|
85
|
+
|
86
|
+
next [name, field_class.new(field_class.coerce(args.delete(arg_name)))] if field_class < Field::PropBase
|
87
|
+
end
|
88
|
+
|
89
|
+
[name, field_class.new]
|
90
|
+
end
|
91
|
+
|
92
|
+
raise ArgumentError, "Unknown field(s): #{args.keys.join(", ")}" unless args.empty?
|
93
|
+
|
94
|
+
@_fields
|
95
|
+
end
|
96
|
+
|
97
|
+
def validate_custom(*props, message: nil) # rubocop:disable Metrics/MethodLength
|
98
|
+
case rv = yield(*props.map { |prop| public_send(prop) })
|
99
|
+
when "", true, nil
|
100
|
+
[]
|
101
|
+
when String
|
102
|
+
[rv]
|
103
|
+
when Array
|
104
|
+
rv
|
105
|
+
when false
|
106
|
+
[message || "#{props.join(", ")} invalid"]
|
107
|
+
else
|
108
|
+
[rv.to_s]
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
class << self
|
113
|
+
def fields
|
114
|
+
@fields ||= {} #: Hash[Symbol, singleton(SBOM::CycloneDX::Field::Base)]
|
115
|
+
end
|
116
|
+
|
117
|
+
def json_name(klass_name = nil)
|
118
|
+
unless klass_name.nil?
|
119
|
+
raise ArgumentError, "json_name can only be set within the class body" unless in_subclass_body?
|
120
|
+
|
121
|
+
return @json_name = klass_name
|
122
|
+
end
|
123
|
+
|
124
|
+
@json_name ||= name&.split("::")&.last || "Record"
|
125
|
+
end
|
126
|
+
|
127
|
+
###############################
|
128
|
+
# DSL Methods
|
129
|
+
###############################
|
130
|
+
|
131
|
+
def prop(field_name, type, required: false, json_name: nil, **kwargs) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength
|
132
|
+
raise "properties cannot be defined for abstract Record" unless self < Base
|
133
|
+
raise "properties must be defined in the class body of a subclass of Record" unless in_subclass_body?
|
134
|
+
raise "property #{field_name} already defined" if fields.key?(field_name)
|
135
|
+
|
136
|
+
new_prop =
|
137
|
+
case type
|
138
|
+
when :array
|
139
|
+
opts = kwargs.slice(:const, :default, :unique) #: arrayFieldOptions
|
140
|
+
Field.array(field_name: field_name, items: kwargs.fetch(:items), required: required,
|
141
|
+
json_name: json_name, **opts)
|
142
|
+
when :boolean
|
143
|
+
opts = kwargs.slice(:const, :default) #: booleanFieldOptions
|
144
|
+
Field.boolean(field_name: field_name, required: required, json_name: json_name, **opts)
|
145
|
+
when :date_time
|
146
|
+
opts = kwargs.slice(:const, :default) #: dateTimeFieldOptions
|
147
|
+
Field.date_time(field_name: field_name, required: required, json_name: json_name, **opts)
|
148
|
+
when :email_address
|
149
|
+
opts = kwargs.slice(:const, :default) #: emailAddressFieldOptions
|
150
|
+
Field.email_address(field_name: field_name, required: required, json_name: json_name, **opts)
|
151
|
+
when :float
|
152
|
+
opts = kwargs.slice(:const, :default, :maximum, :minimum) #: floatFieldOptions
|
153
|
+
Field.float(field_name: field_name, required: required, json_name: json_name, **opts)
|
154
|
+
when :integer
|
155
|
+
opts = kwargs.slice(:const, :default, :maximum, :minimum) #: integerFieldOptions
|
156
|
+
Field.integer(field_name: field_name, required: required, json_name: json_name, **opts)
|
157
|
+
when Class
|
158
|
+
opts = kwargs.slice(:const, :default) #: recordFieldOptions
|
159
|
+
Field.record(field_name: field_name, klass: type, required: required, json_name: json_name, **opts)
|
160
|
+
when :string
|
161
|
+
opts = kwargs.slice(:const, :default, :enum, :max_length, :min_length, :pattern) #: stringFieldOptions
|
162
|
+
Field.string(field_name: field_name, required: required, json_name: json_name, **opts)
|
163
|
+
when :union
|
164
|
+
opts = kwargs.slice(:const, :default) #: unionFieldOptions
|
165
|
+
Field.union(field_name: field_name, of: kwargs.fetch(:of), required: required, json_name: json_name,
|
166
|
+
**opts)
|
167
|
+
when :uri
|
168
|
+
opts = kwargs.slice(:const, :default) #: uriFieldOptions
|
169
|
+
Field.uri(field_name: field_name, required: required, json_name: json_name, **opts)
|
170
|
+
else
|
171
|
+
raise ArgumentError, "unknown type: #{type}"
|
172
|
+
end
|
173
|
+
|
174
|
+
@fields[field_name] = new_prop
|
175
|
+
define_method(field_name) { @_fields.fetch(field_name).value }
|
176
|
+
define_method(:"#{field_name}=") { |value| @_fields.fetch(field_name).value = value } unless new_prop.const?
|
177
|
+
define_method(:"#{field_name}?") { @_fields.fetch(field_name).value? }
|
178
|
+
define_method(:"#{field_name}_valid?") { @_fields.fetch(field_name).valid? }
|
179
|
+
end
|
180
|
+
|
181
|
+
def const(field_name, type, value, required: false, json_name: nil, **kwargs)
|
182
|
+
prop(field_name, type, required: required, json_name: json_name, const: value, **kwargs)
|
183
|
+
end
|
184
|
+
|
185
|
+
def validate(*props, presence: nil, message: nil, &block) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Metrics/MethodLength
|
186
|
+
raise "custom validators cannot be defined for abstract Record" unless self < Base
|
187
|
+
raise "custom validators must be defined in the class body of a subclass of Record" unless in_subclass_body?
|
188
|
+
|
189
|
+
@custom_validators ||= [] #: Array[[Array[Symbol], String, ^(*fieldValue?) -> (bool? | String | Array[String])]]
|
190
|
+
@custom_validators <<
|
191
|
+
if presence && block
|
192
|
+
raise ArgumentError, "cannot provide both :presence and a block"
|
193
|
+
elsif presence
|
194
|
+
validate_presence(props, presence, message)
|
195
|
+
elsif block
|
196
|
+
[props, message, block]
|
197
|
+
else
|
198
|
+
raise ArgumentError, "must provide :presence or a block"
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
def custom_validators
|
203
|
+
@custom_validators ||= []
|
204
|
+
end
|
205
|
+
|
206
|
+
private
|
207
|
+
|
208
|
+
def in_subclass_body? # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
209
|
+
caller_location = caller_locations&.find do |location|
|
210
|
+
!location.label&.include?("__RBS_TEST") && location.path != __FILE__
|
211
|
+
end
|
212
|
+
|
213
|
+
self < Base && (caller_location&.label&.start_with?("<class:") || false)
|
214
|
+
end
|
215
|
+
|
216
|
+
def validate_presence(props, presence, message = nil) # rubocop:disable Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
217
|
+
case presence
|
218
|
+
when :all
|
219
|
+
[
|
220
|
+
props,
|
221
|
+
message || "all of #{props.join(", ")} must be present",
|
222
|
+
->(*values) { values.none?(&:nil?) }
|
223
|
+
]
|
224
|
+
when :any
|
225
|
+
[
|
226
|
+
props,
|
227
|
+
message || "at least one of #{props.join(", ")} must be present",
|
228
|
+
->(*values) { !values.all?(&:nil?) }
|
229
|
+
]
|
230
|
+
when :one
|
231
|
+
[
|
232
|
+
props,
|
233
|
+
message || "exactly one of #{props.join(", ")} must be present",
|
234
|
+
->(*values) { values.count { |v| !v.nil? } == 1 }
|
235
|
+
]
|
236
|
+
else
|
237
|
+
raise ArgumentError, "unknown value for presence: #{presence}"
|
238
|
+
end
|
239
|
+
end
|
240
|
+
end
|
241
|
+
end
|
242
|
+
end
|
243
|
+
end
|
244
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../pattern"
|
4
|
+
require_relative "base"
|
5
|
+
|
6
|
+
# Cipher Suite - Object representing a cipher suite
|
7
|
+
module SBOM
|
8
|
+
module CycloneDX
|
9
|
+
module Record
|
10
|
+
# Schema name: CipherSuite
|
11
|
+
class CipherSuite < Base
|
12
|
+
# Common Name - A common name for the cipher suite.
|
13
|
+
# Example: "TLS_DHE_RSA_WITH_AES_128_CCM"
|
14
|
+
prop :name, :string
|
15
|
+
# Related Algorithms - A list of algorithms related to the cipher suite.
|
16
|
+
prop :algorithms, :array, items: [:string, pattern: Pattern::REF_LINK]
|
17
|
+
# Cipher Suite Identifiers - A list of common identifiers for the cipher suite.
|
18
|
+
# Examples: "0xC0", "0x9E"
|
19
|
+
prop :identifiers, :array, items: :string
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
# CO2 Measure - A measure of carbon dioxide (CO2).
|
6
|
+
module SBOM
|
7
|
+
module CycloneDX
|
8
|
+
module Record
|
9
|
+
# Schema name: CO2Measure
|
10
|
+
class CO2Measure < Base
|
11
|
+
# Value - Quantity of carbon dioxide (CO2).
|
12
|
+
prop :value, :float, required: true
|
13
|
+
# Unit - Unit of carbon dioxide (CO2), currently specified as a const "tCO2eq".
|
14
|
+
const :unit, :string, "tCO2eq"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
|
5
|
+
# Anonymous class from Command
|
6
|
+
module SBOM
|
7
|
+
module CycloneDX
|
8
|
+
module Record
|
9
|
+
# Schema name: Command
|
10
|
+
class Command < Base
|
11
|
+
# Executed - A text representation of the executed command.
|
12
|
+
prop :executed, :string
|
13
|
+
# Properties - 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. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is optional.
|
14
|
+
prop :properties, :array, items: Property
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "base"
|
4
|
+
require_relative "identifiable_action"
|
5
|
+
|
6
|
+
# Commit - Specifies an individual commit
|
7
|
+
module SBOM
|
8
|
+
module CycloneDX
|
9
|
+
module Record
|
10
|
+
# Schema name: Commit
|
11
|
+
class Commit < Base
|
12
|
+
# UID - A unique identifier of the commit. This may be version control specific. For example, Subversion uses revision numbers whereas git uses commit hashes.
|
13
|
+
prop :uid, :string
|
14
|
+
# URL - The URL to the commit. This URL will typically point to a commit in a version control system.
|
15
|
+
prop :url, :uri
|
16
|
+
# Author - The author who created the changes in the commit
|
17
|
+
prop :author, IdentifiableAction
|
18
|
+
# Committer - The person who committed or pushed the commit
|
19
|
+
prop :committer, IdentifiableAction
|
20
|
+
# Message - The text description of the contents of the commit
|
21
|
+
prop :message, :string
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../enum"
|
4
|
+
require_relative "../pattern"
|
5
|
+
require_relative "base"
|
6
|
+
require_relative "commit"
|
7
|
+
require_relative "component_data"
|
8
|
+
require_relative "component_evidence"
|
9
|
+
require_relative "crypto_properties"
|
10
|
+
require_relative "external_reference"
|
11
|
+
require_relative "hash_data"
|
12
|
+
require_relative "license_choice"
|
13
|
+
require_relative "model_card"
|
14
|
+
require_relative "organizational_contact"
|
15
|
+
require_relative "organizational_entity"
|
16
|
+
require_relative "patch"
|
17
|
+
require_relative "property"
|
18
|
+
require_relative "release_notes"
|
19
|
+
require_relative "signature"
|
20
|
+
require_relative "swid"
|
21
|
+
|
22
|
+
# Component
|
23
|
+
module SBOM
|
24
|
+
module CycloneDX
|
25
|
+
module Record
|
26
|
+
# Schema name: Component
|
27
|
+
class Component < Base
|
28
|
+
# Schema name: Pedigree
|
29
|
+
class Pedigree < Base
|
30
|
+
# Ancestors - 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.
|
31
|
+
prop :ancestors, :array, items: Component
|
32
|
+
# Descendants - Descendants are the exact opposite of ancestors. This provides a way to document all forks (and their forks) of an original or root component.
|
33
|
+
prop :descendants, :array, items: Component
|
34
|
+
# Variants - Variants describe relations where the relationship between the components is 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.
|
35
|
+
prop :variants, :array, items: Component
|
36
|
+
# Commits - A list of zero or more commits which provide a trail describing how the component deviates from an ancestor, descendant, or variant.
|
37
|
+
prop :commits, :array, items: Commit
|
38
|
+
# Patches - A list of zero or more patches describing how the component deviates from an ancestor, descendant, or variant. Patches may be complementary to commits or may be used in place of commits.
|
39
|
+
prop :patches, :array, items: Patch
|
40
|
+
# Notes - Notes, observations, and other non-structured commentary describing the components pedigree.
|
41
|
+
prop :notes, :string
|
42
|
+
end
|
43
|
+
|
44
|
+
# Component Type - 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.
|
45
|
+
prop :type, :string, enum: Enum::COMPONENT_TYPE, required: true
|
46
|
+
# Mime-Type - 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.
|
47
|
+
# TODO: Use a mime-type gem
|
48
|
+
prop :mime_type, :string, pattern: Pattern::MIME_TYPE, json_name: "mime-type"
|
49
|
+
# BOM Reference - An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref must be unique within the BOM. Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid conflicts with BOM-Links.
|
50
|
+
prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
|
51
|
+
# Component Supplier - The organization that supplied the component. The supplier may often be the manufacturer, but may also be a distributor or repackager.
|
52
|
+
prop :supplier, OrganizationalEntity
|
53
|
+
# Component Manufacturer - The organization that created the component. Manufacturer is common in components created through automated processes. Components created through manual means may have `@.authors` instead.
|
54
|
+
prop :manufacturer, OrganizationalEntity
|
55
|
+
# Component Authors - The person(s) who created the component. Authors are common in components created through manual processes. Components created through automated means may have `@.manufacturer` instead.
|
56
|
+
prop :authors, :array, items: OrganizationalContact
|
57
|
+
# Component Publisher - The person(s) or organization(s) that published the component
|
58
|
+
# Example: "Acme Inc"
|
59
|
+
prop :publisher, :string
|
60
|
+
# Component Group - 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.
|
61
|
+
# Example: "com.acme"
|
62
|
+
prop :group, :string
|
63
|
+
# Component Name - The name of the component. This will often be a shortened, single name of the component. Examples: commons-lang3 and jquery
|
64
|
+
# Example: "tomcat-catalina"
|
65
|
+
prop :name, :string, required: true
|
66
|
+
# Component Version - The component version. The version should ideally comply with semantic versioning but is not enforced.
|
67
|
+
prop :version, :string
|
68
|
+
# Component Description - Specifies a description for the component
|
69
|
+
prop :description, :string
|
70
|
+
# Component Scope - Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.
|
71
|
+
prop :scope, :string, enum: Enum::SCOPE, default: "required"
|
72
|
+
# Component Hashes - The hashes of the component.
|
73
|
+
prop :hashes, :array, items: HashData
|
74
|
+
# Component License(s)
|
75
|
+
prop :licenses, :array, items: [:union, of: LicenseChoice::UNION_TYPE]
|
76
|
+
# Component Copyright - A copyright notice informing users of the underlying claims to copyright ownership in a published work.
|
77
|
+
# Example: "Acme Inc"
|
78
|
+
prop :copyright, :string
|
79
|
+
# Common Platform Enumeration (CPE) - Asserts the identity of the component using CPE. The CPE must conform to the CPE 2.2 or 2.3 specification. See [https://nvd.nist.gov/products/cpe](https://nvd.nist.gov/products/cpe). Refer to `@.evidence.identity` to optionally provide evidence that substantiates the assertion of the component's identity.
|
80
|
+
# Example: "cpe:2.3:a:acme:component_framework:-:*:*:*:*:*:*:*"
|
81
|
+
# TODO: Validate
|
82
|
+
prop :cpe, :string
|
83
|
+
# Package URL (purl) - Asserts the identity of the component using package-url (purl). The purl, if specified, must be valid and conform to the specification defined at: [https://github.com/package-url/purl-spec](https://github.com/package-url/purl-spec). Refer to `@.evidence.identity` to optionally provide evidence that substantiates the assertion of the component's identity.
|
84
|
+
# Example: "pkg:maven/com.acme/tomcat-catalina@9.0.14?packaging=jar"
|
85
|
+
# TODO: Validate
|
86
|
+
prop :purl, :string
|
87
|
+
# OmniBOR Artifact Identifier (gitoid) - Asserts the identity of the component using the OmniBOR Artifact ID. The OmniBOR, if specified, must be valid and conform to the specification defined at: [https://www.iana.org/assignments/uri-schemes/prov/gitoid](https://www.iana.org/assignments/uri-schemes/prov/gitoid). Refer to `@.evidence.identity` to optionally provide evidence that substantiates the assertion of the component's identity.
|
88
|
+
# Examples:
|
89
|
+
# "gitoid:blob:sha1:a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
|
90
|
+
# "gitoid:blob:sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
91
|
+
# TODO: Validate
|
92
|
+
prop :omnibor_id, :array, items: :string
|
93
|
+
# Software Heritage Identifier - Asserts the identity of the component using the Software Heritage persistent identifier (SWHID). The SWHID, if specified, must be valid and conform to the specification defined at: [https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html](https://docs.softwareheritage.org/devel/swh-model/persistent-identifiers.html). Refer to `@.evidence.identity` to optionally provide evidence that substantiates the assertion of the component's identity.
|
94
|
+
# Example: "swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2"
|
95
|
+
# TODO: Validate
|
96
|
+
prop :swhid, :array, items: :string
|
97
|
+
# SWID Tag - Asserts the identity of the component using [ISO-IEC 19770-2 Software Identification (SWID) Tags](https://www.iso.org/standard/65666.html). Refer to `@.evidence.identity` to optionally provide evidence that substantiates the assertion of the component's identity.
|
98
|
+
prop :swid, SWID
|
99
|
+
# Component Modified From Original - [Deprecated] 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 if 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.
|
100
|
+
prop :modified, :boolean
|
101
|
+
# Component Pedigree - 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.
|
102
|
+
prop :pedigree, Pedigree
|
103
|
+
# External References - External references provide a way to document systems, sites, and information that may be relevant but are not included with the BOM. They may also establish specific relationships within or external to the BOM.
|
104
|
+
prop :external_references, :array, items: ExternalReference
|
105
|
+
# Components - A list of software and hardware components included in the parent component. This is not a dependency tree. It provides a way to specify a hierarchical representation of component assemblies, similar to system → subsystem → parts assembly in physical supply chains.
|
106
|
+
prop :components, :array, items: Component
|
107
|
+
# Evidence - Provides the ability to document evidence collected through various forms of extraction or analysis.
|
108
|
+
prop :evidence, ComponentEvidence
|
109
|
+
# Release notes - Specifies optional release notes.
|
110
|
+
prop :release_notes, ReleaseNotes
|
111
|
+
# AI/ML Model Card
|
112
|
+
prop :model_card, ModelCard
|
113
|
+
# Data - This object SHOULD be specified for any component of type `data` and must not be specified for other component types.
|
114
|
+
prop :data, :array, items: ComponentData
|
115
|
+
# Cryptographic Properties
|
116
|
+
prop :crypto_properties, CryptoProperties
|
117
|
+
# Properties - 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. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is optional.
|
118
|
+
prop :properties, :array, items: Property
|
119
|
+
# Tags
|
120
|
+
prop :tags, :array, items: :string
|
121
|
+
# Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
|
122
|
+
prop :signature, :union, of: Signature::UNION_TYPE
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../enum"
|
4
|
+
require_relative "../pattern"
|
5
|
+
require_relative "base"
|
6
|
+
require_relative "attachment"
|
7
|
+
require_relative "graphics_collection"
|
8
|
+
require_relative "data_governance"
|
9
|
+
require_relative "property"
|
10
|
+
|
11
|
+
# Anonymous class from ComponentData
|
12
|
+
module SBOM
|
13
|
+
module CycloneDX
|
14
|
+
module Record
|
15
|
+
# Schema name: ComponentData
|
16
|
+
class ComponentData < Base
|
17
|
+
class Content < Base
|
18
|
+
# Data Attachment - An optional way to include textual or encoded data.
|
19
|
+
prop :attachment, Attachment
|
20
|
+
# Data URL - The URL to where the data can be retrieved.
|
21
|
+
prop :url, :uri
|
22
|
+
# Configuration Properties - Provides the ability to document name-value parameters used for configuration.
|
23
|
+
prop :properties, :array, items: Property
|
24
|
+
end
|
25
|
+
|
26
|
+
# BOM Reference - An optional identifier which can be used to reference the dataset elsewhere in the BOM. Every bom-ref must be unique within the BOM. Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid conflicts with BOM-Links.
|
27
|
+
prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
|
28
|
+
# Type of Data - The general theme or subject matter of the data being specified.
|
29
|
+
prop :type, :string, enum: Enum::COMPONENT_DATA_TYPE, required: true
|
30
|
+
# Dataset Name - The name of the dataset.
|
31
|
+
prop :name, :string
|
32
|
+
# Data Contents - The contents or references to the contents of the data being described.
|
33
|
+
prop :contents, Content
|
34
|
+
# Data Classification - Data classification tags data according to its type, sensitivity, and value if altered, stolen, or destroyed.
|
35
|
+
prop :classification, :string
|
36
|
+
# Sensitive Data - A description of any sensitive data in a dataset.
|
37
|
+
prop :sensitive_data, :array, items: :string
|
38
|
+
prop :graphics, GraphicsCollection
|
39
|
+
# Dataset Description - A description of the dataset. Can describe size of dataset, whether it's used for source code, training, testing, or validation, etc.
|
40
|
+
prop :description, :string
|
41
|
+
# Data Governance
|
42
|
+
prop :governance, DataGovernance
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../pattern"
|
4
|
+
require_relative "base"
|
5
|
+
require_relative "component_identity_evidence"
|
6
|
+
require_relative "copyright"
|
7
|
+
require_relative "license_choice"
|
8
|
+
|
9
|
+
# Evidence - Provides the ability to document evidence collected through various forms of extraction or analysis.
|
10
|
+
module SBOM
|
11
|
+
module CycloneDX
|
12
|
+
module Record
|
13
|
+
# Schema name: ComponentEvidence
|
14
|
+
class ComponentEvidence < Base
|
15
|
+
# Schema name: Callstack
|
16
|
+
class Callstack < Base
|
17
|
+
# Schema name: Frame
|
18
|
+
class Frame < Base
|
19
|
+
# Package - A package organizes modules into namespaces, providing a unique namespace for each type it contains.
|
20
|
+
prop :package, :string
|
21
|
+
# Module - A module or class that encloses functions/methods and other code.
|
22
|
+
prop :source_module, :string, required: true, json_name: "module"
|
23
|
+
# Function - A block of code designed to perform a particular task.
|
24
|
+
prop :function, :string
|
25
|
+
# Parameters - Optional arguments that are passed to the module or function.
|
26
|
+
prop :parameters, :array, items: :string
|
27
|
+
# Line - The line number the code that is called resides on.
|
28
|
+
prop :line, :integer
|
29
|
+
# Column - The column the code that is called resides.
|
30
|
+
prop :column, :integer
|
31
|
+
# Full Filename - The full path and filename of the module.
|
32
|
+
prop :full_filename, :string
|
33
|
+
end
|
34
|
+
|
35
|
+
# Frames - Within a call stack, a frame is a discrete unit that encapsulates an execution context, including local variables, parameters, and the return address. As function calls are made, frames are pushed onto the stack, forming an array-like structure that orchestrates the flow of program execution and manages the sequence of function invocations.
|
36
|
+
prop :frames, :array, items: Frame
|
37
|
+
end
|
38
|
+
|
39
|
+
# Schema name: Occurrence
|
40
|
+
class Occurrence < Base
|
41
|
+
# BOM Reference - An optional identifier which can be used to reference the occurrence elsewhere in the BOM. Every bom-ref must be unique within the BOM. Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid conflicts with BOM-Links.
|
42
|
+
prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
|
43
|
+
# Location - The location or path to where the component was found.
|
44
|
+
prop :location, :string, required: true
|
45
|
+
# Line Number - The line number where the component was found.
|
46
|
+
prop :line, :integer
|
47
|
+
# Offset - The offset where the component was found.
|
48
|
+
prop :offset, :integer
|
49
|
+
# Symbol - The symbol name that was found associated with the component.
|
50
|
+
prop :symbol, :string
|
51
|
+
# Additional Context - Any additional context of the detected component (e.g. a code snippet).
|
52
|
+
prop :additional_context, :string
|
53
|
+
end
|
54
|
+
|
55
|
+
# Identity Evidence - Evidence that substantiates the identity of a component. The identity may be an object or an array of identity objects. Support for specifying identity as a single object was introduced in CycloneDX v1.5. Arrays were introduced in v1.6. It is recommended that all implementations use arrays, even if only one identity object is specified.
|
56
|
+
prop :identity, :array, items: ComponentIdentityEvidence
|
57
|
+
# Occurrences - Evidence of individual instances of a component spread across multiple locations.
|
58
|
+
prop :occurrences, :array, items: Occurrence
|
59
|
+
# Call Stack - Evidence of the components use through the callstack.
|
60
|
+
prop :callstack, Callstack
|
61
|
+
# License Evidence
|
62
|
+
prop :licenses, :array, items: [:union, of: LicenseChoice::UNION_TYPE]
|
63
|
+
# Copyright Evidence - Copyright evidence captures intellectual property assertions, providing evidence of possible ownership and legal protection.
|
64
|
+
prop :copyright, :array, items: Copyright
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../enum"
|
4
|
+
require_relative "../pattern"
|
5
|
+
require_relative "base"
|
6
|
+
|
7
|
+
# Identity Evidence - Evidence that substantiates the identity of a component.
|
8
|
+
module SBOM
|
9
|
+
module CycloneDX
|
10
|
+
module Record
|
11
|
+
# Schema name: ComponentIdentityEvidence
|
12
|
+
class ComponentIdentityEvidence < Base
|
13
|
+
# Schema name: Method
|
14
|
+
class Method < Base
|
15
|
+
# Technique - The technique used in this method of analysis.
|
16
|
+
prop :technique, :string, enum: Enum::TECHNIQUE, required: true
|
17
|
+
# Confidence - The confidence of the evidence from 0 - 1, where 1 is 100% confidence. Confidence is specific to the technique used. Each technique of analysis can have independent confidence.
|
18
|
+
prop :confidence, :float, minimum: 0, maximum: 1, required: true
|
19
|
+
# Value - The value or contents of the evidence.
|
20
|
+
prop :value, :string
|
21
|
+
end
|
22
|
+
|
23
|
+
# Field - The identity field of the component which the evidence describes.
|
24
|
+
prop :field, :string, enum: Enum::FIELD, required: true
|
25
|
+
# Confidence - The overall confidence of the evidence from 0 - 1, where 1 is 100% confidence.
|
26
|
+
prop :confidence, :float, minimum: 0, maximum: 1
|
27
|
+
# Concluded Value - The value of the field (cpe, purl, etc) that has been concluded based on the aggregate of all methods (if available).
|
28
|
+
prop :concluded_value, :string
|
29
|
+
# Methods - The methods used to extract and/or analyze the evidence.
|
30
|
+
prop :methods_used, :array, items: Method, json_name: "methods"
|
31
|
+
# BOM References - The object in the BOM identified by its bom-ref. This is often a component or service but may be any object type supporting bom-refs. Tools used for analysis should already be defined in the BOM, either in the metadata/tools, components, or formulation.
|
32
|
+
prop :tools, :array, items: [:string, pattern: Pattern::REF_OR_CDX_URN], unique: true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../enum"
|
4
|
+
require_relative "../pattern"
|
5
|
+
require_relative "base"
|
6
|
+
require_relative "component"
|
7
|
+
require_relative "service"
|
8
|
+
require_relative "vulnerability"
|
9
|
+
|
10
|
+
# Compositions
|
11
|
+
module SBOM
|
12
|
+
module CycloneDX
|
13
|
+
module Record
|
14
|
+
# Schema name: Composition
|
15
|
+
class Composition < Base
|
16
|
+
# BOM Reference - An optional identifier which can be used to reference the composition elsewhere in the BOM. Every bom-ref must be unique within the BOM. Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid conflicts with BOM-Links.
|
17
|
+
prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
|
18
|
+
# Aggregate - Specifies an aggregate type that describe how complete a relationship is.
|
19
|
+
prop :aggregate, :string, enum: Enum::AGGREGATE_TYPE
|
20
|
+
# BOM references - 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.
|
21
|
+
prop :assemblies, :array, items: [:string, pattern: Pattern::REF_OR_CDX_URN], unique: true
|
22
|
+
# BOM references - 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.
|
23
|
+
# TODO: Serialize to a BOMLinkElement
|
24
|
+
prop :dependencies, :array, items: [:union, of: [Component, Service]], unique: true
|
25
|
+
# BOM references - The bom-ref identifiers of the vulnerabilities being described.
|
26
|
+
# TODO: Serialize to a BOMLinkElement
|
27
|
+
prop :vulnerabilities, :array, items: Vulnerability, unique: true
|
28
|
+
# Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
|
29
|
+
prop :signature, :union, of: Signature::UNION_TYPE
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|