-
Notifications
You must be signed in to change notification settings - Fork 1
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
dirty-water report of Spoon: analysis and mitigation #37
Comments
@monperrus the URLs are computed from each dependency, using the following command: mvn help:evaluate -Dexpression=project.scm.url -Dartifact={group_id}:{artifact_id}:{version} -q -DforceStdout I believe that when researching, I got the idea to use As an example, if you have this call for the first package in this table, you get the following interaction: ❯ mvn help:evaluate -Dexpression=project.scm.url -Dartifact=org.slf4j:slf4j-api:2.0.16 -q -DforceStdout
https://github.com/qos-ch/slf4j/slf4j-parent/slf4j-api You can also see that in maven's central repository for this dependency, the source control URL on the tab at the bottom right of the page leads to a URL which doesn't exist: https://central.sonatype.com/artifact/org.slf4j/slf4j-api/2.0.16 I'm not quite sure how this URL is actually acquired, since the pom for this dependency doesn't actually have an SCM tag, only its supermodule does (and that one has a correct URL) -- perhaps this is dynamically acquired from the supermodule? And if they (hypothetically) just append the project's name to the URL, it's bound for these errors to happen, I'd say. Overall, it seems like this issue is probably related with maintainers not writing the SCM tag for submodules of a supermodule. What do you think? |
Interesting. There are probably two mitigations:
Option 1 is the easiest, could you give it a try? Thanks! |
@monperrus regarding the second point, I found a thread which might be useful for us here: https://stackoverflow.com/questions/50321827/which-urls-does-maven-resolve-with-a-subpath-in-child-poms
So essentially, this default value is the root cause here, since the SCM tag is not defined in some child modules, as with slf4j-api. Being a default value, it might even be the case that this is intended behavior (?) but I could investigate further. |
great, thanks @randomicecube |
citing the Stackoverflow post:
This is exactly the bug we're talking about. It would be great to firt report it and then fix it. |
@MartinWitt suggests that there is a bug because we have way more than 17 dependencies in the supply chain. @randomicecube could you have a look? thanks! |
@MartinWitt are you sure? I'm saying this because looking strictly at spoon's pom.xml file, it looks like every dependency is being correctly parsed. Each sub-project (e.g., spoon-visualization) has a further pom.xml, with more dependencies, of course, but those aren't to be directly parsed here, I think. One think which would be fair, though, is that I don't think the dependencies would be, for now, correctly parsed for the child projects -- that is, for spoon-visualization, for instance, we'd parse that child project's pom.xml, but the parent's dependencies would be ignored (and they shouldn't, I think). Do you agree? cc @monperrus |
Spoon has 17 direct dependencies, but also inherits some from its parent. Even if your tool only analyzes direct dependencies, it should be 23:
But the first line in your readme states (emphasis mine)
If you include those it gets closer to 45:
And then you also have omitted dependencies:
|
Thanks for the detailed feedback, I'll take a look! |
Martin Witt also rightly complained that this does not include plugins and their transitive dependencies. I omitted those as there isn't a good and easy way to fetch them. But this should come close (though it overcounts because it includes conflicts):
Quite a few more, but not all of them necessarily have much input in the final build. |
TODO: missing plugin support, as referenced in #37 (comment)
improved report at https://gist.github.com/monperrus/34663084981de3c56f3120f932e0a4b7 now 352 dependencies in the Spoon supply chain |
I did not follow all the conversation but at least I got "I'm not quite sure how this URL is actually acquired, since the pom for this dependency doesn't actually have an SCM tag, only its supermodule does (and that one has a correct URL)" See Inheritance Assembly. In short, the child module appends the parent's URLs with artifact ID. If parent-module is Trivia: This inheritance algorithm worked well for Apache Subversion based repositories but not anymore because majority are hosted on GitHub. |
thanks a lot @randomicecube for preparing the dirty-water report of Spoon
https://gist.github.com/monperrus/34663084981de3c56f3120f932e0a4b7
let's fix everything
where do the 4 404 github_url come from? (extracted? computed)
The text was updated successfully, but these errors were encountered: