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

Disable HTML escaping when output in JSON #555

Open
t-katsumura opened this issue Nov 20, 2024 · 0 comments
Open

Disable HTML escaping when output in JSON #555

t-katsumura opened this issue Nov 20, 2024 · 0 comments

Comments

@t-katsumura
Copy link

t-katsumura commented Nov 20, 2024

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/minikube@v1.23.1?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)

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

No branches or pull requests

1 participant