Problem
When a dependency POM contributes a repository through a JDK/OS/activeByDefault-activated profile (the legitimate path, see #13100 / #13116 / #13141), that repository can declare a URL that shadows central or another well-known repository with a different (potentially malicious) URL.
Maven currently has no defense against this: the repository is accepted as-is and used for artifact resolution.
Proposed Solution
Implement a WARN (or optionally FAIL with a flag) policy that triggers when:
- A repository contributed by an external-model profile has the same
<id> as a repository already registered in the effective repository list (e.g. central), but a different URL.
This is a repository URL-mismatch check, scoped to the dependency resolution path.
Non-goals
Notes
Problem
When a dependency POM contributes a repository through a JDK/OS/
activeByDefault-activated profile (the legitimate path, see #13100 / #13116 / #13141), that repository can declare a URL that shadowscentralor another well-known repository with a different (potentially malicious) URL.Maven currently has no defense against this: the repository is accepted as-is and used for artifact resolution.
Proposed Solution
Implement a WARN (or optionally FAIL with a flag) policy that triggers when:
<id>as a repository already registered in the effective repository list (e.g.central), but a different URL.This is a repository URL-mismatch check, scoped to the dependency resolution path.
Non-goals
Notes
// TODO(#428)marker has been added at the relevant call site inDefaultModelBuilderas a reminder.