Repository navigation
feat: BomRefDiscriminator.from_bom() shall find all BomRefs in a bom
#1089
jkowalleck
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
based on
BomRefDiscriminator.from_bom()does not collect citation bom-refs (CycloneDX 1.7) #1068BomRefDiscriminator.from_bom()does not collect citation bom-refs (CycloneDX 1.7) #1068 (comment)this is a discussion, that might result in a ticket, if we find a suitable way to go forward.
given that there is not just the citations, but many other things that are not properly discriminated, I would broaden the scope here.
i gave this a spin and the most forward feature I could think of is the following:
the discriminator should not work on manually hardcoded structures, but on pseudo-reflective.
this means instead of coding all options where a BomRef might be, it should traverse the entire data structure and search for BomRefs.
Entire data analysis on runtime would be pretty slow, since on each run, it would analyze the type of each and every property/item again and again to see what property is a
BomRef.Therefore, we could speed this up with a pre-build lookup-path. One that is not a pre-built tree, since we have nested data structures like
bom.components[].components[]....components[].bom_ref.My idea here is pretty raw, still:
_bomref_maps.py.This tool is run manually to update the resulting file based on latest models.
The resulting file is under VCS, and is shipped with the release.
The tool itself is also under VCS, but not shipped with a release.
BomRefDiscriminator.from_bom()uses these mappings to find all BomRefsstill unclear:
like a property might be class
Aor classB?like
Component.componentsis an iterable ofComponenttype(foo).__name__at runtime if possible.but i guess that does not work for union types.
to be clarified: do we even have such cases yet? I think the
toolsis not Nonewhe possible - this could be an optimization in the future - for the start it would be okay to always test if a thing is present.All reactions