Skip to content

fix: de-duplicate and sort both includedBy and projectReferences in reports#8440

Merged
jeremylong merged 3 commits intodependency-check:mainfrom
chadlwilson:de-duplicate-includedby
Apr 22, 2026
Merged

fix: de-duplicate and sort both includedBy and projectReferences in reports#8440
jeremylong merged 3 commits intodependency-check:mainfrom
chadlwilson:de-duplicate-includedby

Conversation

@chadlwilson
Copy link
Copy Markdown
Collaborator

@chadlwilson chadlwilson commented Apr 22, 2026

Description of Change

  • Since feat: Scan Maven Plugins #5001 these includedBy references have been accidentally duplicated, since they are put into Sets but the custom type doesn't have equals/hashCode like the previous Pair type did.
  • sorted them since these can be very large for bigger projects; and sorting them makes it easier to scan through. Added new methods rather than changing semantics of the existing accessors on Dependency.

Related issues

N/A

Have test cases been added to cover the new functionality?

yes

Example HTML report:
dependency-check-report.html

Since a6010aa these references have been duplicated, since they are put into HashSets but the type doesn't have equals/hashCode

Signed-off-by: Chad Wilson <[email protected]>
@chadlwilson chadlwilson changed the title fix: de-duplicate and sort both includedBy and projectReferences in reports fix: de-duplicate and sort both includedBy and projectReferences in reports Apr 22, 2026
@boring-cyborg boring-cyborg Bot added core changes to core tests test cases labels Apr 22, 2026
Copy link
Copy Markdown
Collaborator

@marcelstoer marcelstoer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes duplicated includedBy entries introduced by the switch to IncludedByReference (missing equals/hashCode) and updates report outputs to use de-duplicated, sorted includedBy and projectReferences for easier scanning in large projects.

Changes:

  • Implement equals/hashCode (+ Comparable) on IncludedByReference and add sorted accessors on Dependency.
  • Update HTML/XML/JSON/JUnit/Jenkins (and commented GitLab) report templates to render sorted includedBy / projectReferences.
  • Add unit tests asserting sorting behavior for the new sorted accessors.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
core/src/main/java/org/owasp/dependencycheck/dependency/IncludedByReference.java Adds equality and natural ordering to enable de-duplication + sorting.
core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java Adds get*Sorted() accessors and changes some getters to *copyOf(...).
core/src/test/java/org/owasp/dependencycheck/dependency/DependencyTest.java Adds tests for sorted accessors.
core/src/main/resources/templates/htmlReport.vsl Uses sorted accessors for deterministic, easier-to-scan output.
core/src/main/resources/templates/jenkinsReport.vsl Uses sorted accessors in Jenkins output.
core/src/main/resources/templates/xmlReport.vsl Uses sorted accessors in XML output.
core/src/main/resources/templates/jsonReport.vsl Uses sorted accessors in JSON output.
core/src/main/resources/templates/junitReport.vsl Uses sorted projectReferences in JUnit output.
core/src/main/resources/templates/gitlabReport.vsl Updates a commented loop to reference the sorted accessor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/main/resources/templates/junitReport.vsl
Comment thread core/src/main/resources/templates/htmlReport.vsl
Comment thread core/src/main/resources/templates/htmlReport.vsl
Comment thread core/src/main/resources/templates/jenkinsReport.vsl
Comment thread core/src/main/java/org/owasp/dependencycheck/dependency/Dependency.java Outdated
These can be very large for bigger projects; and sorting them makes it easier to scan through. Added new methods rather than changing semantics of the existing accessors on Dependency.

Signed-off-by: Chad Wilson <[email protected]>
@chadlwilson chadlwilson force-pushed the de-duplicate-includedby branch from e580a26 to 667f791 Compare April 22, 2026 06:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeremylong jeremylong added this to the 12.2.2 milestone Apr 22, 2026
@jeremylong jeremylong merged commit ff1a367 into dependency-check:main Apr 22, 2026
18 of 19 checks passed
@chadlwilson chadlwilson deleted the de-duplicate-includedby branch April 22, 2026 11:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core changes to core tests test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants