-
-
Notifications
You must be signed in to change notification settings - Fork 578
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
when uploading a BOM via API will fail #1988
Comments
Can you share the BOM you uploaded, so we can reproduce? Of course, please redact any internal or confidential information beforehand. Also, did you check the logs of the Dependency-Track API server? Any related errors? |
FYI, the BOM are uploaded just fine through API in my test DT instance. |
I can reproduce it on dotnet version of CycloneDX Until version 2.3.0 of CycloneDX dotnet tool the API works OK (format 1.3) The following warning is written to the log: 2022-12-02T14:01:53.654590002Z 2022-12-02 14:01:53,654 WARN [BomUploadProcessingTask] The BOM uploaded is not in a supported format. Supported formats include CycloneDX XML and JSON It works ok when uploading the same file through the UI. I attach a failing file We are running containerized version of Dependency Track with separated UI and API and latest tag:
|
@gelexgaray What version of the API server are you running? The behavior you're describing strongly suggests you're using an outdated version that does not support CycloneDX 1.4. |
Both containers are deployed to a kubernetes cluster using "latest". I will pin both containers to the latest version tag and check it again |
Repro with latest versions of the containers:
CycloneDX tool for dotnet was 2.7.0 Logs from API Server: |
TL;DR: the issue affecting @gelexgaray might be resolved in Dependency Track 4.8 but generating a JSON BOM with the dotnet tooling instead of XML (or stripping the byte order mark from the XML) might work in the meantime. That doesn't help with tiacomjp's original gradle issue unfortunately as that referred to a JSON-based BOM EDIT: Just after posting this, I searched for the error message which took me on a quest to find the source generating the error, then to -- I've managed to reproduce the issue @gelexgaray reported using dotnet-cyclonedx when uploading an XML BOM but generating a JSON BOM and uploading via the API worked without issue. The XML BOM also worked without issue when uploaded via the frontend. We normally use the Jenkins plugin and Maven plugin to handle BOM uploads for our Java projects but we're now adding Dependency Track to our .net builds managed by TeamCity using Powershell to generate the BOM and upload it. The script is WIP - I've not sorted out a version numbering strategy yet and there's no error handling but the script below generates the "BOM uploaded is not in a support format" error in the apiserver logs:
Changing the CycloneDX call to: ... and the publish call to: ... results in a successful upload and BOM import. We were also using frontend:4.6.1 and apiserver:4.6.3 but bumped both to 4.7.0 with the same result. |
This issue is STILL happening in the latest versions with XML, getting this in api server docker logs:
Uploading the same .XML file via WEB UI is successful, BOM Format
Using https://github.com/jenkinsci/dependency-track-plugin latest version
I'm not using the synchronous upload mode but imho the api should return an error if the uploaded file is deemed "invalid"? I have now too switched to JSON format and API upload has been successful again 😕 |
Same problem here using an XML-BOM 1.5 generated with That means it is NOT fixed with 4.8 😐 I agree that there are 2 problems
|
v4.11.0 will ship some related improvements. We will validate uploaded BOMs against the CycloneDX schema synchronously, and return a In contrast to the It will thus not matter whether the file is prefixed with byte order marks, comments, or anything else, as long as the contents are valid JSON or XML.
The frontend is just a client to the REST API. If there's a difference between the frontend and other clients, it's likely a client-side issue rather than a server-side one. |
We still encounter this issue, but with the new validation setting, get a 400 Error:
(The BOM is XML) When uploading manually, it works fine - the dotnet library also attests the sbom to be valid. We recently switched to the Jenkins Plugin for uploading, which I now suspect to be the culprit in some way. |
I have been encountered the error using CycloneDX module for .NET v3.0.8.0 and Dependency-Track v4.11.5 DT is configured for "BOM Validation" and "BOM Processing V2" |
Still unable to reproduce. The XML BOMs generated by the .NET tool contain byte-order-marks, but we already have handling in place for those. I tried uploading the BOMs provided in this thread via both multipart, and base64-encoded JSON field, and for none of these methods I'm seeing BOMs getting rejected. It seems like the Jenkins plugin may indeed be the problem. |
@mtsfoni, @JCH2k (and others)... can anyone confirm whether or not the problem occurs when using Dependency-Track Jenkins plugin v5.0.0? I am afraid that this is something that I cannot currently test.. not until I get my Jenkins servers migrated away from CentOS in a few weeks' time and can then upgrade Jenkins and upgrade the DT Jenkins plugin from v4.3.1 |
I have 4.3.1 installed. |
@msymons, @mtsfoni - I've just pushed a test build through our Jenkins server with DT plugin 5.0.0 and it imported without issue. Doesn't mean it's definitely not happening for others using V5 of course but it's solid for us:
Full list of versions for this build
|
@colinfyfe. I should have been more precise... requesting that an XML BOM generated by @mtsfoni, the DT v5.0.0 plugin release notes do not seem to contain anything relevant to our problem, but I have definitely performed software upgrades in the past that delivered fixes/functionality that were unexpected. The main thing is that plugin update is an easy thing to do (providing all requirements are met) and if it does not help then that is something that can be reported in an issue logged in dependency-track-plugin. It makes life far easier when it is clear up-front that a defect impacts the most recent version of software. |
Sorry @msymons, when I see Jenkins, I go into automatic Java mode :) I've just thrown a very simple pipeline build together for one of our .NET projects. Same Jenkins server so still 2.462.1 with Dependency Track plugin 5.0.0. Abridged extract below:
Compiled with .NET 8.0.7 and dotnet-CycloneDX 3.0.8. Hopefully that's more useful? EDIT: Removed disable-package-restore and deprecated disable-gitlab-licenses options to run "default" options |
Some potentially good or bad news depending on your POV - I rolled our Jenkins plugin back to 4.3.1 and it still uploaded a dotnet CycloneDX BOM without issue meaning I can't reproduce the failure unfortunately - my test didn't prove that upgrading from 4.3.1 to 5.0.0 would resolve the issue. |
@colinfyfe, yeah... we need to find an instance where a fail using plugin v4.3.1 either still fails with v5.0.0 or stops failing. |
The defect may already be reported! Please search for the defect before creating one.
Current Behavior:
generate bom.json from gradle ( https://plugins.gradle.org/plugin/org.cyclonedx.bom )
if I upload by using web site, it will work, but api will fail
(1.5.x will work, but 1.6.x and 1.7.x not)
same bom file, upload from website will work, but api fail
Steps to Reproduce:
1.generate bom.json from gradle
plugins {
id "org.cyclonedx.bom" version "1.7.1"
}
2.jenkins upload to DT server (from API)
Expected Behavior:
There should not be an error when uploading the BOM,
Environment:
Additional Details:
(e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
The text was updated successfully, but these errors were encountered: