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

Multiple dependencies on an in-reactor unresolvable artifact result in duplicated dependencies on aggregate scan #3944

Closed
aikebah opened this issue Jan 3, 2022 · 2 comments
Labels

Comments

@aikebah
Copy link
Collaborator

aikebah commented Jan 3, 2022

Describe the bug
When running an aggregate scan on a multimodule project, where multiple submodules depend on the same in-reactor module multiple virtual dependencies are registered in the report.
Strange enough the number of virtual dependencies is one less than the number of dependencies for which a virtual dependency gets created.

[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
[WARNING] o org.owasp.test.aggregate.issue-3944:lib:jar:1.0.0-SNAPSHOT (compile)
[WARNING] Try running the build up to the lifecycle phase "package"
[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
[WARNING] o org.owasp.test.aggregate.issue-3944:lib:jar:1.0.0-SNAPSHOT (compile)
[WARNING] Try running the build up to the lifecycle phase "package"
[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
[WARNING] o org.owasp.test.aggregate.issue-3944:lib:jar:1.0.0-SNAPSHOT (compile)
[WARNING] Try running the build up to the lifecycle phase "package"
[WARNING] The following dependencies could not be resolved at this point of the build but seem to be part of the reactor:
[WARNING] o org.owasp.test.aggregate.issue-3944:lib:jar:1.0.0-SNAPSHOT (compile)
[WARNING] Try running the build up to the lifecycle phase "package"
[INFO] 
[INFO] --- dependency-check-maven:6.5.2:aggregate (default) @ parent ---
[INFO] Unable to resolve org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT as it has not been built yet - creating a virtual dependency instead.
[INFO] Unable to resolve org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT as it has not been built yet - creating a virtual dependency instead.
[INFO] Unable to resolve org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT as it has not been built yet - creating a virtual dependency instead.
[INFO] Unable to resolve org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT as it has not been built yet - creating a virtual dependency instead.

Resulted in a report with 3 (non-vulnerable) dependencies

Dependency Vulnerability IDs Package Highest Severity CVE Count Confidence Evidence Count
org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT   pkg:maven/org.owasp.test.aggregate.issue-3944/lib@1.0.0-SNAPSHOT   0   6
org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT   pkg:maven/org.owasp.test.aggregate.issue-3944/lib@1.0.0-SNAPSHOT   0   6
org.owasp.test.aggregate.issue-3944:lib:1.0.0-SNAPSHOT   pkg:maven/org.owasp.test.aggregate.issue-3944/lib@1.0.0-SNAPSHOT   0   6

Version of dependency-check used
The problem occurs using version 6.5.1 and 6.5.2 of the maven plugin (and likely older as well)

To Reproduce
Will be provided in a new it-test

Expected behavior
A single or no, not quite sure what the expected behavior for the in-reactor dependencies is, virtual dependency listed in the aggregate report.

@aikebah
Copy link
Collaborator Author

aikebah commented Jan 3, 2022

The 'one less than the number of dependencies' is due to the fact that the BundlingAnalyzer in the end bundles the first two virtual dependencies to one. The remaining duplicates get merged too, but stay in place, as the BundlingAnalyzer uses a HashSet to track the merged/bundled dependencies to remove and all virtual dependencies have the same hashcode so only a single duplicate is scheduled for removal, leaving n-1 duplicate virtual dependencies in place when n virtual dependencies have been created for cases of n>1.

@aikebah
Copy link
Collaborator Author

aikebah commented Jan 3, 2022

And there is no sign of the Bundling, because in the end the first virtual dependency gets removed from the list, leaving the duplicates in place

jeremylong pushed a commit that referenced this issue Jan 17, 2022
Fixes #3944

While merging dependencies do not add a dependency identical to this to the related dependencies
Make the virtual dependencies stemming from the maven plugin register the project in which context it was found
@aikebah aikebah removed their assignment Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant