question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Problem uploading BOM to OWASP Dependency Track

See original GitHub issue

I was trying to use cdxgen to generate BOM and upload it to Dependency Track for analysis, but it doesn’t work. The project is created in Dependency Track (if it doesn’t exist) and the BOM file is uploaded, but the analysis fails. In the logs I can see errors like this:

dtrack-apiserver_1 | Caused by: org.datanucleus.exceptions.NucleusUserException: Attempt to store value "d3af366f679d75a6f5eb5e7575ae5b77879fdfcd3cd5ef5bdbb7fc79bdf771ddbd6da7f8d5fe3df7a7787bcf1ee9eef4" in column ""SHA_256"" that has maximum length of 64. Please correct your data!

As you can see, the database expects a maximum of 64 characters, but 96 are sent.

Digging a bit deeper in the code of cdxgen I saw that the component’s hashes are encoded in hexadecimal instead of adding directly the base64 hash (function addComponentHash).

let hash = Buffer.from(digest, "base64").toString("hex");

Is this being hex encoded for any particular reason?

Thanks.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9

github_iconTop GitHub Comments

1reaction
sgarciaquobiscommented, Feb 9, 2021

It’s working perfectly now. Thank you very much for the quick response and fix.

1reaction
sgarciaquobiscommented, Feb 9, 2021

No problem, happy to help.

It might not be the most elegant solution but this will return digest if it’s already in hex format, or empty string otherwise.

Buffer.from(digest, 'hex').toString('hex')

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vulnerabilities not populating for BoM upload #406 - GitHub
I am very new to testing out dependency-track and I have run into some problems during setup. When I upload a BoM for...
Read more >
Importing CycloneDX BoM into Dependency-Track - YouTube
In this session, we dive into creating a CycloneDX software bill-of-material ( BoM ) document from an existing polyglot project, ...
Read more >
Continuous Integration & Delivery - Dependency-Track
To publish CycloneDX BOMs, use a valid API Key and project UUID. Finally, Base64 encode the BOM and insert the resulting text into...
Read more >
OWASP Dependency-Track
This approach provides capabilities that traditional Software Composition Analysis (SCA) solutions cannot achieve.
Read more >
OWASP Dependency-Track - Jenkins Plugins
Dependency-Track is an intelligent Software Supply Chain Component ... Allows updating of some project properties after uploading the BOM.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found