-
Notifications
You must be signed in to change notification settings - Fork 47
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
Permissions for Registrator #329
Comments
This is nothing new though, right?
I don't think so. Wouldn't that essentially mean "everyone" (i.e. you just have to fix a type in the docs or soemthing) can make releases? |
Agree. This seems like a big security hole. |
Yes, this is not new. But we've had a few users who've expressed strong opinions on the matter. So I wanted to have a public issue with a summary of the situation, and ensure we are not missing anything.
Yes. That would indeed be the case. |
If people want to register a package, and they don't want to give JuliaHub write access to their repo, they should install the Registrator GitHub App (the "comment bot"). If people want to register a package, and they don't want to give JuliaHub write access to their repo, and also for some reason they don't want to install a GitHub App, we can flesh out RegistratorServerless and make it an official third option. RegistratorServerless.jl:
|
Yeah, I am strongly opposed to this. |
Note that anyone can open a PR in the General Registry to register any package regardless of whether they are a contributor or not. I don't think the contributor check therefore can be called a security hole. |
Yes, but registrator PRs are automerged, so that's different, and much more risky. |
|
One of the core premises of AutoMerge is that we can trust PRs coming from Registrator and jlbuild. The AutoMerge guidelines were based on this premise, and the AutoMerge code base was written with this assumption. If PRs coming from Registrator can no longer be guaranteed to be coming from someone with the appropriate level of permissions, we should disable AutoMerge. |
I'm have temporarily disabled AutoMerge: JuliaRegistries/General#34270 until we resolve this issue. |
I think we should have a file in the repository that lists the users who can register that package. |
It's not the worse idea in the world. I had that thought in the past. Someone pointed out to me on Slack that technically there is a security issue if someone changes their GitHub username. E.g. if the file looks like this:
Suppose I change my GitHub username to |
Out of curiosity, why can't people just install the Registrator GitHub App ("comment bot")? It's easy to use, and it doesn't need any write permissions. (And we don't need a file in the repo with a list of authorized users.) Here are the required permissions: Are there people for whom this list of permissions is not acceptable? |
We could use the registered email ID instead. |
Sure. But this all feels like a solution looking for the problem. I still don't understand why users can't just use the GitHub App and call it a day. |
I've been thinking about it lately, but I fear it'd open some backdoors to let anyone register a revision. I need to find some time to think about the workflow more carefully. |
Does not work for GitLab. And some people like using the WebUI. |
Fair enough. Okay, we could look for a file on the repository called I suppose that this is opt-in only, right? If that file does not exist in the repository, then we don't use this feature. |
Definitely we need to do a lot more thinking (and careful review of the code) before we think about deploying RegistratorServerless. |
This is probably the best way forward for people that absolutely need to use the web UI. We should think about what identifier we use. Options include:
I think email address is better than GitHub username. Is there a better identifier that we could use? |
Sounds good. I can start working on this. I'm still open to hear from others what they think. |
I posted this link in the |
A few observations:
|
We already let the owner register if the package is under the owners account in GitHub. But packages are also in orgs and checking whether you belong to the org requires write access. |
You can check for public membership without write access. (That's how RegistratorServerless works.) But you can't check if someone is a non-member that has commit access. |
And probably if a member doesn't have commit access? |
Sure. But, IIRC, Registrator will allow a member to register even if they don't have commit access, with the logic that if you added someone to your organization, presumably you are okay with them doing certain things (like registering packages) on behalf of the organization. |
@DilumAluthge We've switched back to checking for collaborator. Can you enable auto-merge on General now? |
Some thoughts:
|
This is already the case in JuliaHub. If the user owns the package then we authorize the user right away.
GitHub only lets you make an email public if it is verified. GitHub only sends that one public email in the Oauth response. If a user has no public email IDs then we receive nothing.
Yes, we should do these things. An org can have a public repo for keeping the maintainers file(s) that they want to link to in their package repos. |
I did some work on this yesterday so I decided to put it in a PR #330. This does not have to be merged right away and we can continue to solidify the ideas here. I think the PR does much of the ground work needed such that we only need to figure out the little important bits like what needs to go in the auth file besides email and how the linking should work etc. Let me know your thoughts. |
I would propose the following sequence of checks to decide who the maintainers are:
This feels like a lot of options but two of them are error cases (1 & 4) and the motivation for the other options is as follows. The simplest case is when someone maintains a package themselves and they don't have to do anything (6). If someone wants to allow some other person to maintain (i.e. tag releases) without messing with hosting a file somewhere, they can just add a file in the top of the project called If people are ok with that, the next question is what the file format should be. It could just be a list of email addresses (with |
So we've had users complain that the web registrator hosted on juliahub.com asks for write permissions. I wanted to discuss the options, since this is security stance that affects the registry itself. We need consensus from the registry maintainers about what the correct stance should be.
The underlying requirement is that before the registrator user opens a PR on the registry repo, it needs to be sure that the user requesting the registration has write permissions to the repository.
For the web registrator we need to query github apis to get this information. However, the list of "collaborators" on a package is not available to a user unless that user has write permissions to the repository. This is the reason we ask for write permissions for the Oauth token we get from Github. Also, afaik, we cannot restrict permissions per repository on the Oauth token -- per repository access can be given using a deploy token, but that is not a one-click flow.
As a result of the strength of said feedback, we have this morning termporarily changed juliahub web registrator to use only read permissions. I fear however, this may have been a knee jerk reaction by us. To enable the registrator functionality with read permissions, we are now using the list of "contributors" for a repo. This information is freely accessible. However, this list also includes any users who have had a PR merged to the repo, even if they do not have write access. Additionally, this list precludes any organisation members or admins, who may have write permissions, but have not actually merged any code to that repo. Both of which is problematic. The latter can be solved by asking such users to make their org membership public, but the former (user with PR merged) is a problem.
The commentbot needs the same information, but it works as a Github app that is installed on each repo on which it operates. As a result, it has the permissions required to get these priviledged fields.
So I suppose the main question to the registry maintainers is as follows: are we happy to have a security stance where all "contributors" in a repo can make a registry PR.
Given that most registry PRs are merged automatically, and with the focus on "supply chain attacks", this is an important question that should be carefully considered.
The text was updated successfully, but these errors were encountered: