Skip to content

Backport path composition and repository provenance changes to 1.9.x - #2092

Merged
slachiewicz merged 4 commits into
apache:maven-resolver-1.9.xfrom
slachiewicz:fix/resolver-1.9.x
Aug 31, 2026
Merged

slachiewicz merged 4 commits into
apache:maven-resolver-1.9.xfrom
slachiewicz:fix/resolver-1.9.x

Conversation

@slachiewicz

@slachiewicz slachiewicz commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

Ports three changes from master to the maven-resolver-1.9.x maintenance line so the two lines
behave consistently:

PathUtils does not exist on this line, so it is added here along with its tests. The rest follows
the master changes, adapted to the 1.9.x API.

Please review the three master pull requests first; this one is mechanical once those are settled.

Port the 2.0.x coordinate validation to this line: PathUtils gains
validatePathComponent (rejecting '..', separators and ':'),
validateDotSeparatedPathComponent (rejecting empty dot-separated
segments in dot-expanded components like the groupId) and the
artifact/metadata component validators. DefaultLocalPathComposer
applies them and adds a last-resort check that the composed path is
relative with no parent-reference or empty segments;
Maven2RepositoryLayoutFactory validates before composing remote
locations; FileTransporter replaces its substring check with a
fail-closed containment check under the repository base directory.

stringToPathSegment maps '.' and '..' to explicit tokens, matching the
existing single-character replacements. Unusual but documented-valid
version strings like '1..' remain accepted, as versions are not
dot-expanded.
The filesystem-friendly GAV/GAECV name mappers now pass every
coordinate field through PathUtils.stringToPathSegment, and
BasedirNameMapper rejects lock names that do not resolve under the
locks base directory, so the resolved lock path is always contained in
it. Port of the 2.0.x change to this line.
Port of the 2.0.x change: add an aggregateRepositories overload that
distinguishes repositories declared by remote artifact descriptors
from repositories supplied by the build. By default, session
authentication matched by repository ID is no longer applied to
descriptor-declared repositories unless an operator-defined mirror was
selected for them; a warning names the repository and the
aether.remoteRepositoryManager.authToDescriptorRepositories flag
restores the previous behavior. Dependency collectors mark descriptor
repositories accordingly; repositories supplied by the build itself are
unaffected.
@slachiewicz slachiewicz changed the title Port resolver 2.x path/lock/auth hardening to 1.9.x line Port resolver 2.x path/lock/auth fixes to 1.9.x line Aug 30, 2026
@slachiewicz slachiewicz changed the title Port resolver 2.x path/lock/auth fixes to 1.9.x line Backport path composition and repository provenance changes to 1.9.x Aug 30, 2026
@slachiewicz slachiewicz added maintenance java Pull requests that update Java code resolver1 labels Aug 30, 2026
@slachiewicz slachiewicz added this to the 1.9.28 milestone Aug 30, 2026

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well-structured security backport porting three important fixes (coordinate validation, lock name sanitization, auth scoping) to the 1.9.x line. The adaptation from 2.x to 1.9.x APIs is well done throughout.

Issues to fix before merge:

  • Two test files have duplicate ASF license headers (copy-paste error) — see inline comments.

Forward-port observations:
This backport is actually more comprehensive than what exists on the 2.x master, creating a maintenance asymmetry:

  • validatePathComponent adds colon (:) rejection not present on 2.x master
  • validateDotSeparatedPathComponent is entirely new and not on 2.x
  • FileTransporter containment check is materially stronger than 2.x's path.contains("../")
  • Auth scoping by repository provenance is absent from 2.x entirely

Consider forward-porting these enhancements to the 2.x line as well.

📋 PR Metadata

Aspect Current Suggested
Labels (none) fix
Milestone (none) 1.9.28

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of @gnodet

Comment thread maven-resolver-util/src/test/java/org/eclipse/aether/util/PathUtilsTest.java Outdated

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review after new commits: the duplicate license headers in DefaultLocalPathComposerTest.java and PathUtilsTest.java have been removed (commit 0b6d595). All @since tags correctly reference 1.9.28. The backport is well-adapted to 1.9.x APIs.

Sequencing note (informational): The three master PRs this backport references (#2087, #2091, #2090) are still open. If this PR merges first, the 1.9.x line will ship these security hardening changes before the 2.x line. The PR description acknowledges this: "review the three master pull requests first; this one is mechanical once those are settled." Merging master PRs first would reduce asymmetry risk.

This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.

Claude Code on behalf of gnodet

@slachiewicz
slachiewicz merged commit 9735ee5 into apache:maven-resolver-1.9.x Aug 31, 2026
17 checks passed
@slachiewicz
slachiewicz deleted the fix/resolver-1.9.x branch August 31, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code maintenance resolver1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants