Skip to content

Maven checks for artifacts in maven-central without permission to do that #44

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

Open
BoufarN opened this issue Nov 10, 2021 · 1 comment

Comments

@BoufarN
Copy link

BoufarN commented Nov 10, 2021

When doing a GET on the maven-resource, maven first checks maven-central for the jar before checking our own repository. The risk is that someone can place a malicious artifact with the same ID and maven will accept it and the pipeline will use it thereby installing not our own jar but someone else's. Is it possible to disable the maven-central or disable maven-central by default when an own repository is specified?

@mulderga-cgi
Copy link

mulderga-cgi commented Nov 30, 2021

this is a potential security issue... you could do something like this to "fix" it:

file: https://github.com/nulldriver/maven-resource/blob/master/assets/.mvn/settings.xml

<repository>
      <id>2_central</id>
      <url>https://repo.maven.apache.org/maven2/</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
      <id>1_remote-repository</id>
      <url>${repository.url}</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
</repository>

... because Maven will order alphabetically on repository ID, so check the remote repository first before fetching a resource from maven central

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

No branches or pull requests

2 participants