You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When two or more private registries of the same ecosystem share the same hostname but use different URL paths (e.g., two Azure DevOps feeds on pkgs.dev.azure.com), the OIDC credential for the second registry silently overwrites the first.
This happens because each handler stores OIDC credentials in a map[string]*OIDCCredential keyed by hostname only. Since both registries resolve to the same hostname, the map key collides.
Impact
The first registry loses its OIDC credential and falls back to static auth (or fails)
Only the last-registered credential for a given host is used
Affects handlers that use cred.Host() as the OIDC map key: Python, Composer, Maven, Terraform, npm, NuGet
Reproduction
Configure two Azure DevOps feeds for the same ecosystem (e.g., two Python indexes):
Both resolve to hostname pkgs.dev.azure.com. The second credential overwrites the first in the OIDC map. Requests to feed-A use feed-B's token (or fail).
Fix
Introduce a shared OIDCRegistry type that stores credentials in a map[hostname][]entry structure, where each entry includes the parsed URL path. Lookup uses longest path-prefix matching to select the correct credential.
Problem
When two or more private registries of the same ecosystem share the same hostname but use different URL paths (e.g., two Azure DevOps feeds on
pkgs.dev.azure.com), the OIDC credential for the second registry silently overwrites the first.This happens because each handler stores OIDC credentials in a
map[string]*OIDCCredentialkeyed by hostname only. Since both registries resolve to the same hostname, the map key collides.Impact
cred.Host()as the OIDC map key: Python, Composer, Maven, Terraform, npm, NuGetReproduction
Configure two Azure DevOps feeds for the same ecosystem (e.g., two Python indexes):
[ {"type": "python_index", "index-url": "https://pkgs.dev.azure.com/org/project/_packaging/feed-A/pypi/simple/", ...oidc config...}, {"type": "python_index", "index-url": "https://pkgs.dev.azure.com/org/project/_packaging/feed-B/pypi/simple/", ...oidc config...} ]Both resolve to hostname
pkgs.dev.azure.com. The second credential overwrites the first in the OIDC map. Requests to feed-A use feed-B's token (or fail).Fix
Introduce a shared
OIDCRegistrytype that stores credentials in amap[hostname][]entrystructure, where each entry includes the parsed URL path. Lookup uses longest path-prefix matching to select the correct credential.Acceptance Criteria
OIDCRegistrytype exists withRegister(),RegisterURL(), andTryAuth()methods (Add generalized OIDCRegistry for collision-free credential storage #78)OIDCRegistry(Migrate cargo handler to OIDCRegistry #79-Migrate nuget handler to OIDCRegistry #92)RegisterURL()OIDCRegistry.TryAuth()TryAuthOIDCRequestWithPrefix()removed after all handlers migrated