Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: add extended support for Definitions #713

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hakandilek
Copy link
Contributor

@hakandilek hakandilek commented Oct 17, 2024

This PR builds on top of #701 to create extended elements for the bom.definitions.standards like:

depends on: #701
is part of: #696

@hakandilek hakandilek force-pushed the feat/bom.definitions-full branch 2 times, most recently from 19ea024 to 2d420c9 Compare October 17, 2024 16:29
@hakandilek hakandilek force-pushed the feat/bom.definitions-full branch 2 times, most recently from 18f2630 to 8145a51 Compare October 22, 2024 07:59
@jkowalleck jkowalleck added enhancement New feature or request schema 1.6 labels Oct 23, 2024
cyclonedx/model/bom.py Show resolved Hide resolved
cyclonedx/model/definition.py Outdated Show resolved Hide resolved
cyclonedx/model/definition.py Outdated Show resolved Hide resolved
cyclonedx/model/definition.py Outdated Show resolved Hide resolved
cyclonedx/model/definition.py Outdated Show resolved Hide resolved
cyclonedx/model/definition.py Outdated Show resolved Hide resolved
An optional identifier which can be used to reference the requirement elsewhere in the BOM.
Every bom-ref MUST be unique within the BOM.

If a value was not provided in the constructor, a UUIDv4 will have been assigned.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a value was not provided in the constructor, a UUIDv4 will have been assigned.

has this been tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now introduced some additional tests for this in cyclonedx/model/definition.py

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but still, there is not UUIDv4 assigned.

Copy link
Member

@jkowalleck jkowalleck Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just remove this line and you are good.

(just like it was removed in other places: #733)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, if you actually intended to have these bom-refs being non-null on rendering, like we do for components, then you should hook into BomRefDiscriminator.from_bom()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I see now your point.

I think assigning a non-required field automatically would cause a lot more problems in the downstream later on. I also do not have a scenario how to reference/use a bom-ref of a requirement elsewhere within the BOM. I'll just remove the lines.

Copy link
Member

@jkowalleck jkowalleck Oct 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also do not have a scenario how to reference/use a bom-ref of a requirement elsewhere within the BOM.

Here is one: $.declarations.attestations[].map[].requirement - https://cyclonedx.org/docs/1.6/json/#declarations_attestations_items_map_items_requirement

The bom-ref to the requirement being attested to.

PS: This is in fact a very good reason to auto-populate this specific bom-refs on rendering. The same why we auto-populate bom-refs of components & services, as they could be used in a dependency tree.

cyclonedx/model/definition.py Show resolved Hide resolved
for CycloneDX#697

Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request schema 1.6
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants