GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Credential scoping + relocation validation (3.9.x backport) by gnodet · Pull Request #13005 · apache/maven

Conversation

@gnodet

@gnodet gnodet commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Backport of Fix Set B (credential scoping + relocation validation + server ID matching) to maven-3.9.x.

  • Validate relocation coordinates from resolved project metadata (reject path traversal, slashes, backslashes, colons, control characters in MavenMetadataSource)
  • Bind server credentials to declared repository origins (new OriginBoundAuthenticationSelector)
  • Match settings server IDs exactly (fix equalsIgnoreCase → equals in DefaultWagonManager)
  • Fix assertEquals(true, ...) → assertTrue(...) in MavenMetadataSourceRelocationTest

Sibling PRs:

  • master: Scope server credentials and validate legacy relocation coordinates #12976
  • maven-4.0.x: Scope server credentials and validate legacy relocation coordinates #12977
  • maven-3.10.x: Scope server credentials and validate legacy relocation coordinates #12954

Note: DistributionManagementArtifactRelocationSource does not exist on 3.9.x (introduced in 3.10.x), so that file's validation is not included in this backport.

Test plan

  • MavenMetadataSourceRelocationTest covers relocation validation
  • OriginBoundAuthenticationSelectorTest covers credential scoping
  • CI build passes on maven-3.9.x

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
slachiewicz and others added 3 commits September 1, 2026 23:10
@slachiewicz @gnodet
Validate relocation coordinates from resolved project metadata
a5272d1
@slachiewicz @gnodet
Bind server credentials to the declared repository origin
853328a
Credentials configured in settings for a server id are keyed only by
that id. A repository definition can also arrive from a POM resolved
out of a remote repository and reuse the id of a server the operator
holds credentials for, at a different origin than the one the operator
configured. Wrap the authentication selector so credentials for an id
are offered only to a repository whose origin (scheme, host, port)
matches a repository or mirror the operator declared, in settings or
on the command line, with that same id; other origins get a
once-per-id/origin warning naming the id and are refused.

Ids with no operator-declared repository (for example a deploy-only
server whose URL comes from the project's distributionManagement)
keep serving credentials as before, with a warning, so mvn deploy
using settings credentials plus a POM's distributionManagement keeps
working. The new maven.repository.credentialScope user property
selects the policy: "origin" (default), "strict" (also refuse
undeclared ids), or legacy "id".
@slachiewicz @gnodet
Match settings server ids exactly when selecting credentials
fc899f9
Aligns the legacy WagonManager credential lookup with the exact-match semantics
used by every other id-keyed credential path; server ids have never been
documented as case-insensitive.
@gnodet
gnodet force-pushed the pr/core-and-compat-3.9.x branch from 0b7153b to fc899f9 Compare September 1, 2026 21:11
@gnodet @claude
Fix Spotless formatting violations
b6942fa
Remove unused imports left by rebase.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@gnodet gnodet mentioned this pull request Sep 1, 2026
Scope server credentials and validate legacy relocation coordinates #12954
Merged
gnodet
gnodet commented Sep 1, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Well-adapted backport of credential scoping and server ID exact matching to 3.9.x. The OriginBoundAuthenticationSelector is identical to the 3.10.x version (correct, since it only depends on shared types). The DefaultRepositorySystemSessionFactory changes correctly target the 3.9.x API (DefaultRepositorySystemSession, Plexus Logger, wagon config keys).

One finding:

  • @since version tag (DefaultRepositorySystemSessionFactory.java:131): The @since tag on MAVEN_REPOSITORY_CREDENTIAL_SCOPE says 3.9.10, but Maven 3.9.10 was already released and does not contain this constant. The sibling PR #12954 correctly uses @since 3.10.0 for the 3.10.x branch. This should be @since 3.9.17 to match the next 3.9.x milestone.

Positive notes:

  • DefaultWagonManager change from equalsIgnoreCase to equals aligns with LegacyRepositorySystem.injectAuthentication (already case-sensitive via HashMap).
  • Relocation validation was already present on 3.9.x from a prior backport — correctly omitted from this diff.
  • DistributionManagementArtifactRelocationSource doesn't exist on 3.9.x — correctly omitted.
  • Credential scoping integration correctly adapts to DefaultRepositorySystemSession and aether.connector.perms config keys.

📋 PR Metadata

Aspect Current Suggested
Labels (none) bug
Milestone (none) 3.9.17

🤖 This review was generated by ForgeBot.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread ...re/src/main/java/org/apache/maven/internal/aether/DefaultRepositorySystemSessionFactory.java
*
* @since 3.9.10
*/
public static final String MAVEN_REPOSITORY_CREDENTIAL_SCOPE = "maven.repository.credentialScope";

@gnodet gnodet Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
public static final String MAVEN_REPOSITORY_CREDENTIAL_SCOPE = "maven.repository.credentialScope";
* @since 3.9.17

Maven 3.9.10 was already released and does not contain this constant. The sibling PR #12954 correctly uses @since 3.10.0. This should reference the next 3.9.x milestone (3.9.17).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet merged commit aeb0a05 into maven-3.9.x Sep 2, 2026
21 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@gnodet
gnodet deleted the pr/core-and-compat-3.9.x branch September 2, 2026 06:16
@github-actions github-actions Bot added this to the 3.9.17 milestone Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

@gnodet Please assign appropriate label to PR according to the type of change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot assigned gnodet Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gnodet gnodet

Labels

None yet

Projects

None yet

Milestone

3.9.17

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@gnodet @slachiewicz
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.