-
-
Notifications
You must be signed in to change notification settings - Fork 607
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
Error while uploading same SBOM Second time #2131
Comments
We are experiencing the same issue. Interestingly, it does not seem to be deterministic whether the issue arises. I uploaded the same BOM file twice (to a project that already had processed BOM files in the past). On the first try, the exception occurred. A minute later, the same file got processes successfully.
Environment: Dependency-Track Version: 4.6.1 |
I am seeing the same exception in my logs from time to time. I haven't been able to reproduce it.
|
FWIW this is happening when the BOM includes duplicate components. The Another symptom of this is a decrease in component count when uploading the BOM multiple times. Upon every upload, more and more of those duplicate components are removed. |
Hi @nscuro, Thanks for the information, I have one question is this issue related to SBOM? |
We're noticing similar behavior to @nscuro mentioned when uploading the same BOM multiple times. The first upload to Dependency Track matches the number of components listed in the BOM. However each upload of the same BOM after that (to the same project name/version) results in a decreased count. In particular, this only occurs with merged BOMs (using Environment: |
Hi @nscuro, when I delete all the components and then re-upload the SBOM then Its works, Yes the previous Project contains Number of Duplicates entries |
I attempted to delete all components but get left with one or two that cannot be deleted. Not the same ones at each attempt. Is there a workaround for this? |
Edited: My original suggestion to do unique in purl did nothing and only seemed to work due to the apparent randomness of the issue. So instead:
This seems to work around the problem. |
Since we ran into the same issue with #2265 we did some further analysis. The issue seems to be following: Second upload (same or different BOM):
Therefore, it makes sense that some reported the problem here only with merged BOMS (can merge duplicates into one, since merge tool does not deduplicate either) and me having the issue with @cyclonedx/cyclonedx-npm, since that tool generates a ton of duplicates (which have different ref-entries in the XML but the data used by Basically I see this issue here:
We would provide a fix (this is affecting many of our projects since i switched to the new NPM cyclonedx module, as I just noticed) but I am unsure how to fix. In my opinion, during every upload we should FIRST deduplicate the BOM before hitting the database. That would eliminate the issue, ensure every upload has the same result and not different component counts after a second upload, and also fix the issue that component show up X times for the same project. Then it's just the question how to fix existing data.... |
Doing the de-duplication upfront should definitely solve this. But de-duping components can be complex, as evident by the thought work that @jkowalleck has been doing in CycloneDX/cyclonedx-node-npm#307. For DT specifically, when de-duplicating 2 or more components, the dependency graph needs to reflect this, otherwise it will have broken edges. The golden question is: "When are two components identical?"
But even those don't cover the whole picture. License, dependencies, supplier/author/provider, etc. are all things that could make a component "different". |
re: #2131 (comment) the point of view that DependencyTrack might have is dependency-focused. Therefore, it could be acceptable to de-dupe on a handful of properties, and apply this result on the dependency graph, too. |
Also consider on de-duplication: But maybe that is going too far. (There is as far as we can see in general a challenge when trying to apply (multiple) non-deduplicated VEX data to a deduplicated project. I don't see a logical solution to this.) |
I also would take the purpose of Dependency-Track into account here. We use PURLs etc. to find vulnerabilities. If those are equal, there is no point in keeping 2 instances. License information is the 2nd use case. So possibly take license-ID into account, too. I don't see a big chance the license will differ, but who knows. Regarding @flemminglau comment: And yes, in any case the graph also needs to reflect the deduplication. All instances in graph must be redirected to the one instance that is kept. edit: |
Current logic for matching on re-upload seems to be:
|
Seems like this is quite a common error. So for 4.7 it might be could to at least add a try-catch around the delete statement. If something we want to delete is already deleted, it's probably, at least for now in this specific case, OK to ignore that exception. |
Workaround PR is created, that would fix the failing of BOM processing. |
My two cents : since the deduplication logic performed on second upload does not seem to question anyone, I would apply the same filter on the first upload as a first approach. From then on, it can surely be improved with additional fields. |
same situation, SBOM, component cnt decreased, cannot delete those two
what shoud we do to clean out those components from database? |
@jonny64 there should be a workaround in place since 4.7., which version are you on? |
@rkg-mm 4.6.2, update to 4.7 and re-upload BOM to fix ? |
@jonny64 yes 4.7 should fix this. |
I am working on this area of the code right now, and I am confident that I have a fix at hand for this problem. What the persistence layer does today is basically de-duplication based on I'd love to test this with BOMs that are known to be problematic. Anyone in this thread willing to share some with me? If you're uncomfortable sharing publicly, you can also DM them to me in the OWASP Slack (my name there is |
@nscuro has this been addressed per DependencyTrack/hyades-apiserver#218? and would this be a 4.10 potential fix? |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The defect may already be reported! Please search for the defect before creating one.
Current Behavior:
When I upload the SBOM in Dependency Track for the First time in a new project it uploads successfully without any error logs and also reports the correct number of Components, but I upload the same SBOM in the same project again it shows error logs and reports the incorrect count of components
Logs When I upload SBOM First time

Number of Components: 1686
Logs When I upload the SBOM Second time

Number of Components: 1611
Steps to Reproduce:
Step 1: Create a New project
Step 2: Upload SBOM in the New project
Step 3: Monitor the logs and Number of components shown in the Dependency track
Step 4: Again upload the same SBOM in the Same project
Step 5: Monitor the logs and Number of components shows in the Dependency track
Expected Behavior:
Environment:
Report the Same number of components without any error logs when we upload SBOM second time in same project
The text was updated successfully, but these errors were encountered: