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.
Files changed (368) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +15 -0
  3. data/.gitlab-ci.yml +49 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +72 -0
  6. data/.vscode/settings.json +6 -0
  7. data/CHANGELOG.md +9 -0
  8. data/CODE_OF_CONDUCT.md +132 -0
  9. data/Gemfile +26 -0
  10. data/Gemfile.lock +179 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +39 -0
  13. data/Rakefile +36 -0
  14. data/Steepfile +14 -0
  15. data/bin/console +11 -0
  16. data/bin/rbs_spec +9 -0
  17. data/bin/setup +8 -0
  18. data/bom-1.6.schema.json +7334 -0
  19. data/lib/email_address_extension.rb +26 -0
  20. data/lib/sbom/cyclone_dx/enum.rb +2178 -0
  21. data/lib/sbom/cyclone_dx/field.rb +404 -0
  22. data/lib/sbom/cyclone_dx/pattern.rb +43 -0
  23. data/lib/sbom/cyclone_dx/record/advisory.rb +17 -0
  24. data/lib/sbom/cyclone_dx/record/annotation.rb +46 -0
  25. data/lib/sbom/cyclone_dx/record/attachment.rb +21 -0
  26. data/lib/sbom/cyclone_dx/record/base.rb +244 -0
  27. data/lib/sbom/cyclone_dx/record/cipher_suite.rb +23 -0
  28. data/lib/sbom/cyclone_dx/record/co2_measure.rb +18 -0
  29. data/lib/sbom/cyclone_dx/record/command.rb +18 -0
  30. data/lib/sbom/cyclone_dx/record/commit.rb +25 -0
  31. data/lib/sbom/cyclone_dx/record/component.rb +126 -0
  32. data/lib/sbom/cyclone_dx/record/component_data.rb +46 -0
  33. data/lib/sbom/cyclone_dx/record/component_evidence.rb +68 -0
  34. data/lib/sbom/cyclone_dx/record/component_identity_evidence.rb +36 -0
  35. data/lib/sbom/cyclone_dx/record/composition.rb +33 -0
  36. data/lib/sbom/cyclone_dx/record/condition.rb +20 -0
  37. data/lib/sbom/cyclone_dx/record/copyright.rb +16 -0
  38. data/lib/sbom/cyclone_dx/record/crypto_properties.rb +137 -0
  39. data/lib/sbom/cyclone_dx/record/data_governance.rb +21 -0
  40. data/lib/sbom/cyclone_dx/record/data_governance_responsible_party.rb +22 -0
  41. data/lib/sbom/cyclone_dx/record/declarations.rb +193 -0
  42. data/lib/sbom/cyclone_dx/record/definitions.rb +17 -0
  43. data/lib/sbom/cyclone_dx/record/dependency.rb +21 -0
  44. data/lib/sbom/cyclone_dx/record/diff.rb +18 -0
  45. data/lib/sbom/cyclone_dx/record/energy_consumption.rb +31 -0
  46. data/lib/sbom/cyclone_dx/record/energy_measure.rb +18 -0
  47. data/lib/sbom/cyclone_dx/record/energy_provider.rb +31 -0
  48. data/lib/sbom/cyclone_dx/record/environmental_consideration.rb +20 -0
  49. data/lib/sbom/cyclone_dx/record/event.rb +31 -0
  50. data/lib/sbom/cyclone_dx/record/external_reference.rb +25 -0
  51. data/lib/sbom/cyclone_dx/record/fairness_assessment.rb +22 -0
  52. data/lib/sbom/cyclone_dx/record/formula.rb +29 -0
  53. data/lib/sbom/cyclone_dx/record/graphic.rb +19 -0
  54. data/lib/sbom/cyclone_dx/record/graphics_collection.rb +19 -0
  55. data/lib/sbom/cyclone_dx/record/hash_data.rb +18 -0
  56. data/lib/sbom/cyclone_dx/record/identifiable_action.rb +21 -0
  57. data/lib/sbom/cyclone_dx/record/input.rb +34 -0
  58. data/lib/sbom/cyclone_dx/record/input_output_ml_parameter.rb +17 -0
  59. data/lib/sbom/cyclone_dx/record/issue.rb +36 -0
  60. data/lib/sbom/cyclone_dx/record/license.rb +90 -0
  61. data/lib/sbom/cyclone_dx/record/license_choice.rb +35 -0
  62. data/lib/sbom/cyclone_dx/record/metadata.rb +55 -0
  63. data/lib/sbom/cyclone_dx/record/model_card.rb +89 -0
  64. data/lib/sbom/cyclone_dx/record/note.rb +20 -0
  65. data/lib/sbom/cyclone_dx/record/organizational_contact.rb +26 -0
  66. data/lib/sbom/cyclone_dx/record/organizational_entity.rb +28 -0
  67. data/lib/sbom/cyclone_dx/record/output.rb +34 -0
  68. data/lib/sbom/cyclone_dx/record/parameter.rb +20 -0
  69. data/lib/sbom/cyclone_dx/record/patch.rb +23 -0
  70. data/lib/sbom/cyclone_dx/record/performance_metric.rb +30 -0
  71. data/lib/sbom/cyclone_dx/record/postal_address.rb +34 -0
  72. data/lib/sbom/cyclone_dx/record/property.rb +18 -0
  73. data/lib/sbom/cyclone_dx/record/rating.rb +27 -0
  74. data/lib/sbom/cyclone_dx/record/release_notes.rb +44 -0
  75. data/lib/sbom/cyclone_dx/record/resource_reference_choice.rb +22 -0
  76. data/lib/sbom/cyclone_dx/record/risk.rb +18 -0
  77. data/lib/sbom/cyclone_dx/record/root.rb +63 -0
  78. data/lib/sbom/cyclone_dx/record/secured_by.rb +20 -0
  79. data/lib/sbom/cyclone_dx/record/service.rb +54 -0
  80. data/lib/sbom/cyclone_dx/record/service_data.rb +32 -0
  81. data/lib/sbom/cyclone_dx/record/signature.rb +85 -0
  82. data/lib/sbom/cyclone_dx/record/standard.rb +72 -0
  83. data/lib/sbom/cyclone_dx/record/step.rb +24 -0
  84. data/lib/sbom/cyclone_dx/record/swid.rb +29 -0
  85. data/lib/sbom/cyclone_dx/record/task.rb +56 -0
  86. data/lib/sbom/cyclone_dx/record/tools.rb +20 -0
  87. data/lib/sbom/cyclone_dx/record/trigger.rb +48 -0
  88. data/lib/sbom/cyclone_dx/record/version.rb +24 -0
  89. data/lib/sbom/cyclone_dx/record/volume.rb +33 -0
  90. data/lib/sbom/cyclone_dx/record/vulnerability.rb +119 -0
  91. data/lib/sbom/cyclone_dx/record/vulnerability_source.rb +20 -0
  92. data/lib/sbom/cyclone_dx/record/workflow.rb +59 -0
  93. data/lib/sbom/cyclone_dx/record/workspace.rb +45 -0
  94. data/lib/sbom/cyclone_dx/record.rb +12 -0
  95. data/lib/sbom/cyclone_dx/validator/array_validator.rb +66 -0
  96. data/lib/sbom/cyclone_dx/validator/base_validator.rb +43 -0
  97. data/lib/sbom/cyclone_dx/validator/boolean_validator.rb +16 -0
  98. data/lib/sbom/cyclone_dx/validator/date_time_validator.rb +29 -0
  99. data/lib/sbom/cyclone_dx/validator/email_address_validator.rb +31 -0
  100. data/lib/sbom/cyclone_dx/validator/float_validator.rb +30 -0
  101. data/lib/sbom/cyclone_dx/validator/integer_validator.rb +30 -0
  102. data/lib/sbom/cyclone_dx/validator/record_validator.rb +26 -0
  103. data/lib/sbom/cyclone_dx/validator/string_validator.rb +33 -0
  104. data/lib/sbom/cyclone_dx/validator/union_validator.rb +39 -0
  105. data/lib/sbom/cyclone_dx/validator/uri_validator.rb +32 -0
  106. data/lib/sbom/cyclone_dx/validator.rb +32 -0
  107. data/lib/sbom/cyclone_dx/version.rb +7 -0
  108. data/lib/sbom/cyclone_dx.rb +39 -0
  109. data/rbs_collection.lock.yaml +288 -0
  110. data/rbs_collection.yaml +31 -0
  111. data/sbom-cyclone_dx.gemspec +32 -0
  112. data/sig/email_address_extension.rbs +14 -0
  113. data/sig/sbom/cyclone_dx/enum.rbs +93 -0
  114. data/sig/sbom/cyclone_dx/field.rbs +434 -0
  115. data/sig/sbom/cyclone_dx/pattern.rbs +24 -0
  116. data/sig/sbom/cyclone_dx/record/advisory.rbs +19 -0
  117. data/sig/sbom/cyclone_dx/record/annotation.rbs +63 -0
  118. data/sig/sbom/cyclone_dx/record/attachment.rbs +24 -0
  119. data/sig/sbom/cyclone_dx/record/base.rbs +62 -0
  120. data/sig/sbom/cyclone_dx/record/cipher_suite.rbs +24 -0
  121. data/sig/sbom/cyclone_dx/record/co2_measure.rbs +14 -0
  122. data/sig/sbom/cyclone_dx/record/command.rbs +19 -0
  123. data/sig/sbom/cyclone_dx/record/commit.rbs +34 -0
  124. data/sig/sbom/cyclone_dx/record/component.rbs +203 -0
  125. data/sig/sbom/cyclone_dx/record/component_data.rbs +73 -0
  126. data/sig/sbom/cyclone_dx/record/component_evidence.rbs +115 -0
  127. data/sig/sbom/cyclone_dx/record/component_identity_evidence.rbs +53 -0
  128. data/sig/sbom/cyclone_dx/record/composition.rbs +39 -0
  129. data/sig/sbom/cyclone_dx/record/condition.rbs +24 -0
  130. data/sig/sbom/cyclone_dx/record/copyright.rbs +14 -0
  131. data/sig/sbom/cyclone_dx/record/crypto_properties.rbs +268 -0
  132. data/sig/sbom/cyclone_dx/record/data_governance.rbs +24 -0
  133. data/sig/sbom/cyclone_dx/record/data_governance_responsible_party.rbs +19 -0
  134. data/sig/sbom/cyclone_dx/record/declarations.rbs +352 -0
  135. data/sig/sbom/cyclone_dx/record/definitions.rbs +14 -0
  136. data/sig/sbom/cyclone_dx/record/dependency.rbs +24 -0
  137. data/sig/sbom/cyclone_dx/record/diff.rbs +19 -0
  138. data/sig/sbom/cyclone_dx/record/energy_consumption.rbs +39 -0
  139. data/sig/sbom/cyclone_dx/record/energy_measure.rbs +14 -0
  140. data/sig/sbom/cyclone_dx/record/energy_provider.rbs +39 -0
  141. data/sig/sbom/cyclone_dx/record/environmental_consideration.rbs +19 -0
  142. data/sig/sbom/cyclone_dx/record/event.rbs +44 -0
  143. data/sig/sbom/cyclone_dx/record/external_reference.rbs +29 -0
  144. data/sig/sbom/cyclone_dx/record/fairness_assessment.rbs +29 -0
  145. data/sig/sbom/cyclone_dx/record/formula.rbs +34 -0
  146. data/sig/sbom/cyclone_dx/record/graphic.rbs +19 -0
  147. data/sig/sbom/cyclone_dx/record/graphics_collection.rbs +19 -0
  148. data/sig/sbom/cyclone_dx/record/hash_data.rbs +19 -0
  149. data/sig/sbom/cyclone_dx/record/identifiable_action.rbs +24 -0
  150. data/sig/sbom/cyclone_dx/record/input.rbs +44 -0
  151. data/sig/sbom/cyclone_dx/record/input_output_ml_parameter.rbs +14 -0
  152. data/sig/sbom/cyclone_dx/record/issue.rbs +53 -0
  153. data/sig/sbom/cyclone_dx/record/license.rbs +134 -0
  154. data/sig/sbom/cyclone_dx/record/license_choice.rbs +39 -0
  155. data/sig/sbom/cyclone_dx/record/metadata.rbs +82 -0
  156. data/sig/sbom/cyclone_dx/record/model_card.rbs +143 -0
  157. data/sig/sbom/cyclone_dx/record/note.rbs +19 -0
  158. data/sig/sbom/cyclone_dx/record/organizational_contact.rbs +29 -0
  159. data/sig/sbom/cyclone_dx/record/organizational_entity.rbs +34 -0
  160. data/sig/sbom/cyclone_dx/record/output.rbs +44 -0
  161. data/sig/sbom/cyclone_dx/record/parameter.rbs +24 -0
  162. data/sig/sbom/cyclone_dx/record/patch.rbs +24 -0
  163. data/sig/sbom/cyclone_dx/record/performance_metric.rbs +43 -0
  164. data/sig/sbom/cyclone_dx/record/postal_address.rbs +44 -0
  165. data/sig/sbom/cyclone_dx/record/property.rbs +19 -0
  166. data/sig/sbom/cyclone_dx/record/rating.rbs +39 -0
  167. data/sig/sbom/cyclone_dx/record/release_notes.rbs +64 -0
  168. data/sig/sbom/cyclone_dx/record/resource_reference_choice.rbs +19 -0
  169. data/sig/sbom/cyclone_dx/record/risk.rbs +19 -0
  170. data/sig/sbom/cyclone_dx/record/root.rbs +84 -0
  171. data/sig/sbom/cyclone_dx/record/secured_by.rbs +19 -0
  172. data/sig/sbom/cyclone_dx/record/service.rbs +99 -0
  173. data/sig/sbom/cyclone_dx/record/service_data.rbs +44 -0
  174. data/sig/sbom/cyclone_dx/record/signature.rbs +130 -0
  175. data/sig/sbom/cyclone_dx/record/standard.rbs +132 -0
  176. data/sig/sbom/cyclone_dx/record/step.rbs +29 -0
  177. data/sig/sbom/cyclone_dx/record/swid.rbs +44 -0
  178. data/sig/sbom/cyclone_dx/record/task.rbs +84 -0
  179. data/sig/sbom/cyclone_dx/record/tools.rbs +19 -0
  180. data/sig/sbom/cyclone_dx/record/trigger.rbs +69 -0
  181. data/sig/sbom/cyclone_dx/record/version.rbs +24 -0
  182. data/sig/sbom/cyclone_dx/record/volume.rbs +49 -0
  183. data/sig/sbom/cyclone_dx/record/vulnerability.rbs +209 -0
  184. data/sig/sbom/cyclone_dx/record/vulnerability_source.rbs +19 -0
  185. data/sig/sbom/cyclone_dx/record/workflow.rbs +94 -0
  186. data/sig/sbom/cyclone_dx/record/workspace.rbs +69 -0
  187. data/sig/sbom/cyclone_dx/record.rbs +161 -0
  188. data/sig/sbom/cyclone_dx/type.rbs +16 -0
  189. data/sig/sbom/cyclone_dx/validator/array_validator.rbs +31 -0
  190. data/sig/sbom/cyclone_dx/validator/base_validator.rbs +21 -0
  191. data/sig/sbom/cyclone_dx/validator/boolean_validator.rbs +9 -0
  192. data/sig/sbom/cyclone_dx/validator/date_time_validator.rbs +10 -0
  193. data/sig/sbom/cyclone_dx/validator/email_address_validator.rbs +10 -0
  194. data/sig/sbom/cyclone_dx/validator/float_validator.rbs +12 -0
  195. data/sig/sbom/cyclone_dx/validator/integer_validator.rbs +12 -0
  196. data/sig/sbom/cyclone_dx/validator/record_validator.rbs +12 -0
  197. data/sig/sbom/cyclone_dx/validator/string_validator.rbs +14 -0
  198. data/sig/sbom/cyclone_dx/validator/union_validator.rbs +24 -0
  199. data/sig/sbom/cyclone_dx/validator/uri_validator.rbs +10 -0
  200. data/sig/sbom/cyclone_dx/validator.rbs +66 -0
  201. data/sig/sbom/cyclone_dx.rbs +13 -0
  202. data/sig/types.rbs +45 -0
  203. data/spec/email_address_extension_spec.rb +27 -0
  204. data/spec/factories/factory_helper.rb +78 -0
  205. data/spec/factories/record/advisory_factory.rb +11 -0
  206. data/spec/factories/record/annotation_factory.rb +63 -0
  207. data/spec/factories/record/attachment_factory.rb +9 -0
  208. data/spec/factories/record/cipher_suite_factory.rb +26 -0
  209. data/spec/factories/record/co2_measure_factory.rb +9 -0
  210. data/spec/factories/record/command_factory.rb +10 -0
  211. data/spec/factories/record/commit_factory.rb +13 -0
  212. data/spec/factories/record/component_data_factory.rb +28 -0
  213. data/spec/factories/record/component_evidence_factory.rb +44 -0
  214. data/spec/factories/record/component_factory.rb +102 -0
  215. data/spec/factories/record/component_identity_evidence_factory.rb +25 -0
  216. data/spec/factories/record/composition_factory.rb +20 -0
  217. data/spec/factories/record/condition_factory.rb +11 -0
  218. data/spec/factories/record/copyright_factory.rb +9 -0
  219. data/spec/factories/record/crypto_properties_factory.rb +191 -0
  220. data/spec/factories/record/data_governance_factory.rb +11 -0
  221. data/spec/factories/record/data_governance_responsible_party_factory.rb +31 -0
  222. data/spec/factories/record/declarations_factory.rb +145 -0
  223. data/spec/factories/record/definitions_factory.rb +9 -0
  224. data/spec/factories/record/dependency_factory.rb +12 -0
  225. data/spec/factories/record/diff_factory.rb +24 -0
  226. data/spec/factories/record/energy_consumption_factory.rb +15 -0
  227. data/spec/factories/record/energy_measure_factory.rb +9 -0
  228. data/spec/factories/record/energy_provider_factory.rb +15 -0
  229. data/spec/factories/record/environmental_consideration_factory.rb +10 -0
  230. data/spec/factories/record/event_factory.rb +15 -0
  231. data/spec/factories/record/external_reference_factory.rb +13 -0
  232. data/spec/factories/record/fairness_assessment_factory.rb +12 -0
  233. data/spec/factories/record/formula_factory.rb +13 -0
  234. data/spec/factories/record/graphic_factory.rb +10 -0
  235. data/spec/factories/record/graphics_collection_factory.rb +10 -0
  236. data/spec/factories/record/hash_data_factory.rb +10 -0
  237. data/spec/factories/record/identifiable_action_factory.rb +11 -0
  238. data/spec/factories/record/input_factory.rb +36 -0
  239. data/spec/factories/record/input_output_ml_parameter_factory.rb +9 -0
  240. data/spec/factories/record/issue_factory.rb +22 -0
  241. data/spec/factories/record/license_choice_factory.rb +23 -0
  242. data/spec/factories/record/license_factory.rb +99 -0
  243. data/spec/factories/record/metadata_factory.rb +38 -0
  244. data/spec/factories/record/model_card_factory.rb +59 -0
  245. data/spec/factories/record/note_factory.rb +11 -0
  246. data/spec/factories/record/organizational_contact_factory.rb +12 -0
  247. data/spec/factories/record/organizational_entity_factory.rb +13 -0
  248. data/spec/factories/record/output_factory.rb +32 -0
  249. data/spec/factories/record/parameter_factory.rb +11 -0
  250. data/spec/factories/record/patch_factory.rb +12 -0
  251. data/spec/factories/record/performance_metric_factory.rb +20 -0
  252. data/spec/factories/record/postal_address_factory.rb +14 -0
  253. data/spec/factories/record/property_factory.rb +11 -0
  254. data/spec/factories/record/rating_factory.rb +14 -0
  255. data/spec/factories/record/release_notes_factory.rb +20 -0
  256. data/spec/factories/record/resource_reference_choice_factory.rb +27 -0
  257. data/spec/factories/record/risk_factory.rb +10 -0
  258. data/spec/factories/record/root_factory.rb +23 -0
  259. data/spec/factories/record/secured_by_factory.rb +10 -0
  260. data/spec/factories/record/service_data_factory.rb +16 -0
  261. data/spec/factories/record/service_factory.rb +27 -0
  262. data/spec/factories/record/signature_factory.rb +50 -0
  263. data/spec/factories/record/standard_factory.rb +37 -0
  264. data/spec/factories/record/step_factory.rb +12 -0
  265. data/spec/factories/record/swid_factory.rb +16 -0
  266. data/spec/factories/record/task_factory.rb +24 -0
  267. data/spec/factories/record/tools_factory.rb +10 -0
  268. data/spec/factories/record/trigger_factory.rb +21 -0
  269. data/spec/factories/record/version_factory.rb +19 -0
  270. data/spec/factories/record/volume_factory.rb +16 -0
  271. data/spec/factories/record/vulnerability_factory.rb +70 -0
  272. data/spec/factories/record/vulnerability_source_factory.rb +10 -0
  273. data/spec/factories/record/workflow_factory.rb +26 -0
  274. data/spec/factories/record/workspace_factory.rb +21 -0
  275. data/spec/factories/record_factory.rb +159 -0
  276. data/spec/fixtures/cipher_info.yml +948 -0
  277. data/spec/fixtures/purl_data.yml +0 -0
  278. data/spec/sbom/cyclone_dx/enum_spec.rb +30 -0
  279. data/spec/sbom/cyclone_dx/field_spec.rb +104 -0
  280. data/spec/sbom/cyclone_dx/pattern_spec.rb +18 -0
  281. data/spec/sbom/cyclone_dx/record/advisory_spec.rb +14 -0
  282. data/spec/sbom/cyclone_dx/record/annotation_spec.rb +31 -0
  283. data/spec/sbom/cyclone_dx/record/attachment_spec.rb +14 -0
  284. data/spec/sbom/cyclone_dx/record/base_spec.rb +363 -0
  285. data/spec/sbom/cyclone_dx/record/cipher_suite_spec.rb +14 -0
  286. data/spec/sbom/cyclone_dx/record/co2_measure_spec.rb +14 -0
  287. data/spec/sbom/cyclone_dx/record/command_spec.rb +14 -0
  288. data/spec/sbom/cyclone_dx/record/commit_spec.rb +14 -0
  289. data/spec/sbom/cyclone_dx/record/component_data_spec.rb +14 -0
  290. data/spec/sbom/cyclone_dx/record/component_evidence_spec.rb +14 -0
  291. data/spec/sbom/cyclone_dx/record/component_identity_evidence_spec.rb +14 -0
  292. data/spec/sbom/cyclone_dx/record/component_spec.rb +14 -0
  293. data/spec/sbom/cyclone_dx/record/composition_spec.rb +14 -0
  294. data/spec/sbom/cyclone_dx/record/condition_spec.rb +14 -0
  295. data/spec/sbom/cyclone_dx/record/copyright_spec.rb +14 -0
  296. data/spec/sbom/cyclone_dx/record/crypto_properties_spec.rb +14 -0
  297. data/spec/sbom/cyclone_dx/record/data_governance_responsible_party_spec.rb +19 -0
  298. data/spec/sbom/cyclone_dx/record/data_governance_spec.rb +14 -0
  299. data/spec/sbom/cyclone_dx/record/declarations_spec.rb +14 -0
  300. data/spec/sbom/cyclone_dx/record/definitions_spec.rb +14 -0
  301. data/spec/sbom/cyclone_dx/record/dependency_spec.rb +14 -0
  302. data/spec/sbom/cyclone_dx/record/diff_spec.rb +14 -0
  303. data/spec/sbom/cyclone_dx/record/energy_consumption_spec.rb +14 -0
  304. data/spec/sbom/cyclone_dx/record/energy_measure_spec.rb +14 -0
  305. data/spec/sbom/cyclone_dx/record/energy_provider_spec.rb +14 -0
  306. data/spec/sbom/cyclone_dx/record/environmental_consideration_spec.rb +14 -0
  307. data/spec/sbom/cyclone_dx/record/event_spec.rb +14 -0
  308. data/spec/sbom/cyclone_dx/record/external_reference_spec.rb +14 -0
  309. data/spec/sbom/cyclone_dx/record/fairness_assessment_spec.rb +14 -0
  310. data/spec/sbom/cyclone_dx/record/formula_spec.rb +14 -0
  311. data/spec/sbom/cyclone_dx/record/graphic_spec.rb +14 -0
  312. data/spec/sbom/cyclone_dx/record/graphics_collection_spec.rb +14 -0
  313. data/spec/sbom/cyclone_dx/record/hash_data_spec.rb +14 -0
  314. data/spec/sbom/cyclone_dx/record/identifiable_action_spec.rb +14 -0
  315. data/spec/sbom/cyclone_dx/record/input_output_ml_parameter_spec.rb +14 -0
  316. data/spec/sbom/cyclone_dx/record/input_spec.rb +14 -0
  317. data/spec/sbom/cyclone_dx/record/issue_spec.rb +14 -0
  318. data/spec/sbom/cyclone_dx/record/license_choice_spec.rb +26 -0
  319. data/spec/sbom/cyclone_dx/record/license_spec.rb +14 -0
  320. data/spec/sbom/cyclone_dx/record/metadata_spec.rb +14 -0
  321. data/spec/sbom/cyclone_dx/record/model_card_spec.rb +14 -0
  322. data/spec/sbom/cyclone_dx/record/note_spec.rb +14 -0
  323. data/spec/sbom/cyclone_dx/record/organizational_contact_spec.rb +14 -0
  324. data/spec/sbom/cyclone_dx/record/organizational_entity_spec.rb +14 -0
  325. data/spec/sbom/cyclone_dx/record/output_spec.rb +14 -0
  326. data/spec/sbom/cyclone_dx/record/parameter_spec.rb +14 -0
  327. data/spec/sbom/cyclone_dx/record/patch_spec.rb +14 -0
  328. data/spec/sbom/cyclone_dx/record/performance_metric_spec.rb +14 -0
  329. data/spec/sbom/cyclone_dx/record/postal_address_spec.rb +14 -0
  330. data/spec/sbom/cyclone_dx/record/property_spec.rb +14 -0
  331. data/spec/sbom/cyclone_dx/record/rating_spec.rb +14 -0
  332. data/spec/sbom/cyclone_dx/record/release_notes_spec.rb +14 -0
  333. data/spec/sbom/cyclone_dx/record/resource_reference_choice_spec.rb +14 -0
  334. data/spec/sbom/cyclone_dx/record/risk_spec.rb +14 -0
  335. data/spec/sbom/cyclone_dx/record/root_spec.rb +14 -0
  336. data/spec/sbom/cyclone_dx/record/secured_by_spec.rb +14 -0
  337. data/spec/sbom/cyclone_dx/record/service_data_spec.rb +14 -0
  338. data/spec/sbom/cyclone_dx/record/service_spec.rb +14 -0
  339. data/spec/sbom/cyclone_dx/record/signature_spec.rb +26 -0
  340. data/spec/sbom/cyclone_dx/record/standard_spec.rb +14 -0
  341. data/spec/sbom/cyclone_dx/record/step_spec.rb +14 -0
  342. data/spec/sbom/cyclone_dx/record/swid_spec.rb +14 -0
  343. data/spec/sbom/cyclone_dx/record/task_spec.rb +14 -0
  344. data/spec/sbom/cyclone_dx/record/tools_spec.rb +14 -0
  345. data/spec/sbom/cyclone_dx/record/trigger_spec.rb +14 -0
  346. data/spec/sbom/cyclone_dx/record/version_spec.rb +14 -0
  347. data/spec/sbom/cyclone_dx/record/volume_spec.rb +14 -0
  348. data/spec/sbom/cyclone_dx/record/vulnerability_source_spec.rb +14 -0
  349. data/spec/sbom/cyclone_dx/record/vulnerability_spec.rb +14 -0
  350. data/spec/sbom/cyclone_dx/record/workflow_spec.rb +14 -0
  351. data/spec/sbom/cyclone_dx/record/workspace_spec.rb +14 -0
  352. data/spec/sbom/cyclone_dx/record_spec.rb +7 -0
  353. data/spec/sbom/cyclone_dx/validator/array_validator_spec.rb +184 -0
  354. data/spec/sbom/cyclone_dx/validator/base_validator_spec.rb +71 -0
  355. data/spec/sbom/cyclone_dx/validator/boolean_validator_spec.rb +26 -0
  356. data/spec/sbom/cyclone_dx/validator/date_time_validator_spec.rb +28 -0
  357. data/spec/sbom/cyclone_dx/validator/email_address_validator_spec.rb +23 -0
  358. data/spec/sbom/cyclone_dx/validator/float_validator_spec.rb +71 -0
  359. data/spec/sbom/cyclone_dx/validator/integer_validator_spec.rb +71 -0
  360. data/spec/sbom/cyclone_dx/validator/record_validator_spec.rb +35 -0
  361. data/spec/sbom/cyclone_dx/validator/string_validator_spec.rb +94 -0
  362. data/spec/sbom/cyclone_dx/validator/union_validator_spec.rb +65 -0
  363. data/spec/sbom/cyclone_dx/validator/uri_validator_spec.rb +21 -0
  364. data/spec/sbom/cyclone_dx/validator_spec.rb +38 -0
  365. data/spec/sbom/cyclone_dx/version_spec.rb +9 -0
  366. data/spec/sbom/cyclone_dx_spec.rb +7 -0
  367. data/spec/spec_helper.rb +39 -0
  368. metadata +377 -6
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ # Performance Metric
6
+ module SBOM
7
+ module CycloneDX
8
+ module Record
9
+ # Schema name: PerformanceMetric
10
+ class PerformanceMetric < Base
11
+ # Schema name: ConfidenceInterval
12
+ class ConfidenceInterval < Base
13
+ # Lower Bound - The lower bound of the confidence interval.
14
+ prop :lower_bound, :string
15
+ # Upper Bound - The upper bound of the confidence interval.
16
+ prop :upper_bound, :string
17
+ end
18
+
19
+ # Type - The type of performance metric.
20
+ prop :type, :string
21
+ # Value - The value of the performance metric.
22
+ prop :value, :string
23
+ # Slice - The name of the slice this metric was computed on. By default, assume this metric is not sliced.
24
+ prop :slice, :string
25
+ # Confidence Interval - The confidence interval of the metric.
26
+ prop :confidence_interval, ConfidenceInterval
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+
6
+ # Postal address - An address used to identify a contactable location.
7
+ module SBOM
8
+ module CycloneDX
9
+ module Record
10
+ # Schema name: PostalAddress
11
+ class PostalAddress < Base
12
+ # BOM Reference - An optional identifier which can be used to reference the address 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.
13
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
14
+ # Country - The country name or the two-letter ISO 3166-1 country code.
15
+ prop :country, :string
16
+ # Region - The region or state in the country.
17
+ # Example: "Texas"
18
+ prop :region, :string
19
+ # Locality - The locality or city within the country.
20
+ # Example: "Austin"
21
+ prop :locality, :string
22
+ # Post Office Box Number - The post office box number.
23
+ # Example: 901
24
+ prop :post_office_box_number, :string
25
+ # Postal Code - The postal code.
26
+ # Example: "78758"
27
+ prop :postal_code, :string
28
+ # Street Address - The street address.
29
+ # Example: "100 Main Street"
30
+ prop :street_address, :string
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ # Lightweight name-value pair - 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.
6
+ module SBOM
7
+ module CycloneDX
8
+ module Record
9
+ # Schema name: Property
10
+ class Property < Base
11
+ # Name - The name of the property. Duplicate names are allowed, each potentially having a different value.
12
+ prop :name, :string, required: true
13
+ # Value - The value of the property.
14
+ prop :value, :string
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../enum"
4
+ require_relative "base"
5
+ require_relative "vulnerability_source"
6
+
7
+ # Rating - Defines the severity or risk ratings of a vulnerability.
8
+ module SBOM
9
+ module CycloneDX
10
+ module Record
11
+ # Schema name: Rating
12
+ class Rating < Base
13
+ # The source that calculated the severity or risk rating of the vulnerability.
14
+ prop :source, VulnerabilitySource
15
+ # Score - The numerical score of the rating.
16
+ prop :score, :float
17
+ # Textual representation of the severity that corresponds to the numerical score of the rating.
18
+ prop :severity, :string, enum: Enum::SEVERITY
19
+ prop :score_method, :string, enum: Enum::SCORE_METHOD, json_name: "method"
20
+ # Vector - Textual representation of the metric values used to score the vulnerability
21
+ prop :vector, :string
22
+ # Justification - An optional reason for rating the vulnerability as it was
23
+ prop :justification, :string
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+ require_relative "issue"
5
+ require_relative "note"
6
+ require_relative "property"
7
+
8
+ # Release notes
9
+ module SBOM
10
+ module CycloneDX
11
+ module Record
12
+ # Schema name: ReleaseNotes
13
+ class ReleaseNotes < Base
14
+ # Type - The software versioning type. It is recommended that the release type use one of 'major', 'minor', 'patch', 'pre-release', or 'internal'. Representing all possible software release types is not practical, so standardizing on the recommended values, whenever possible, is strongly encouraged.
15
+ # * major = A major release may contain significant changes or may introduce breaking changes.
16
+ # * minor = A minor release, also known as an update, may contain a smaller number of changes than major releases.
17
+ # * patch = Patch releases are typically unplanned and may resolve defects or important security issues.
18
+ # * pre-release = A pre-release may include alpha, beta, or release candidates and typically have limited support. They provide the ability to preview a release prior to its general availability.
19
+ # * internal = Internal releases are not for public consumption and are intended to be used exclusively by the project or manufacturer that produced it.
20
+ prop :type, :string, required: true
21
+ # Title - The title of the release.
22
+ prop :title, :string
23
+ # Featured image - The URL to an image that may be prominently displayed with the release note.
24
+ prop :featured_image, :uri
25
+ # Social image - The URL to an image that may be used in messaging on social media platforms.
26
+ prop :social_image, :uri
27
+ # Description - A short description of the release.
28
+ prop :description, :string
29
+ # Timestamp - The date and time (timestamp) when the release note was created.
30
+ prop :timestamp, :date_time
31
+ # Aliases - One or more alternate names the release may be referred to. This may include unofficial terms used by development and marketing teams (e.g. code names).
32
+ prop :aliases, :array, items: :string
33
+ # Tags
34
+ prop :tags, :array, items: :string
35
+ # Resolves - A collection of issues that have been resolved.
36
+ prop :resolves, :array, items: Issue
37
+ # Notes - Zero or more release notes containing the locale and content. Multiple note objects may be specified to support release notes in a wide variety of languages.
38
+ prop :notes, :array, items: Note
39
+ # 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.
40
+ prop :properties, :array, items: Property
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+ require_relative "external_reference"
6
+
7
+ # Resource reference choice - A reference to a locally defined resource (e.g., a bom-ref) or an externally accessible resource.
8
+ module SBOM
9
+ module CycloneDX
10
+ module Record
11
+ # Schema name: ResourceReferenceChoice
12
+ class ResourceReferenceChoice < Base
13
+ # BOM Reference - References an object by its bom-ref attribute
14
+ prop :ref, :string, pattern: Pattern::REF_OR_CDX_URN
15
+ # External reference - Reference to an externally accessible resource.
16
+ prop :external_reference, ExternalReference
17
+
18
+ validate :ref, :external_reference, presence: :any
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+
5
+ # Risk
6
+ module SBOM
7
+ module CycloneDX
8
+ module Record
9
+ # Schema name: Risk
10
+ class Risk < Base
11
+ # Name - The name of the risk.
12
+ prop :name, :string
13
+ # Mitigation Strategy - Strategy used to address this risk.
14
+ prop :mitigation_strategy, :string
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+ require_relative "metadata"
6
+ require_relative "component"
7
+ require_relative "service"
8
+ require_relative "external_reference"
9
+ require_relative "dependency"
10
+ require_relative "composition"
11
+ require_relative "vulnerability"
12
+ require_relative "annotation"
13
+ require_relative "formula"
14
+ require_relative "declarations"
15
+ require_relative "definitions"
16
+ require_relative "signature"
17
+ require_relative "property"
18
+
19
+ # CycloneDX Bill of Materials Standard
20
+ module SBOM
21
+ module CycloneDX
22
+ module Record
23
+ # Schema name: Root
24
+ class Root < Base
25
+ # BOM Serial Number - Every BOM generated SHOULD have a unique serial number, even if the contents of the BOM have not changed over time. If specified, the serial number must conform to [RFC 4122](https://www.ietf.org/rfc/rfc4122.html). Use of serial numbers is recommended.
26
+ prop :serial_number,
27
+ :string,
28
+ pattern: Pattern::BOM_SERIAL_NUMBER,
29
+ default: -> { "urn:uuid:#{SecureRandom.uuid}" }
30
+ # Version - Whenever an existing BOM is modified, either manually or through automated processes, the version of the BOM SHOULD be incremented by 1. When a system is presented with multiple BOMs with identical serial numbers, the system SHOULD use the most recent version of the BOM. The default version is '1'.
31
+ prop :version, :integer, minimum: 1, required: true, default: 1
32
+ # BOM Metadata - Provides additional information about a BOM.
33
+ prop :metadata, Metadata
34
+ # Components - A list of software and hardware components.
35
+ prop :components, :array, items: Component, unique: true
36
+ # Services - A list of services. This may include microservices, function-as-a-service, and other types of network or intra-process services.
37
+ prop :services, :array, items: Service, unique: true
38
+ # 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.
39
+ prop :external_references, :array, items: ExternalReference
40
+ # Dependencies - Provides the ability to document dependency relationships including provided & implemented components.
41
+ prop :dependencies, :array, items: Dependency, unique: true
42
+ # Compositions - Compositions describe constituent parts (including components, services, and dependency relationships) and their completeness. The completeness of vulnerabilities expressed in a BOM may also be described.
43
+ prop :compositions, :array, items: Composition, unique: true
44
+ # Vulnerabilities - Vulnerabilities identified in components or services.
45
+ prop :vulnerabilities, :array, items: Vulnerability, unique: true
46
+ # Annotations - Comments made by people, organizations, or tools about any object with a bom-ref, such as components, services, vulnerabilities, or the BOM itself. Unlike inventory information, annotations may contain opinions or commentary from various stakeholders. Annotations may be inline (with inventory) or externalized via BOM-Link and may optionally be signed.
47
+ prop :annotations, :array, items: Annotation, unique: true
48
+ # Formulation - Describes how a component or service was manufactured or deployed. This is achieved through the use of formulas, workflows, tasks, and steps, which declare the precise steps to reproduce along with the observed formulas describing the steps which transpired in the manufacturing process.
49
+ prop :formulation, :array, items: Formula, unique: true
50
+ # Declarations - The list of declarations which describe the conformance to standards. Each declaration may include attestations, claims, and evidence.
51
+ prop :declarations, Declarations
52
+ # Definitions - A collection of reusable objects that are defined and may be used elsewhere in the BOM.
53
+ prop :definitions, Definitions
54
+ # 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.
55
+ prop :properties, :array, items: Property
56
+ # Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
57
+ prop :signature, :union, of: Signature::UNION_TYPE
58
+ const :bom_format, :string, "CycloneDX"
59
+ const :spec_version, :string, "1.6"
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+
6
+ # Secured By - Specifies the mechanism by which the cryptographic asset is secured by
7
+ module SBOM
8
+ module CycloneDX
9
+ module Record
10
+ # Schema name: SecuredBy
11
+ class SecuredBy < Base
12
+ # Mechanism - Specifies the mechanism by which the cryptographic asset is secured by.
13
+ # Examples: "HSM", "TPM", "SGX", "Software", "None"
14
+ prop :mechanism, :string
15
+ # Algorithm Reference - The bom-ref to the algorithm.
16
+ prop :algorithm_ref, :string, pattern: Pattern::REF_LINK
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+ require_relative "service_data"
6
+
7
+ # Service
8
+ module SBOM
9
+ module CycloneDX
10
+ module Record
11
+ # Schema name: Service
12
+ class Service < Base
13
+ # BOM Reference - An optional identifier which can be used to reference the service 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.
14
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
15
+ # Provider - The organization that provides the service.
16
+ prop :provider, OrganizationalEntity
17
+ # Service Group - 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.
18
+ # Example: "com.acme"
19
+ prop :group, :string
20
+ # Service Name - The name of the service. This will often be a shortened, single name of the service.
21
+ # Example: "ticker-service"
22
+ prop :name, :string, required: true
23
+ # Service Version - The service version.
24
+ prop :version, :string
25
+ # Service Description - Specifies a description for the service
26
+ prop :description, :string
27
+ # Endpoints - The endpoint URIs of the service. Multiple endpoints are allowed.
28
+ prop :endpoints, :array, items: :uri
29
+ # Authentication Required - 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.
30
+ prop :authenticated, :boolean
31
+ # Crosses Trust Boundary - 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.
32
+ prop :x_trust_boundary, :boolean, json_name: "x-trust-boundary"
33
+ # Trust Zone - The name of the trust zone the service resides in.
34
+ prop :trust_zone, :string
35
+ # Data - Specifies information about the data including the directional flow of data and the data classification.
36
+ prop :data, :array, items: ServiceData
37
+ # Service License(s)
38
+ prop :licenses, :array, items: [:union, of: LicenseChoice::UNION_TYPE]
39
+ # 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.
40
+ prop :external_references, :array, items: ExternalReference
41
+ # Services - A list of services included or deployed behind the parent service. This is not a dependency tree. It provides a way to specify a hierarchical representation of service assemblies.
42
+ prop :services, :array, items: Service
43
+ # Release notes - Specifies optional release notes.
44
+ prop :release_notes, ReleaseNotes
45
+ # 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.
46
+ prop :properties, :array, items: Property
47
+ # Tags
48
+ prop :tags, :array, items: :string
49
+ # Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
50
+ prop :signature, :union, of: Signature::UNION_TYPE
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../enum"
4
+ require_relative "../pattern"
5
+ require_relative "base"
6
+ require_relative "data_governance"
7
+
8
+ module SBOM
9
+ module CycloneDX
10
+ module Record
11
+ # Schema name: ServiceData
12
+ class ServiceData < Base
13
+ # Directional Flow - Specifies the flow direction of the data. Direction is relative to the service. Inbound flow states that data enters the service. Outbound flow states that data leaves the service. Bi-directional states that data flows both ways and unknown states that the direction is not known.
14
+ prop :flow, :string, enum: Enum::DATA_FLOW_DIRECTION, required: true
15
+ # Data Classification - Data classification tags data according to its type, sensitivity, and value if altered, stolen, or destroyed.
16
+ prop :classification, :string, required: true
17
+ # Name - Name for the defined data
18
+ # Example: "Credit card reporting"
19
+ prop :name, :string
20
+ # Description - Short description of the data content and usage
21
+ # Example: "Credit card information being exchanged in between the web app and the database"
22
+ prop :description, :string
23
+ # Data Governance
24
+ prop :governance, DataGovernance
25
+ # Source - The URI, URL, or BOM-Link of the components or services the data came in from
26
+ prop :source, :union, of: [:uri, [:string, pattern: Pattern::CDX_URN]], required: true
27
+ # Destination - The URI, URL, or BOM-Link of the components or services the data is sent to
28
+ prop :destination, :union, of: [:uri, [:string, pattern: Pattern::CDX_URN]], required: true
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+ require_relative "../validator"
5
+
6
+ # Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
7
+ module SBOM
8
+ module CycloneDX
9
+ module Record
10
+ module Signature
11
+ # Schema name: JSFSignature
12
+ class JSFSignature < Base
13
+ module PublicKey
14
+ # Schema name: ECPublicKey
15
+ class EC < Base
16
+ const :kty, :string, "EC"
17
+ prop :crv, :string, enum: Enum::SIGNATURE_EC_CRV, required: true
18
+ prop :x, :string, required: true
19
+ prop :y, :string, required: true
20
+ end
21
+
22
+ # Schema name: OKPPublicKey
23
+ class OKP < Base
24
+ const :kty, :string, "OKP"
25
+ prop :crv, :string, enum: Enum::SIGNATURE_OKP_CRV, required: true
26
+ prop :x, :string, required: true
27
+ end
28
+
29
+ # Schema name: RSAPublicKey
30
+ class RSA < Base
31
+ const :kty, :string, "RSA"
32
+ prop :n, :string, required: true
33
+ prop :e, :string, required: true
34
+ end
35
+
36
+ UNION_TYPE = [EC, OKP, RSA].freeze #: [singleton(EC), singleton(OKP), singleton(RSA)]
37
+
38
+ def self.new(kty:, crv: nil, x: nil, y: nil, n: nil, e: nil) # rubocop:disable Naming/MethodParameterName,Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
39
+ case kty
40
+ when "EC"
41
+ raise "`n` and `e` must be nil when kty == \"EC\"" unless n.nil? && e.nil?
42
+ if crv.nil? || x.nil? || y.nil?
43
+ raise ArgumentError, "`crv`, `x`, and `y` must not be nil when kty == \"EC\""
44
+ end
45
+
46
+ EC.new(crv: crv, x: x, y: y)
47
+ when "OKP"
48
+ raise "`y`, `n` and `e` must be nil when kty == \"OKP\"" unless y.nil? && n.nil? && e.nil?
49
+ raise ArgumentError, "`crv` and `x` must not be nil when kty == \"OKP\"" if crv.nil? || x.nil?
50
+
51
+ OKP.new(crv: crv, x: x)
52
+ when "RSA"
53
+ raise "`crv`, `x`, and `y` must be nil when kty == \"RSA\"" unless crv.nil? && x.nil? && y.nil?
54
+ raise ArgumentError, "`n` and `e` must not be nil when kty == \"RSA\"" if n.nil? || e.nil?
55
+
56
+ RSA.new(n: n, e: e)
57
+ else
58
+ raise ArgumentError, "Invalid value for `kty`"
59
+ end
60
+ end
61
+ end
62
+
63
+ prop :algorithm, :union, of: [:uri, [:string, enum: Enum::SIGNATURE_ALGORITHM]], required: true
64
+ prop :key_id, :string
65
+ prop :public_key, :union, of: PublicKey::UNION_TYPE
66
+ prop :certificate_path, :array, items: :string
67
+ prop :excludes, :array, items: :string
68
+ prop :value, :string, required: true
69
+ end
70
+
71
+ # Schema name: SignatureChain
72
+ class SignatureChain < Base
73
+ prop :signatures, :array, items: JSFSignature, json_name: "chain"
74
+ end
75
+
76
+ # Schema name: SignatureList
77
+ class SignerList < Base
78
+ prop :signers, :array, items: JSFSignature
79
+ end
80
+
81
+ UNION_TYPE = [JSFSignature, SignatureChain, SignerList].freeze #: [singleton(JSFSignature), singleton(SignatureChain), singleton(SignerList)]
82
+ end
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../pattern"
4
+ require_relative "base"
5
+ require_relative "external_reference"
6
+ require_relative "property"
7
+
8
+ # Standard - A standard may consist of regulations, industry or organizational-specific standards, maturity models, best practices, or any other requirements which can be evaluated against or attested to.
9
+ module SBOM
10
+ module CycloneDX
11
+ module Record
12
+ # Schema name: Standard
13
+ class Standard < Base
14
+ # Schema name: Level
15
+ class Level < Base
16
+ # BOM Reference - An optional identifier which can be used to reference the object elsewhere in the BOM. Every bom-ref must be unique within the BOM.
17
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
18
+ # Identifier - The identifier used in the standard to identify a specific level.
19
+ prop :identifier, :string
20
+ # Title - The title of the level.
21
+ prop :title, :string
22
+ # Description - The description of the level.
23
+ prop :description, :string
24
+ # Requirements - The list of requirement `bom-ref`s that comprise the level.
25
+ prop :requirements, :array, items: [:string, pattern: Pattern::REF_LINK]
26
+ end
27
+
28
+ # Schema name: Requirement
29
+ class Requirement < Base
30
+ # BOM Reference - An optional identifier which can be used to reference the object elsewhere in the BOM. Every bom-ref must be unique within the BOM.
31
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
32
+ # Identifier - The unique identifier used in the standard to identify a specific requirement. This should match what is in the standard and should not be the requirements bom-ref.
33
+ prop :identifier, :string
34
+ # Title - The title of the requirement.
35
+ prop :title, :string
36
+ # Text - The textual content of the requirement.
37
+ prop :text, :string
38
+ # Descriptions - The supplemental text that provides additional guidance or context to the requirement, but is not directly part of the requirement.
39
+ prop :descriptions, :array, items: :string
40
+ # OWASP OpenCRE Identifier(s) - The Common Requirements Enumeration (CRE) identifier(s). CRE is a structured and standardized framework for uniting security standards and guidelines. CRE links each section of a resource to a shared topic identifier (a Common Requirement). Through this shared topic link, all resources map to each other. Use of CRE promotes clear and unambiguous communication among stakeholders.
41
+ # Example: ["CRE:764-507"]
42
+ prop :open_cre, :array, items: [:string, pattern: Pattern::OPEN_CRE]
43
+ # Parent BOM Reference - The optional `bom-ref` to a parent requirement. This establishes a hierarchy of requirements. Top-level requirements must not define a parent. Only child requirements should define parents.
44
+ prop :parent, :string, pattern: Pattern::REF_LINK
45
+ # 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.
46
+ prop :properties, :array, items: Property
47
+ # 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.
48
+ prop :external_references, :array, items: ExternalReference
49
+ end
50
+
51
+ # BOM Reference - An optional identifier which can be used to reference the object elsewhere in the BOM. Every bom-ref must be unique within the BOM.
52
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref"
53
+ # Name - The name of the standard. This will often be a shortened, single name of the standard.
54
+ prop :name, :string
55
+ # Version - The version of the standard.
56
+ prop :version, :string
57
+ # Description - The description of the standard.
58
+ prop :description, :string
59
+ # Owner - The owner of the standard, often the entity responsible for its release.
60
+ prop :owner, :string
61
+ # Requirements - The list of requirements comprising the standard.
62
+ prop :requirements, :array, items: Requirement
63
+ # Levels - The list of levels associated with the standard. Some standards have different levels of compliance.
64
+ prop :levels, :array, items: Level
65
+ # 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.
66
+ prop :external_references, :array, items: ExternalReference
67
+ # Signature - Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
68
+ prop :signature, :union, of: Signature::UNION_TYPE
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+ require_relative "command"
5
+ require_relative "property"
6
+
7
+ # Executes specific commands or tools in order to accomplish its owning task as part of a sequence.
8
+ module SBOM
9
+ module CycloneDX
10
+ module Record
11
+ # Schema name: Step
12
+ class Step < Base
13
+ # Name - A name for the step.
14
+ prop :name, :string
15
+ # Description - A description of the step.
16
+ prop :description, :string
17
+ # Commands - Ordered list of commands or directives for the step
18
+ prop :commands, :array, items: Command
19
+ # 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.
20
+ prop :properties, :array, items: Property
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "base"
4
+ require_relative "attachment"
5
+
6
+ # SWID Tag - Specifies metadata and content for ISO-IEC 19770-2 Software Identification (SWID) Tags.
7
+ module SBOM
8
+ module CycloneDX
9
+ module Record
10
+ # Schema name: SWID
11
+ class SWID < Base
12
+ # Tag ID - Maps to the tagId of a SoftwareIdentity.
13
+ prop :tag_id, :string, required: true
14
+ # Name - Maps to the name of a SoftwareIdentity.
15
+ prop :name, :string, required: true
16
+ # Version - Maps to the version of a SoftwareIdentity.
17
+ prop :version, :string, default: "0.0"
18
+ # Tag Version - Maps to the tagVersion of a SoftwareIdentity.
19
+ prop :tag_version, :integer, default: 0
20
+ # Patch - Maps to the patch of a SoftwareIdentity.
21
+ prop :patch, :boolean, default: false
22
+ # Attachment text - Specifies the metadata and content of the SWID tag.
23
+ prop :text, Attachment
24
+ # URL - The URL to the SWID file.
25
+ prop :url, :uri
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../enum"
4
+ require_relative "../pattern"
5
+ require_relative "base"
6
+ require_relative "dependency"
7
+ require_relative "input"
8
+ require_relative "output"
9
+ require_relative "property"
10
+ require_relative "resource_reference_choice"
11
+ require_relative "step"
12
+ require_relative "trigger"
13
+ require_relative "workspace"
14
+
15
+ # Task - Describes the inputs, sequence of steps and resources used to accomplish a task and its output.
16
+ module SBOM
17
+ module CycloneDX
18
+ module Record
19
+ # Schema name: Task
20
+ class Task < Base
21
+ # BOM Reference - An optional identifier which can be used to reference the task 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.
22
+ prop :bom_ref, :string, pattern: Pattern::REF_LINK, json_name: "bom-ref", required: true
23
+ # Unique Identifier (UID) - The unique identifier for the resource instance within its deployment context.
24
+ prop :uid, :string, required: true
25
+ # Name - The name of the resource instance.
26
+ prop :name, :string
27
+ # Description - A description of the resource instance.
28
+ prop :description, :string
29
+ # Resource references - References to component or service resources that are used to realize the resource instance.
30
+ prop :resource_references, :array, items: ResourceReferenceChoice
31
+ # Task types - Indicates the types of activities performed by the set of workflow tasks.
32
+ prop :task_types, :array, items: [:string, enum: Enum::TASK_TYPE]
33
+ # Trigger - The trigger that initiated the task.
34
+ prop :trigger, Trigger
35
+ # Steps - The sequence of steps for the task.
36
+ prop :steps, :array, items: Step
37
+ # Inputs - Represents resources and data brought into a task at runtime by executor or task commands
38
+ # Example: "a `configuration` file which was declared as a local `component` or `externalReference`"
39
+ prop :inputs, :array, items: Input
40
+ # Outputs - Represents resources and data output from a task at runtime by executor or task commands
41
+ # Example: "a log file or metrics data produced by the task"
42
+ prop :outputs, :array, items: Output
43
+ # Time start - The date and time (timestamp) when the task started.
44
+ prop :time_start, :date_time
45
+ # Time end - The date and time (timestamp) when the task ended.
46
+ prop :time_end, :date_time
47
+ # Workspaces - A set of named filesystem or data resource shareable by workflow tasks.
48
+ prop :workspaces, :array, items: Workspace, unique: true
49
+ # Runtime topology - A graph of the component runtime topology for task's instance.
50
+ prop :runtime_topology, :array, items: Dependency, unique: true
51
+ # 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.
52
+ prop :properties, :array, items: Property
53
+ end
54
+ end
55
+ end
56
+ end