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

Invalid BOM generated when adding more than 1 tool, only for XML format #492

Closed
jgraglia opened this issue Sep 1, 2024 · 2 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@jgraglia
Copy link
Contributor

jgraglia commented Sep 1, 2024

Hi,

I have a problem when writing a BOM with 2+ tools, only in XML format.
The xml is wrote but it is not valid : a <tools> element appears for each <tool>

The generated file looks like

<bom version="1" xmlns="http://cyclonedx.org/schema/bom/1.5">
  <metadata>
    <timestamp>2024-09-01T08:41:47Z</timestamp>
    <tools>
      <tool>
        <vendor>corp A</vendor>
        <name>tool A</name>
        <version>1-A</version>
      </tool>
    </tools>
    <tools>   <!-- pb here -->
      <tool>
        <vendor>corp B</vendor>
        <name>tool B</name>
        <version>1-B</version>
      </tool>
    </tools>
    <tools>   <!-- pb here -->
      <tool>
        <vendor>corp C</vendor>
        <name>tool C</name>
        <version>1-C</version>
      </tool>
    </tools>
  </metadata>
</bom>

This problem does not appears when serializing as json.
I notice that the tools section is deprecated and that there are some jackson annotations (ref) to handle a transition from metadata > tools to metadata > components|services

The problem is present with versions 1.5 and 1.6

I have setup a minimal testcase to reproduce the problem : netceler@458cbec

  • should_write_a_single_tool_in_xml_format is ok
  • should_write_many_tools_with_json_format is also ok
  • testIssuesWhenSerializingMultiplesToolsInXmlFormat fails

I originally found the bug with version 9.0.5 but it is also active with 9.0.6-SNAPSHOT

@jgraglia
Copy link
Contributor Author

jgraglia commented Sep 1, 2024

I think it's more a Jackson configuration issue with the @JacksonXmlElementWrapper and @JacksonXmlProperty annotations on tools, in Metadata class... Each tool item is serialized with it's own tools wrapper element. 🤔

@nscuro
Copy link
Member

nscuro commented Dec 10, 2024

Fixed by #568

@nscuro nscuro closed this as completed Dec 10, 2024
@nscuro nscuro added the bug Something isn't working label Dec 10, 2024
@nscuro nscuro added this to the 10.0.0 milestone Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants