Skip to content

commons collections force to commons-collections4 is wrong on 2 points #134

Open
@hazendaz

Description

@hazendaz

What version of OpenRewrite are you using?

1.27.0 of this recipe rewrite-java-dependencies (this also might show from the rewrite-apache but think its here)

How are you running OpenRewrite?

maven plugin 6.0.5, no special configuration, just running a number of recipes that should typically just work to keep code clean.

What is the smallest, simplest way to reproduce the problem?

Just add commons-collections:commons-collections:3.2.2 which isn't vulnerable, its just old to a pom file, run the plugin, watch it change. Then realize no code existed to change and the scope of where it was changed would degrade the code and introduce a vulnerability.

What did you expect to see?

Nothing, my product is a pom file (super pom) and I'm overriding an actual vulnerable version of commons collections to 3.2.2 for a plugin from maven team that has not patched for that. There is no code here to change and commons collections and commons collections 4 are not the same. The imports are different and given there was no code changed, it should not have updated the pom.

What did you see instead?

The pom was updated stating it was 'resolve vulnerable library usage with relocated notice from the older version to newer version which would do nothing for my build. My build won't fail, but it would cause the plugin in question I override to start using vulnerable code again. Version 3.2.2 is not vulnerable so the its wrong on that point. Plus changing it here without any ability to change underlying code as no code is even here, would result in the class path containing both commons collections that then would be vulnerable and commons collections 4 that then would be unused.

What is the full stack trace of any errors you encountered?

no stack trace.

Are you interested in contributing a fix to OpenRewrite?

no.

The fix should be pretty easy. Don't patch libraries that are not compatible with one another when used to override dependencies of a maven plugin as there is no way to actually accept the change as it doesn't fix anything. I presume the fact it didn't change any code is also a problem here. The recipe should have known no code changed and the patch was therefore invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions