-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support hex v2 registry #29622
Comments
How are the elixir/erlang versions set? And is it possible to include an elixir script to fetch the package info? That would make this very straightforward. |
No, we don't permit the calling of CLI tools as part of lookup |
Ok. The suggestion here is to allow a script which is executed with The current methodology fetches json from an API and performs no validations. Using the registry, responses are protobuf encoded and include other features such as package signing verification. So our options for hex are to either leverage the functionality that ships with elixir for auth, fetching, decoding, and package signing verification or reimplement all of that functionality in TS. I wasn't able to find any other datasources that are processing protobufs or protobuf related packages in core, so that would be a new addition. So the proposal here is to let hex interact with hex registries in the hex datasource. Are there concerns or certain pieces of other functionality that are part of the current policy? We're trying to understand the reason for the policy if it pertains only to package lookup. |
This is a very basic demo of the proposal. https://gist.github.com/bryannaegele/4b9d11bc927d3887267028d1ea9f64f9 |
We want datasources to be in TS so they can be used in the browser. Not other datasource requires binaries for lookups. If it's extremely hard it perhaps indicates that the registry should be made more accessible in future? Most are REST-based. |
running external code for datasources will slow down the lookup phase massively, because we need to ensure to install a proper version of erlang and elixir. that is usually only done when we need to update lockfiles. so I'm strictly against calling any binaries inside datasources. There are official JavaScript libraries to decode protobuff messages easily. |
Yep. Understandable. I'll get working on it |
I'm pretty much done with this but running into one issue. In order to try and keep the previous amount of package detail with this change we have to make two calls. The first is to the registry, then a second to the API when it's hosted on hex.pm to get metadata. The hexpm registry and api are hosted on different domains (registry is a subdomain). The issue I'm seeing when trying it locally with a private organization package hosted on hex, only the first call matches a hostRule and sets the auth token. config
log
As you can see, a host rule is only applied to the first http call in This does not crop up in unit tests.
|
FYI you should see that log messageabout applying authentication once per host, not once per request. Based on your hostRules, I would expect the auth to be applied to https://hex.pm too |
Ah. I didn't catch that. I think that could present an edge case if a user needed to auth to multiple orgs but that isn't the case in the example repo. I'll dig into this. |
Works today 🤷🏻 . I'll mark the PRs ready for review. |
@paulo-ferraz-oliveira You might find this interesting/important, there was a lot of work put into this but it wasn't finished. TL DR; the solution is split into 2 PRs and possibly requires more setup for testing then the issue I pointed out. |
Describe the proposed change(s).
Discussed in #24764
In order to support private registries, we need the hex datasource to support the hex v2 registry format described here: https://github.com/hexpm/specifications/blob/main/registry-v2.md
It seems that we should switch to using this registry protocol by default, including for the public registry.
The text was updated successfully, but these errors were encountered: