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 — Fix prefix filter verification for denied artifact paths by harshab054 · Pull Request #2188 · apache/maven-resolver

Conversation

@harshab054

@harshab054 harshab054 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the Maven Resolver prefix filter behavior when a repository serves an artifact path that is missing from its "prefixes.txt".

A repository such as an Artifactory/Nexus virtual repository may expose a prefixes file generated from a public repository index while also serving private/internal artifacts. When the requested artifact path is absent from that prefixes file, the prefix filter can reject an artifact that the repository actually serves.

This change verifies a denied path against the repository before permanently rejecting it.

Implementation

  • Successfully served denied paths are cached and allowed on subsequent requests.
  • Definitively absent paths remain blocked and are negative-cached to avoid repeated remote probes.
  • Transient/unknown transport failures are not negative-cached, allowing later requests to retry.
  • Verification is performed per exact artifact path.
  • Multiple independently denied paths can be verified without disabling the repository's prefix filter globally.
  • Existing "verifyDeniedDropsTree=true" legacy behavior remains unchanged.

Security

The implementation preserves the security invariant introduced by Resolver PR #2082.

A successful verification of one denied path does NOT disable the prefix filter for the entire repository or authorize unrelated artifact paths.

Only the exact remotely verified path is allowed.

Tests

  • "PrefixesRemoteRepositoryFilterSourceVerifyDeniedTest": 14/14 passed
  • "PrefixesRemoteRepositoryFilterSourceTest": 6/6 passed
  • Checkstyle: passed with 0 violations
  • Spotless: passed
  • "git diff --check": clean

Related Maven Issue

This addresses the underlying Maven Resolver behavior reported in Apache Maven issue #13385:

apache/maven#13385

The original issue is reported against Maven because Maven users experience the resolution failure, while the prefix filtering implementation itself lives in Maven Resolver.

Sorry, something went wrong.

Uh oh!

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

All reactions
@harshab054
Fix prefix filter verification for denied artifact paths
1ee0ade
gnodet-bot
gnodet-bot reviewed Oct 8, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks for tackling the per-path caching — the direction is right. A few observations:

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java Resolved

Uh oh!

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

Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java Resolved

Uh oh!

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

Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java Resolved

Uh oh!

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

gnodet
gnodet reviewed Oct 8, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

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.

Thanks for this — the per-path verification caching and the VerificationOutcome enum to distinguish transient from definitive failures are the right improvements here.

One thing that's missing and would make a real difference for users: an actionable error message when a path is rejected.

Right now, when a denied path makes it through the pre-checks and ends up getting a hard rejection (e.g. verifyDenied is disabled, or the path is in verifiedAbsentPaths), the reasoning() string in the result is just:

Path /com/example/internal/1.0/internal-1.0.jar NOT allowed from central

That's what users see in ArtifactFilteredOutException, and it gives them no hint of what's happening or how to work around it.

Since we're already in PrefixesRemoteRepositoryFilterSource and have access to cachedPrefixes.autoDiscovered(), repository.getId(), and the config property name constants, this is the ideal place to enrich the message. When the tree is auto-discovered and the path is rejected, the reasoning could be something like:

Path /com/example/internal/1.0/internal-1.0.jar NOT allowed from central
(auto-discovered prefix file appears incomplete). If this repository serves a
virtual aggregate with an incomplete prefix file, set
-Daether.remoteRepositoryFilter.prefixes.verifyDenied.central=true
or report this to the repository administrator.
See https://maven.apache.org/resolver/remote-repository-filtering.html

For user-provided prefix files (not auto-discovered), keep the bare message — those denials are deliberate.

Would you be willing to add this here? It's a small addition but would save a lot of debugging time for users hitting this in the wild.

Sorry, something went wrong.

Uh oh!

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

All reactions
@gnodet gnodet mentioned this pull request Oct 8, 2026
fix: handle incomplete remote prefix filters apache/maven#13386
Closed
6 of 7 tasks
@efegokdemir efegokdemir mentioned this pull request Oct 8, 2026
Improve guidance for denied auto-discovered prefixes #2194
Closed
1 of 2 tasks
@harshab054
Improve prefix filter verification diagnostics
a268bc4
gnodet-bot
gnodet-bot reviewed Oct 9, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

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.

The latest commits address all three previous observations — good follow-up:

  • ✅ Javadoc updated — CachedPrefixes class doc now correctly describes per-path caching of both served and absent paths.
  • ✅ synchronized block comment added — the intent (preventing duplicate verification of the same path, not global serialization) is now documented inline.
  • ✅ Wasted allocations resolved — DISABLED_PREFIXES / NO_INPUT_PREFIXES now use Collections.emptySet() when autoDiscovered=false; the empty sets allocated for static singletons are gone.

The test additions are solid: transportFailureDoesNotNegativeCachePath directly validates the UNKNOWN/retry semantics, unservedDeniedPathRemainsBlockedAndDoesNotDisableFilter covers negative caching, and the reasoning-string assertions in deniedPathAbsentFromRemoteStaysDenied pin the actionable error message content.

One informational note: remoteRepositoryServesPath uses a manual try/finally instead of try-with-resources. This is justified — transporter.classify(e) must be called inside the catch block where transporter needs to be in scope; try-with-resources would scope the variable to the try block only. No change needed.

No blocking issues.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

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

All reactions
@gnodet
gnodet requested a review from cstamas October 9, 2026 14:03
gnodet
gnodet approved these changes Oct 9, 2026
View reviewed changes
@cstamas

cstamas commented Oct 9, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

I am very uneasy on changes like this (and previous #2082) and here is why: prefixes are usually (and are meant) to be resolved from remote, but, there are (may be) cases, when user wants to provide them manually, check out the RRF demo: https://github.com/cstamas/rrf-demo/tree/master/.mvn/rrf

So in latter case, prefixes now become "advice" only? In other word, in latter case they are "user provided configuration", that Maven may opt to simply ignore/override? Like, I configured it intentionally like this, but will Maven obey or not, is up to some heuristics.

We may then want to distinguish, between "user provided" (when content comes from a configured file) and "remotely resolved" (when it comes from remote)?

And this is the reason why I was pushing for "black or white": when present, no magic but fully obeyed, or when absent (404 or user configures it disabled) just work without it.

Essentially, it boils down to one thing: "fix your MRM, it is broken". No magic or heuristic helps here, when software is broken.

All reactions

Sorry, something went wrong.

Uh oh!

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

@harshab054

harshab054 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for raising this concern. I agree that explicitly user-provided prefix filters should be enforced strictly and should not be silently overridden.

My intention with this change was to address incomplete, automatically discovered prefix files while preserving strict filtering for user-provided configurations.

Would you recommend limiting the verification behavior strictly to automatically discovered prefixes, while keeping user-provided prefix files fully enforced? Or would you prefer a strict, black-or-white policy for both cases?

I'd be happy to adjust the implementation based on the intended Resolver behavior.

All reactions

Sorry, something went wrong.

Uh oh!

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

@cstamas

cstamas commented Oct 9, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Yes, that would make sense: limit this behaviour for automatically discovered prefix files only.

And many-many thanks for the work so far!

All reactions

Sorry, something went wrong.

Uh oh!

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

@harshab054

harshab054 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Hi @cstamas, I've updated the PR to restrict denied-path verification exclusively to automatically discovered prefix files, while keeping user-provided prefix files strictly enforced. I've also addressed the singleton allocation and synchronization documentation feedback. The targeted tests and all 19 reported CI matrix jobs are passing. Whenever you have time, could you please take another look? Thank you for the feedback!

cstamas and Hiteshsai007 reacted with heart emoji
All reactions
  • ❤️ 2 reactions

Sorry, something went wrong.

Uh oh!

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

@cstamas
cstamas requested a review from ascheman October 9, 2026 18:17
@harshab054
harshab054 requested a review from gnodet-bot October 12, 2026 13:44
@cstamas cstamas added the enhancement New feature or request label Oct 12, 2026
@cstamas cstamas added this to the 2.0.25 milestone Oct 12, 2026
@cstamas
cstamas requested a balanced review from Copilot and removed request for gnodet-bot October 12, 2026 17:14
Copilot AI reviewed Oct 12, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open findings
  • High severity Returning VerificationOutcome.ABSENT on URISyntaxException is logically incorrect: URI… · New
  • Medium severity The per-repository/session verifiedServedPaths and especially verifiedAbsentPaths sets can grow… · New
  • Medium severity This message is emitted for any auto-discovered denial, including cases where verification is… · New
What changed in this PR

Fixes Maven Resolver’s prefix filter behavior when a repository serves artifact paths that are missing from an auto-discovered prefixes.txt, by verifying denied paths against the remote repository and caching the outcomes.

Changes:

  • Add per-artifact-path verification for denied paths when prefixes are auto-discovered (served paths become allowed; definite 404s become negative-cached; transient failures are retried).
  • Extend reasoning/messages for denied artifacts to include repository-specific verification guidance and documentation links.
  • Expand tests to cover multiple independent denied paths, per-path caching (positive/negative), and transient transport failures.
File Description
maven-resolver-impl/​src/​main/​java/​org/​eclipse/​aether/​internal/​impl/​filter/​PrefixesRemoteRepositoryFilterSource.java Implements per-path verification outcomes and caching; updates denial reasoning and verification behavior.
maven-resolver-impl/​src/​test/​java/​org/​eclipse/​aether/​internal/​impl/​filter/​PrefixesRemoteRepositoryFilterSourceVerifyDeniedTest.java Adds/updates test coverage for per-path verification, caching semantics, and reasoning content.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +674 to 694
private VerificationOutcome remoteRepositoryServesPath(RemoteRepository repository, String path) {
Transporter transporter = null;
try {
transporter = transporterProvider.newTransporter(session, repository);
transporter.peek(new PeekTask(new URI(null, null, path, null)));
return true;
return VerificationOutcome.SERVED;
} catch (URISyntaxException e) {
logger.debug("Cannot construct URI for denied path {} of {}", path, repository, e);
return false;
return VerificationOutcome.ABSENT;
} catch (Exception e) {
logger.debug("Verification of denied path {} against {} failed", path, repository, e);
return false;
if (transporter != null && transporter.classify(e) == Transporter.ERROR_NOT_FOUND) {
return VerificationOutcome.ABSENT;
}
return VerificationOutcome.UNKNOWN;
} finally {
if (transporter != null) {
transporter.close();
}
}
}
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +384 to 392
private final Set<String> verifiedServedPaths;
private final Set<String> verifiedAbsentPaths;

private CachedPrefixes(PrefixTree prefixTree, boolean autoDiscovered) {
this.prefixTree = prefixTree;
this.autoDiscovered = autoDiscovered;
this.verifiedServedPaths = autoDiscovered ? ConcurrentHashMap.newKeySet() : Collections.emptySet();
this.verifiedAbsentPaths = autoDiscovered ? ConcurrentHashMap.newKeySet() : Collections.emptySet();
}
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java Outdated
Comment on lines +631 to +635
reasoning += " (auto-discovered prefix file appears incomplete). If this repository serves a "
+ "virtual aggregate with an incomplete prefix file, set -D"
+ CONFIG_PROP_VERIFY_DENIED + "." + repository.getId()
+ "=true or report this to the repository administrator. "
+ "See https://maven.apache.org/resolver/remote-repository-filtering.html";
Copilot stopped reviewing on behalf of cstamas due to an error October 12, 2026 18:20
The job was not acquired by a runner even after multiple attempts.
@harshab054
Fix prefix filter verification edge cases
57e4df5
gnodet-bot
gnodet-bot approved these changes Oct 13, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

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.

Following up on my earlier review — all previous observations have been addressed, and the new commit is clean.

The delta (fixing verifiedAbsentResult on the post-lock path, extracting inconclusiveVerificationResult, correcting URISyntaxException → UNKNOWN to prevent false negative caching, leading-slash stripping, and the offline-aware reasoning branch in notAllowedResult) is correct throughout. All new tests exercise the right code paths.

LGTM.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

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

All reactions
@cstamas
cstamas requested a balanced review from Copilot October 20, 2026 15:55
Copilot AI reviewed Oct 20, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

8 open issues
  • High severity transporter.close() in the finally block can throw, which would override the intended… · New
  • High severity Returning VerificationOutcome.ABSENT on URISyntaxException is logically incorrect: URI…
  • Medium severity The per-session verifiedServedPaths / verifiedAbsentPaths sets can grow without bound for… · New
  • Medium severity This message is emitted for any auto-discovered denial, including cases where verification is…
  • Medium severity The per-repository/session verifiedServedPaths and especially verifiedAbsentPaths sets can grow…
  • Low severity Verification normalizes probePath by stripping leading slashes, but caching uses the original… · New
  • Low severity Verification normalizes probePath by stripping leading slashes, but caching uses the original… · New
  • Low severity Verification normalizes probePath by stripping leading slashes, but caching uses the original… · New

Review effort: Lite

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +699 to 723
private VerificationOutcome remoteRepositoryServesPath(RemoteRepository repository, String path) {
Transporter transporter = null;
try {
String probePath = path;
while (probePath.startsWith("/")) {
probePath = probePath.substring(1);
}
transporter = transporterProvider.newTransporter(session, repository);
transporter.peek(new PeekTask(new URI(null, null, probePath, null)));
return VerificationOutcome.SERVED;
} catch (URISyntaxException e) {
logger.debug("Cannot construct URI for denied path {} of {}", path, repository, e);
return false;
return VerificationOutcome.UNKNOWN;
} catch (Exception e) {
logger.debug("Verification of denied path {} against {} failed", path, repository, e);
return false;
if (transporter != null && transporter.classify(e) == Transporter.ERROR_NOT_FOUND) {
return VerificationOutcome.ABSENT;
}
return VerificationOutcome.UNKNOWN;
} finally {
if (transporter != null) {
transporter.close();
}
}
}
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +384 to 392
private final Set<String> verifiedServedPaths;
private final Set<String> verifiedAbsentPaths;

private CachedPrefixes(PrefixTree prefixTree, boolean autoDiscovered) {
this.prefixTree = prefixTree;
this.autoDiscovered = autoDiscovered;
this.verifiedServedPaths = autoDiscovered ? ConcurrentHashMap.newKeySet() : Collections.emptySet();
this.verifiedAbsentPaths = autoDiscovered ? ConcurrentHashMap.newKeySet() : Collections.emptySet();
}
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java

private void allowVerifiedServedPath(String path) {
this.verifiedServedPath = path;
this.verifiedServedPaths.add(path);
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +414 to +416
private void recordVerifiedAbsentPath(String path) {
this.verifiedAbsentPaths.add(path);
}
Comment thread .../main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
Comment on lines +702 to +705
String probePath = path;
while (probePath.startsWith("/")) {
probePath = probePath.substring(1);
}
cstamas
cstamas approved these changes Oct 20, 2026
View reviewed changes
@cstamas
cstamas merged commit 836f47a into apache:master Oct 20, 2026
20 checks passed

Uh oh!

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

@github-actions github-actions Bot assigned cstamas Oct 20, 2026
Copilot stopped reviewing on behalf of cstamas due to an error October 20, 2026 19:19
The job was not acquired by a runner even after multiple attempts.
cstamas added a commit that referenced this pull request Oct 20, 2026
@cstamas
Revert "Fix prefix filter verification for denied artifact paths (#2188…
7ab6dbb
…)"

This reverts commit 836f47a.
@cstamas

cstamas commented Oct 20, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This PR was merged, and now is reverted 7ab6dbb

The PR caused massive slowdown, approximately doubling build times.

And I am personally back to my original stance: Maven should not "figure out" anything when it comes to broken remote repositories, instead, those using it should pressure vendors to fix them (or just use some other software instead of the broken one).

All reactions

Sorry, something went wrong.

Uh oh!

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@cstamas cstamas cstamas approved these changes
@gnodet gnodet gnodet approved these changes
@ascheman ascheman Awaiting requested review from ascheman
+1 more reviewer
@gnodet-bot gnodet-bot gnodet-bot approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

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

Assignees

@cstamas cstamas

Labels

enhancement New feature or request

Projects

None yet

Milestone

2.0.25

Development

Successfully merging this pull request may close these issues.

Uh oh!

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

5 participants

@harshab054 @cstamas @gnodet @gnodet-bot
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.