Repository navigation
Description
Current Behavior:
If a new project is created from an uploaded BOM, the number of components is correct.
But if the same file is re-uploaded (regardless via UI or API), the number of components decreases.
For example from 1922 to 1806.
logs:
2022-06-16 20:40:33,340 INFO [BomUploadProcessingTask] Processing CycloneDX dependency graph for project: 89e25caf-1334-4a68-bc64-93bb5fe0e5c0
2022-06-16 20:40:33,501 INFO [BomUploadProcessingTask] Processed 1922 components and 0 services uploaded to project 89e25caf-1334-4a68-bc64-93bb5fe0e5c0
2022-06-16 20:40:40,608 INFO [InternalAnalysisTask] Starting internal analysis task
2022-06-16 20:40:50,816 INFO [InternalAnalysisTask] Internal analysis complete
2022-06-16 20:40:50,824 INFO [OssIndexAnalysisTask] Starting Sonatype OSS Index analysis task
2022-06-16 20:41:02,187 INFO [OssIndexAnalysisTask] Sonatype OSS Index analysis complete
2022-06-16 20:41:02,189 INFO [PolicyEngine] Evaluating 1922 component(s) against applicable policies
UI:

1808 components
If this inventory is downloaded via UI, it contains 1808 components.
Each time I repeat the re-upload (initial file from disk), the number of components in the UI is different. (1808, 1922, 1602 etc.).
So:
INITIAL upload of BOM file (new project created during upload): # of components is correct
RE-UPLOAD of initial bom file (project already exists): # of components is NOT correct / varies
The imported BOM was created via cyclonedx-cli merge ... from several individual BOMs.
These BOMs were downloaded from Dependency-Track projects previously.
Steps to Reproduce:
Merge two or more cdx files with cyclonedx-cli, and upload them to Dependency-Track.
Expected Behavior:
The number of components is consistent.
Environment:
- Dependency-Track Version: 4.4.2
- Distribution: Docker
- BOM Format & Version: JSON 1.4 // XML 1.4
- Database Server: [ PostgreSQL ]
- Browser: Chrome
Additional Details:
If I get a GO from my project, I will attach a CDX JSON file for reproducing this behavior.
Activity
software-testing-professional commentedon Jun 16, 2022
What I also checked after merging several files into one BOM:
I changed the log level to DEBUG. Here are some logs:
The number of components starts at 1922, which is the exact number of components in the JSON BOM file.
With each import of the identical file, the number of components decreases.
And finally reaches 1598 after three or four imports.
Following imports remain at 1598.
If I do just the initial import, the number of components remains at 1922 and doesn't change over time.
nscuro commentedon Jun 27, 2022
Hi @software-testing-professional, thanks for reporting! 👋
Unfortunately I can't reproduce this. Tested with individual and merged SBOMs, but I don't see the behavior you're describing.
For reference, I tested with these SBOMs (in addition to Dependency-Track's own SBOM):
When merged, they add up to 1743 components. This number stayed consistent throughout multiple re-uploads.
If you do the same with these SBOMs on your DT instance, can you replicate the behavior you've been seeing earlier?
If not, can you share the SBOM that triggers the issue for you?
software-testing-professional commentedon Jul 4, 2022
Hi @nscuro
thank you for your support. :-)
I will test again with your BOM files, and report asap.
Regards, Michael
software-testing-professional commentedon Jul 6, 2022
I re-tested this behavior with one of our internal projects.
From my point of view this could be related with the merge strategy (hierarchical vs. flat).
Unfortunately I can't provide these BOMs, as they might disclose possible vulnerabilities.
Six microservice BOM files were hierarchically merged in my scenario.
The BOMs were downloaded from existing Dependency-Track projects.
After this merged BOM was uploaded to Dependency-Track, 1904 components were listed in the big system project:

Some of the components were duplicated. As these components are part of the Alpine base image which is used by several microservices, this makes sense.
Then I repeated the download of six BOMs, merged and uploaded them again into the same big system project.
And it resulted in 1513 components.
The duplicate components are gone now.
So the second import seems to show the correct number of components. Without duplication.
Whereas the first upload - that initially created the new big system project - contained duplicate components.
software-testing-professional commentedon Sep 8, 2022
Finally, I think I found the cause for this.
The CycloneDX BOM that is imported into DependencyTrack has for example these two components:
But DependencyTrack shows this component
alpine-baselayout-dataonly once:Looking at the imported CycloneDX data, both components have the same CPE
"cpe": "cpe:2.3:a:alpine-baselayout-data:alpine-baselayout-data:3.2.0-r22:*:*:*:*:*:*:*"but different PURLs
"purl": "pkg:alpine/[email protected]?arch=x86_64&distro=alpine-3.16.1&upstream=alpine-baselayout"vs.
"purl": "pkg:alpine/[email protected]?arch=x86_64&distro=alpine-3.16.2&upstream=alpine-baselayout"So DependencyTrack does some sort of component deduplication, based on the CPE?
nscuro commentedon Jan 10, 2024
Will be fixed in #3357.
github-actions commentedon Mar 26, 2024
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.