Scope server credentials and validate legacy relocation coordinates - #12977
Draft
gnodet wants to merge 1 commit into
Draft
Scope server credentials and validate legacy relocation coordinates#12977gnodet wants to merge 1 commit into
gnodet wants to merge 1 commit into
Conversation
Forward-port of PR #12954 from maven-3.10.x to maven-4.0.x: - OriginBoundAuthenticationSelector: scopes server credentials to declared origins (protocol, host, port) of repositories and mirrors, preventing credential leakage to unrelated repositories - MavenMetadataSource: validates relocation coordinate components (groupId, artifactId, version) before applying them, rejecting path traversal characters and control characters - DefaultWagonManager: uses exact server ID matching (equals instead of equalsIgnoreCase) consistent with LegacyRepositorySystem and the resolver's authentication selector Adapted for 4.0.x module structure (compat/maven-compat, impl/maven-core) and API differences (SLF4J logger, constructor injection, merged properties). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced Aug 31, 2026
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.
Summary
Forward-port of #12954 from
maven-3.10.xtomaven-4.0.x, adapting all three fixes for the 4.0.x module structure and API differences:OriginBoundAuthenticationSelector(new file inimpl/maven-core): scopes server credentials to the declared origins (protocol, host, port) of repositories and mirrors configured in settings, preventing credential leakage to unrelated repositories. Supports three modes viamaven.repository.credentialScope:origin(default),strict, andid(legacy).compat/maven-compatMavenMetadataSource): validates relocationgroupId,artifactId, andversioncomponents before applying them, rejecting path traversal characters (/,\,..) and control characters.compat/maven-compatDefaultWagonManager): usesequalsinstead ofequalsIgnoreCasefor server ID matching, consistent withLegacyRepositorySystem.injectAuthenticationand the resolver's authentication selector.Adaptations for 4.0.x
maven-compat/->compat/maven-compat/,maven-core/->impl/maven-core/OriginBoundAuthenticationSelectorusesorg.slf4j.Logger(4.0.x) instead oforg.codehaus.plexus.logging.Logger(3.10.x)mergedProps(4.0.x property flow) instead ofConfigUtils.getString(configProps, ...)(3.10.x)MavenMetadataSourceRelocationTestuses constructor injection (4.0.x) instead of reflection-based field injection (3.10.x)Test plan
mvn verify -pl impl/maven-core-- 602 tests pass, 0 failuresmvn verify -pl compat/maven-compat-- 156 tests pass, 0 failuresOriginBoundAuthenticationSelectorTestcovers: declared origin matching, origin scoping, undeclared ID legacy behavior, strict mode refusal, ID scope passthrough, unknown scope rejection, origin normalizationMavenMetadataSourceRelocationTestcovers: invalid artifactId rejection, well-formed relocation application🤖 Generated with Claude Code