Skip to content

Disable HTML escaping when output in JSON #555

Open
@t-katsumura

Description

cyclonedx-gomod output SBOM with HTML escaped when --json flag was specified.
This converts & in purl to \u0026 which sometimes is not parsed correctly in other tools.

We can find an example at

"purl": "pkg:golang/k8s.io/[email protected]?type=module\u0026goos=linux\u0026goarch=arm64#cmd/minikube",

Proposal:

  • DIsable HTML escape globally
    or
  • Add CLI option to disable HTML escaping

Because the BOMEncoder in cyclonedx-go already has the method SetEscapeHTML(escapeHTML bool), changes should be necessary only around here.

encoder := cdx.NewBOMEncoder(outputWriter, outputFormat)
encoder.SetPretty(true)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions