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

don't add all components when uploading a new BOM #3354

Closed
2 tasks done
ellipse2v opened this issue Jan 5, 2024 · 4 comments · Fixed by #3357
Closed
2 tasks done

don't add all components when uploading a new BOM #3354

ellipse2v opened this issue Jan 5, 2024 · 4 comments · Fixed by #3357
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk pending release
Milestone

Comments

@ellipse2v
Copy link

Current Behavior

when I have a SBOM with some duplicate component (name-version) but a différent code CPE.

I think there is an issue in ComponentQueryManager
matchSingleIdentity return the first match but buildComponentIdentityQuery
final String filter = "project == :project && (%s)".formatted(String.join(" || ", filterParts));

https://github.com/DependencyTrack/dependency-[track/blob/8e732b6c1177001da0d4975ba703041f6ee7a7e6/src/main/java/org/dependencytrack/persistence/ComponentQueryManager.java#L54
](url)
the join have a "or" instead a "and" so if you have two same COTS/VERSION the first one is return each time.

when you look after https://github.com/DependencyTrack/hyades-apiserver/pull/218/files

you can see :
final var filter = "project == :project && (" + String.join(" && ", filterParts) + ")";

I try with the && instead of the || it works fine.

this delta come from https://github.com/DependencyTrack/dependency-track/pull/3126

Regards

Steps to Reproduce

1.load a SBOM with duplicate COTS OS like
PowerEdge 1.1.1 cpe:2.3:o:dell:poweredge_r640_firmware:2.9.4:::::::*
and
PowerEdge 1.1.1 cpe:2.3:h:dell:poweredge_r640:2.9.4:::::::*

in order to don't loose any CVE (for example, with deprecated CPE)

load the SBOM I have 447 components
i reload the SBOM, all the COTS/OSS duplicated are removed, and only 1 is still on DT.
i have now 337 COTS

Expected Behavior

I expect to have all the COTS OSS of the SBOM in DT even I load many time the BOM.

Dependency-Track Version

4.11.0-SNAPSHOT

Dependency-Track Distribution

Container Image, Executable WAR

Database Server

PostgreSQL

Database Server Version

14

Browser

Google Chrome

Checklist

@ellipse2v ellipse2v added defect Something isn't working in triage labels Jan 5, 2024
@nscuro
Copy link
Member

nscuro commented Jan 5, 2024

See #2519 (comment) for more details on this.

Note though that this behavior was not introduced in #3126, it always worked like this.

You already found DependencyTrack/hyades-apiserver#218, which we intend to backport. Among fixing this particular issue, it also comes with loads of performance improvements.

@dioxygene
Copy link

hello ok I thought there had been an attempt to correct with the commit as the code looks a lot like and there had been a small error.
Thanks for your answers
I must reject the defect?
Thanks

@nscuro
Copy link
Member

nscuro commented Jan 7, 2024

I'm leaving it open for now. It will be closed once #3357 is merged. :)

@nscuro nscuro removed the in triage label Jan 7, 2024
@nscuro nscuro added this to the 4.11 milestone Jan 7, 2024
@nscuro nscuro added p2 Non-critical bugs, and features that help organizations to identify and reduce risk pending release labels Jan 10, 2024
Copy link
Contributor

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
defect Something isn't working p2 Non-critical bugs, and features that help organizations to identify and reduce risk pending release
Projects
None yet
3 participants