Skip to content

Warn on duplicate service BOM refs during BOM processing#5908

Open
Zureno wants to merge 1 commit intoDependencyTrack:masterfrom
Zureno:warn-on-duplicate-service-bomref
Open

Warn on duplicate service BOM refs during BOM processing#5908
Zureno wants to merge 1 commit intoDependencyTrack:masterfrom
Zureno:warn-on-duplicate-service-bomref

Conversation

@Zureno
Copy link
Copy Markdown
Contributor

@Zureno Zureno commented Mar 15, 2026

Description

Adds a warning log for duplicate service BOM references during BOM ingestion.

The method distinctComponentsByIdentity(...) already logs a warning when duplicate BOM references are encountered for components. However, the equivalent logic in distinctServicesByIdentity(...) silently ignored duplicate BOM references for services.

This change aligns the behavior of service processing with component processing by logging a warning when multiple services share the same BOM reference.

This improves diagnostics when ingesting malformed or incorrectly generated SBOMs and helps operators identify issues with SBOM generators.

Addressed Issue

No existing issue.
Improves consistency and observability in BOM processing.

Additional Details

During BOM ingestion, BomUploadProcessingTask deduplicates both components and services using their identity and BOM reference.

For components, the method distinctComponentsByIdentity(...) already detects and logs a warning when multiple components share the same BOM reference:

final boolean isBomRefUnique = identitiesByBomRef.putIfAbsent(component.getBomRef(), componentIdentity) == null;
if (!isBomRefUnique) {
    LOGGER.warn("...");
}

### Checklist

<!-- REQUIRED
    Mark items in this list as done by adding a `x` between the square brackets.
    Non-applicable items may be marked as such by surrounding their text with tildes (`~`).

    This is not meant to be a strict to-do list. If you're unsure about anything,
    just leave it empty for now. The maintainers are happy to assist you in figuring it out!
-->

- [x] I have read and understand the [contributing guidelines](../CONTRIBUTING.md#pull-requests)
- [ ] This PR fixes a defect, and I have provided tests to verify that the fix is effective
- [x] This PR implements an enhancement, and I have provided tests to verify that it works as intended
- [~] This PR introduces changes to the database model, and I have added corresponding [update logic](https://github.com/DependencyTrack/dependency-track/tree/master/src/main/java/org/dependencytrack/upgrade)
- [~] This PR introduces new or alters existing behavior, and I have updated the [documentation](https://github.com/DependencyTrack/dependency-track/tree/master/docs/_docs) accordingly

@owasp-dt-bot
Copy link
Copy Markdown

owasp-dt-bot commented Mar 15, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Signed-off-by: Zureno <pranshu21freak@gmail.com>
@Zureno Zureno force-pushed the warn-on-duplicate-service-bomref branch from d16efe4 to 98611e3 Compare March 15, 2026 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants