Skip to content

feat: add support for component's evidences according to spec #810

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

OxPirates
Copy link

@OxPirates OxPirates commented May 3, 2025

fixes #737

@OxPirates OxPirates requested a review from a team as a code owner May 3, 2025 10:26
@OxPirates
Copy link
Author

@jkowalleck Thank you for your time, Will work on it and submit the changes.

Copy link
Member

Choose a reason for hiding this comment

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

the test models you've added are not properly done. please improve them:

  • use the enums you've introduced, not arbitrary strings.
  • craft a data model that uses all the newly introduced properties and symbols
  • craft a new own data model, instead of reusing an existing one! Create an own function called get_bom_with_component_evidence() - it will be found and used.automatically.

@serializable.json_name('technique')
@serializable.xml_sequence(1)
def technique(self) -> str:
return (
Copy link
Member

Choose a reason for hiding this comment

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

wait what?
the setter takes care of correct values, how can isinstance(self._technique, AnalysisTechnique) be false?

@serializable.xml_array(serializable.XmlArraySerializationType.FLAT, 'confidence')
@serializable.json_name('confidence')
@serializable.xml_sequence(2)
def confidence(self) -> float:
Copy link
Member

Choose a reason for hiding this comment

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

please use type Decimal , not float

value: Optional[str] = None,
) -> None:
if isinstance(technique, str):
try:
Copy link
Member

Choose a reason for hiding this comment

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

not needed. the setter should take care of this

f'Technique must be one of: {", ".join(t.value for t in AnalysisTechnique)}'
)

if not 0 <= confidence <= 1:
Copy link
Member

Choose a reason for hiding this comment

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

not needed. the setter shoudl take care of this

def __comparable_tuple(self) -> _ComparableTuple:
return _ComparableTuple(
(
# Use technique.value to compare by string value for consistent ordering
Copy link
Member

Choose a reason for hiding this comment

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

at what point cane self.technique ne not a AnalysisTechnique?



@serializable.serializable_class
class ToolReference:
Copy link
Member

Choose a reason for hiding this comment

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

is this needed? is this not the same as BomRef?

Copy link
Author

@OxPirates OxPirates May 8, 2025

Choose a reason for hiding this comment

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

If I use BomRef, XML Validation fails with error ValidationError: It gives output like below

<tools>
           <tool>ref0</tool>
           <tool>ref1</tool>
</tools> 

<string>:87:0:ERROR:SCHEMASV:SCHEMAV_CVC_COMPLEX_TYPE_2_1: Element '{http://cyclonedx.org/schema/bom/1.6}tool': Character content is not allowed, because the content type is empty.


Whereas with current implementation (ToolRefrence), It gives output as 
  <tools>
           <tool ref="ref0"/>
           <tool ref="ref1"/>
</tools> 

And XML Validation PASS.  Please suggest. 

tools: Optional[Iterable[Union[str, BomRef]]] = None,
) -> None:
# Convert string to enum if needed
if isinstance(field, str):
Copy link
Member

Choose a reason for hiding this comment

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

this should be part of the setter, not the init

@OxPirates
Copy link
Author

@jkowalleck Thank you for the detailed review. All comments have been addressed except the one regarding ToolReference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement component.evidence.identity
2 participants