Skip to content

Conversation

@benmoss
Copy link
Contributor

@benmoss benmoss commented Jan 25, 2026

Description

To fix/add support for prefix-dev/pixi#4524, so that users can have different authentication for different channels on the same domain.

Implements longest-prefix matching for all URL schemes, enabling
multiple credentials per domain with different paths.

Fixes: prefix-dev/pixi#4524
@benmoss benmoss changed the title Add support for partial path matching authentication feat: Add support for partial path matching authentication Jan 25, 2026
@benmoss benmoss closed this Jan 25, 2026
@benmoss benmoss reopened this Jan 25, 2026
@tdejager tdejager requested a review from wolfv January 28, 2026 08:08
Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

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

Looks good! I want to test whether this doesnt break previously stored tokens but looking at the code I dont think it will.

@wolfv
Copy link
Contributor

wolfv commented Jan 29, 2026

I wanted to double check whether this has a negative performance impact.

@benmoss
Copy link
Contributor Author

benmoss commented Jan 30, 2026

I wanted to double check whether this has a negative performance impact.

Yeah very good point, if this is done per-package and the cost of backend get calls is high, this could be expensive since it's now O(n) where n is the number of path and domain segments

@benmoss
Copy link
Contributor Author

benmoss commented Jan 31, 2026

We could optimize for host lookups, so basically make the current implementation the first attempt instead of starting from a full URL match first. In other words:

# lookup example.com/org/repo/file.json
get("example.com")
get("example.com/org/repo/file.json")
get("example.com/org/repo")
get("example.com/org")
get("*.com")

The downside of this is we get unintuitive behavior where example.com overrides longer path matches if you have both

@benmoss
Copy link
Contributor Author

benmoss commented Jan 31, 2026

We could also do this as a runtime configuration so that we could expose the algorithm to users in pixi settings

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants