Conversation
Route repository ids through PathUtils.stringToPathSegment before they are used as path segments in the split local repository prefix and the trusted checksums sources, and validate the result, matching the 2.x behaviour. Also port GAECVNameMapperTest.
gnodet
approved these changes
Aug 31, 2026
gnodet
left a comment
Contributor
There was a problem hiding this comment.
Clean, well-adapted backport of repository-id path-segment sanitization from master (#2089, #2099) to the 1.9.x line. All six injection points where raw repository ids are spliced into filesystem paths are correctly guarded, tests are comprehensive, and the code follows existing conventions.
Key observations:
- Defense-in-depth pattern (
stringToPathSegmentthenvalidatePathComponent) is consistent with the 2.x approach. - The new
GAECVNameMapperTestis a clean port from master following 1.9.x test conventions (JUnit 4, Hamcrest). - The three
dotDotRepositoryIdIsNeutralizedtests each verify that..is neutralized to-DOTDOT-, including a good negative assertion in the SparseDirectory test. - The 1.6.x branch does not require further backport — the affected code paths don't exist there.
📋 PR Metadata
| Aspect | Current | Suggested |
|---|---|---|
| Milestone | 2.0.23 |
1.9.28 |
This PR targets maven-resolver-1.9.x, so the milestone should be 1.9.28 rather than 2.0.23.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of gnodet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 1.9.x line predates the repository key function layer, so the split local repository prefix (
LocalPathPrefixComposerFactorySupport, four sites) and the trusted checksums sources (SummaryFileTrustedChecksumsSource,SparseDirectoryTrustedChecksumsSource) splice the raw repository id into paths. This routes those ids throughPathUtils.stringToPathSegmentand validates the result, matching the 2.x behaviour after #2089 and #2099. Also portsGAECVNameMapperTestfrom master;GAECVNameMapperitself needed no change since it inherits the earlierfieldToSegmenthandling fromGAVNameMapper.Repository ids that are exactly
./..or contain path separators now compose to a neutralized segment (e.g.-DOTDOT-) instead of being spliced verbatim; well-formed ids are unaffected.Verified:
mvn -pl maven-resolver-impl -am teston JDK 17 → 379 tests, 0 failures.This change was created with AI assistance.