gnodet opened a new pull request, #2133:
URL: https://github.com/apache/maven-resolver/pull/2133

   ## Summary
   
   When the tracking key function is URL-qualified (`nid_hurl`, the default 
since 2.0.23 / commit 339161b), tracking entries written by an older resolver 
using ID-only keys (`nid` format, e.g. `artifact>central=`) are invisible to 
the new lookup which expects `artifact>central-<sha1>=`.
   
   This causes **all** artifacts cached in the local repository before the 
upgrade to appear as "present but unavailable", triggering full re-downloads 
from remote repositories. In CI environments and integration tests that use 
fake/file-based repositories (like maven-integration-testing), this breaks 
resolution entirely — see [apache/maven#13078 
(comment)](https://github.com/apache/maven/pull/13078#issuecomment-5583775310).
   
   ## Root Cause
   
   The tracking key change from `nid` to `nid_hurl` (finding f013 in the 
security audit) makes existing `_remote.repositories` entries invisible:
   
   - **Old entry**: `maven-core-3.8.6.pom>central=`
   - **New lookup**: `maven-core-3.8.6.pom>central-<sha1 of repo URL>=` → no 
match
   
   The `isTracked()` check finds the old `central=` entry, so the artifact is 
treated as "tracked but not for the current repo" rather than "untracked" — the 
untracked inter-op fallback does not apply, and the artifact is rejected.
   
   ## Fix
   
   Add a backward-compatible fallback in `applyTracking()`: when the 
URL-qualified (`nid_hurl`) lookup misses, try the system-wide key function 
(`nid` by default) as a fallback. If that matches, accept the artifact and log 
a debug message. The legacy entry will be upgraded to the new key format on the 
next download.
   
   This preserves the f013 security improvement (URL-qualified tracking 
prevents same-id-different-URL repository poisoning for *new* entries) while 
providing a smooth upgrade path from older resolvers.
   
   ## Tests
   
   - Updated `testUrlQualifiedTrackingTreatsLegacyIdOnlyEntriesAsStale` → 
`testUrlQualifiedTrackingAcceptsLegacyIdOnlyEntriesViaFallback`: legacy entries 
from a matching repo are now accepted
   - Added 
`testUrlQualifiedTrackingRejectsLegacyIdOnlyEntriesFromDifferentRepo`: legacy 
entries from a *different* repo are still rejected
   - `testUrlQualifiedTrackingDistinguishesSameIdDifferentUrl`: unchanged — 
URL-qualified entries still prevent same-id-different-URL poisoning


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to