Github API Collaborators access changed today

It seems until yesterday accounts with Write role on repos could read https://api.github.com/repos/[owner]/[repo]/collaborators on the GH API.

Today, only the Admin role can.

Our merge bot relies on that for automatically figuring out who can trigger it.

Was this change a mistake on Github’s part? Is it going to be reverted?

If it’s intentional, is there some other recommended way for automation to detect collaborator permissions which doesn’t require the Admin role?

10 Likes

I found this issue while diagnosing a similar problem with our merge bot. This change started affecting us somewhere in the last two hours.

3 Likes

Hey @omnibs and @bertptrs :wave:

You all caught this well before I could! We did push a recent update (4 hours ago, as of this writing) that now requires admin access via the API to see collaborators.

This change brings our API in-line with the Web based experience, and should be more consistent.

There’s quite an extensive reasoning behind this and if it’s necessary I can elevate those details.

So yes, this was a deliberate action. For now, I don’t believe there is another permissions level outside of admin to perform this action.

Alternatively, it is true that GitHub Integrations have the ability to list collaborators, but we will likely be reviewing that in the future.

Edit: our team is currently in discussion about the impact this might have, and whether or not a reversion is warranted. Will update when there’s more to share.

1 Like

This change is affecting our merge bot that requires such permission for listing the authorized people to perform such action:

If such list is public, why it should be restricted to admins?

2 Likes

Was there some warning or notification before this went live? Is there a way to be warned about similar changes which could break tools using the GitHub API in the future?

Thanks

4 Likes

Hi @emin63 :wave:

Thanks for joining the Support Community to participate in this thread.

Unfortunately, this change was made silently, after comparing the experience with accessing this information via the web UI, and the API. As it was, it was an inconsistent experience where only Administrators could view collaborator information on the UI, but push access could grant these privileges for the API.

In my edit earlier I mentioned we were considering a rollback, but that doesn’t seem likely now.

We should be posting to our blog about this soon. Though I can’t say exactly when.

1 Like

I have the same problem

I believe this may have also broken the “Get Repository Permissions for a User” API even when a user is trying to access their OWN permissions:
https://docs.github.com/en/rest/reference/repos#get-repository-permissions-for-a-user

I don’t think a user should need to be admin to check their own permissions. Is there any other way for a user to use the API to find out their permission level on a repo?

1 Like

Hey @hatboysam :wave:

I’ve followed the discussion since this morning, and that portion of our codebase (get permission) should not have been impacted. At least, that’s my current understanding.

Would you mind submitting this as a Support ticket? Or if you prefer, we can split this off into it’s own thread.

For now, increasing permissions for these automation tools to admin is going to be the solution.

I’m so sorry for the lack of comms before this was put out, ya’ll. Not the best experience here.

2 Likes

Thanks for the quick response. I filed ticket 1310760 a few hours ago, it has some details. I was able to work around this by using the “get repository” API which returns a personalized permissions field since in my application users only need to know their own permissions.

But it would be great if you could investigate anyway, as I do believe that API is now behaving as I described.

Went back and yes, the collaborators/{user}/permission endpoint for /repos, has also been updated to only allow the owner access to permission details. So if you are a collaborator, you can no longer view this via the API.

Again, apologies for the lack of transparency before this change was made. I myself wasn’t aware until this thread.

We hope to have out a /changelog post soon. :crossed_fingers:

Requiring admin privilege merely for checking whether a user would be allowed to merge a pull request seems overbearing. This would go directly against the principle of least privilege. This change would mean that bots will have to be guarded against accidentally doing any of the other catastrophic actions that admin permissions would bring.

Bots need a non-admin way to know whether a user can trigger it. The jerk change to suddenly make merge bots admin is going to make them a prime target for attack. No one saw this coming, and suddenly giving merge bots admin access is going to be a huge and very obvious security risk.

Not communicating this change isn’t the biggest problem, the biggest problem here is demanding merge bot users to accept this security liability.

10 Likes

:point_up: this; we also got hit by this change, effectively breaking all our Jenkins jobs.

5 Likes

Fully agree. Several Eclipse projects are affected by this as well. See also [cross-project-issues-dev] GitHub issue - "Must have push access to view

1 Like

Even it is effecting us running prow bot

@nethgato you said this change was made to bring the API in line with the information accessible via the Web UI, but actually it is not.

My use case for this API is to allow users to find someone who can review their code. On GitHub this is done via the Reviewers autocomplete box. This box only allows the user to pick other collaborators and is visible to anyone with write acccess:

image

So this information is already intentionally visible in the Web UI to anyone with write access. I would really appreciate if the API would give me at least the same ability to list collaborators.

1 Like

Hi all!

While I was away, a larger number of users both wrote into this thread and into our Support ticketing system. After taking into the consideration the experience this was having, our engineering team rolled back this update.

I’m so sorry for the confusing and frustrating impact this had.

When this comes back up to review for re-adding to our API, we will be posting to the changelog in advance of the change.

11 Likes

Thanks for reconsidering.

2 Likes

Many Thanks.
Nice solution

2 Likes

Ah, I shouldn’t take any thanks here, but I appreciate how perplexing it must have been to see these 403s out of nowhere and without a changelog to point to.

And I should further clarify (rather than edit my last post) that I should not say “when this comes back up,” but “if.”

We are considering marking this internally as a “won’t fix,” but there are some internal conversations that initially sparked the change, and was fast tracked, without considering the impact on automation tools that leverage those endpoints.

So if it comes back, it will be announced in advance.

3 Likes