Repository navigation
Auto-generate bom-refs for models that currently get none (licenses, organizations, contacts, …) #1085
Replies: 2 comments 1 reply
|
@jkowalleck, before opening a PR we should decide on a design decision:
Options:
I lean towards A. Which would you prefer? I'll follow your choice and note it in the PR. |
|
re: #1085 (comment)
This would leave emty BOmRefs empty, right - probably not a good idea, and not accordin to the discriminator. cyclonedx-python-lib/cyclonedx/contrib/bom/utils.py Lines 39 to 40 in 3bc82a5 it sayes non‑empty - so we cannot leave an empty value as is. |
Uh oh!
There was an error while loading. Please reload this page.
Context
BomRefDiscriminatorguarantees that components, services and vulnerabilities always get a unique, non-emptybom-refin the serialized output. Many other models can carry abom-refas well, but when none is set, none is written. This is the contract described in #861, which was never finished.Related: #1068 (citation bom-refs are not collected by
BomRefDiscriminator.from_bom()). In the discussion there, the same gap was found for the models listed below. Adding a model tofrom_bom()also means a value is generated when it has none, becausediscriminate()assigns one to every collectedBomRefwithout a value. This issue covers that generation and its effect on the output.Proposal
Generate a
bom-refat serialization time, as is already done for components, services and vulnerabilities, for:OrganizationalEntity,OrganizationalContact,PostalAddressDisjunctiveLicense,LicenseExpression,LicenseExpressionDetailsOccurrence(component evidence)Standard,Requirement,Level(definitions)ModelCard,EnergyProviderThe generated values are removed again after serialization, as for the existing models, so the in-memory model is not changed.
Consequences
bom-refattributes. Snapshot tests need regenerating.bom-ref(e.g.Citation,ComponentData) can be added once they are onmain.All reactions