Skip to content

GitHub's Permission System is Flawed #113

Open

Description

@zenorocha

This is an open letter to @github on behalf of third-party app developers.

For a very long time, permission scopes has been a common issue for both users and app developers.
These scopes are extremely permissive and far too broad, preventing users from using third-party applications.

We need a more granular permission system and we hope you listen to this.

Below you can find some examples that describes exactly what we mean by how flawed the system is and some suggestions to improve it.


gist scope

Grants write access to gists.

Let's say you want to build an app like GistBox to organize gists. In order to read read private gists you would need to request the gist scope.

Here's what users would see:

gist

Even if you don't want to create any gists, you still need to request write access. Some users may find that ok, but other users can be afraid of having someone creating or editing their precious code snippets.

Solution: what if we had read_public:gist, read_private:gist, write_public:gist, and write_private:gist instead?


public_repo scope

Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public repositories and organizations. Also required for starring public repositories.

Another example: let's say you want to create an app like Waffle, HuBoard, or ZenHub to manage your issues. In order to have a basic functionality like creating issues on public repositories, you would need to request the public_repo scope.

Here's what users would see:

public repo

Note how broad this permission is. These apps have no interest on wikis, deploy keys, webhooks, or anything like that. But still, that's the only way to go.

Solution: what if we had read_public:repo_code, read_public:repo_issues, and write_public:repo_stars instead?


repo scope

Grants read/write access to code, commit statuses, collaborators, and deployment statuses for public and private repositories and organizations.

Finally, the issue I'm personally facing right now. Let's say you want to build an app like DevSpace to read public and private events. For this we'd have to use the repo scope.

Here's what users would see:

private repo

This is probably the most shocking permission scope. Even though we don't want to write anything we'd still need to request a permission that can change code, issues, and many other important things from private repos.

Solution: what if we had read_public:events_repo, read_private:events_repo, read_public:events_org, and read_private:events_org instead?


You see, those are just few examples, there are many other apps facing the same issue:


@syropian, @ashumz, @acroca, @drusellers, @burtonjc, @pierrebeugnot, @rauhryan, @homeyer, @sxgao3001, @marydavis, @nparsons08, @zhangchiqing, @wbeard, @jamie, @diophore, @glenngillen, @troy, @winston do you agree?


I love GitHub and I hope this discussion contributes back to their product. There's a lot of potential on this community and I believe we can make a change.

Activity

  1. maracaipe commented on Feb 11, 2016

    @maracaipe

    +1

  2. noscript commented on Feb 11, 2016

    @noscript

    +1

  3. fdaciuk commented on Feb 11, 2016

    @fdaciuk

    +1

  4. glenngillen commented on Feb 11, 2016

    @glenngillen

    Yes, but I also need to expand on the scope of the issue.

    I've been doing some consulting and advisory work lately. Some of it quite technical in nature which means people have been asking me to dig through private repos for them. The first time I got added to an organization that I wasn't managing myself I realized I'd also burdened that organization with all historical decisions I'd made to allow a 3rd party to "read and write to all public and private repositories". Which is surprisingly common. At the very least it seems every CI and code coverage tool requires it.

    I removed the ones I didn't need any more, and informed the client (Client A) that CodeClimate would now have access to their repo. They were OK with it. Then new client and new tools. They were using CircleCI which uses GitHub for oauth and (understandably) requires "repo" permissions. Even though I'm not personally using CircleCI they now have access to all of "my" repositories too.

    Next client (Client B) uses CodeCov.io. Same problem. Except now I'm not just granting them access to my repositories they also get access to Client A too. This quickly became untenable. The cumulative and transitive nature of these permissions across not just repositories but multiple clients was at best irresponsible on my part.

    And so I'm left with either managing multiple GitHub accounts to work around it (which is a major PITA) or not being able to use anything that asks for permission to access private repos.

    A massive 👍^(n*clients) from me.

  5. iPaulPro commented on Feb 11, 2016

    @iPaulPro

    +1 Can't consider using DevSpace (and many other services) until this happens.

  6. jolaurin commented on Feb 11, 2016

    @jolaurin

    +1

  7. luanmuniz commented on Feb 11, 2016

    @luanmuniz

    👍 That's nothing more to add here, the idea and the concept kind of say everything.
    I really hope Github stop and listen what the users have to say and start to make something about it

  8. pillowsoft commented on Feb 11, 2016

    @pillowsoft

    +1

  9. acroca commented on Feb 11, 2016

    @acroca

    I doubt anyone (other than GH because they have to implement it) will disagree with adding more granular permissions, it's always good to have more fine control.
    So +1!

  10. troy commented on Feb 11, 2016

    @troy

    Rather than another "+1" comment, which I don't think is useful, I'd change this request: how about a description of the current barriers to implementing this?

    GitHub knows there's demand for this and I have no doubt, abstractly would like to see it exist just as much as everyone on this thread. That's never been a question. It seems much more likely that the implementation is actually much harder than someone who doesn't know GitHub's codebase would suspect, like perhaps because GitHub stores all repo-related assets (issues, etc) together and doesn't have a way to enforce fine-grained permissions via some access methods.

    I'm more interested in learning more about the challenges we might not be aware of than about assuming either (a) GitHub is unaware that this would be useful, or (b) GitHub needs ideas how to codify permissions. While I certainly could be wrong, I doubt either of those is the case.

    So, even as the person who may have first requested this from GitHub (December 8, 2011), I'm more interested in learning about implementation limitations that I might not be considering than I am in assuming I'm fully informed. I'd like to hear from GitHub more about what makes this particularly challenging to implement, though.

    GitHub has done a great job with org-level restrictions on third-party applications and a way for org members to request approval from org admins.

    One of my emails in a 2011 exchange with GitHub is below. The gist is that sooner or later, a third-party service with a lot of keys will get hacked. While that can't be prevented, the damage can be mitigated with fine-grained permissions so that only the few services which need code access (like CI) have it, restrictions and alerts on concurrent access with keys granted to the same developer ID, a developer-facing "Expire all granted keys" button, and perhaps the ability for integrations to flag a specific user/key as a honeytoken.

    In case it helps any other OAuth key holders, here's the implementation (now using attr_encryptor) that my service uses to encrypt keys from GitHub and other services. Doesn't cover anywhere near all types of breaches, but does cover some. It's described in Taco's privacy policy.

    One other reason: assuming the API is successful, third-party services will have meaningful numbers of OAuth tokens - that's the whole point. I could see a worst-case scenario where they get hacked (and maybe even don't notice), the tokens get used and source code gets out, and by the time anyone's aware of it, the story is "GitHub got hacked!&$@"

    Even though you guys had nothing to do with it, it would make people rethink hosted source code hosting.

    A token with repo scope is the keys to the kingdom, and making this level of access be the only way to get private repos is asking for people to accumulate more trust than they need. I'd argue that consumers should be pushed towards the metadata-only scope that doesn't currently exist, and the repo scope should be the exception, replete with big red "This app will have easy, complete access to your source code" warning letters on the grant page.

  11. Electryc commented on Feb 11, 2016

    @Electryc

    +1

  12. zhangchiqing commented on Feb 11, 2016

    @zhangchiqing

    +1

  13. troy commented on Feb 11, 2016

    @troy

    Instead of just adding "+1," how about adding information about your situation/environment or explaining your own opinion? There's no point in more +1's.

  14. dmethvin commented on Feb 11, 2016

    @dmethvin

    ...and in fact just highlights the flaws of the issues system that we would love to fix. Those of you who +1 this, each time you do that GitHub dutifully sends out a notification to those watching this repo, currently 108 people. Is your +1 worth interrupting the day of 108 people?

    That's a rhetorical question, I'm unsubscribing from this thread because the important points have been made.

  15. luanmuniz commented on Feb 12, 2016

    @luanmuniz

    @troy There is no point in "explaining your own opinion". About the situation/environment from Github and their codebase, speculate about their codebase is the worse thing we can do, because we know absolutely nothing and everything we think will be just speculation and will probably not apply to the the situation. We will maybe discard a few situations without even know whats actually happening.

    Github is the one that need to come with their situation and opinion, as far as our knowledge goes, the only thing we can do, is work on a spec (high high level spec, pretty much like @zenorocha did in this post) and wait for them to give us some light. Anything more than that is effort on something we cant do anything or know nothing about, Sadly.

    @dmethvin The "+1" comments make clear that this is not something that just 4 or 5 guys want. There is not many ways to "just agree" with things in Github and this is how much and many people care about the specific post/subject. Its important to make clear who cares about the subject. Until Github make another feedback system besides comments, this is what we have to express our support. By the way, this is one of the central points of this repository, another feedback system. Its on the README of this repo.

  16. 73 remaining items

  17. mightyiam commented on Aug 29, 2021

    @mightyiam

    @mattwelke I do agree with you on the integration hell but still doesn't matter. Huge corporation, ton of employees, earns a lot. This should've been done way earlier. I mean how did they miss such a basic key in authorization concepts in the first place? Any filesystem that ever existed has practiced some sort of separate read/write privileges for the consumer of those data. How did a freaking team of engineers didn't think of that?

    They probably did think of it.

  18. eran-medan commented on May 12, 2022

    @eran-medan

    It's not just for apps, how many organizations just give everyone write access (or even admin) without making sure these permissions are actually used?

    We actually built a github app (it's 100% free, I hope it's not considered spam) that you can use to list all of your github apps across multiple orgs (can be in different enterprises) and see which ones don't use the permissions they ask for, when they were last used, who installed them etc. (after integrating go to the Inventory tab and click Apps).

    Is that useful? Would love your feedback!
    That "single pane of glass" functionality is free without limits (including for Enterprises with any number of orgs), I know no one likes comments that promote a product, but thought this might be relevant. (direct link to skip the marketing fluff: https://app.arnica.io/)

    EDIT: for now it requires an Org account (free / teams / enterprise), we are working to add personal repo accounts as well. P.s. if you have any issues / questions, to avoid spamming everyone who is subscribed to this issue my personal email is [email protected]). Thanks again!!

  19. Nakilon commented on May 12, 2022

    @Nakilon

    @eran-medan I don't see how to use it. Right after giving it my email it started some dialog of "create an organization".

  20. eran-medan commented on May 12, 2022

    @eran-medan

    @Nakilon Ah, yes, we are working to automate it, just choose any display name for your Arnica org (e.g. if you would like later to invite someone). My co-founder keeps saying we need to automate that part and I guess this is an indication we must prioritize it as it's a needless onboarding step. Sorry about that! And thank you so much for the feedback! (if everyone gets a notification on this, my apologies, probably deserves a separate dear github issue, they should have a separation between reply all and reply on issue comments...)

  21. alfuken commented on Jun 3, 2022

    @alfuken

    Hello from 2022! 👋

    In just a few months, in the autumn, this issue will be old enough to go to the primary school! Ain't it cute?! ;)

  22. mmseng commented on Jun 11, 2022

    @mmseng

    Let's be real, the underlying issue is much older than this Dear GitHub thread.

    So that I'm not being cheeky for no reason, I'll chime in from my slightly different perspective.

    I'm an IT Pro, not a developer. I want to rely on misc. repos as sources for code and other content, such as configuration information that is used across many varied and disparate third party integrations, scripts, etc. I don't have the time, nor expertise, nor desire, to screw around with building and maintaining full on GitHub/OAuth Apps™ for these use cases, and neither do any of my colleagues.

    This is simple for public repos, as we can just straight up download the repo content with wget, or Invoke-WebRequest, or the like. But it's pragmatically impossible for restricted repos. Our options are (as I've gathered; again, I'm not a developer by trade):

    • Use Personal Access Tokens: Completely over-permissioned, and also exposes not only all apps/integrations to each other's repos, but exposes my own personal repos to anything I'm doing with my account under our GitHub Enterprise organization, and vice versa.
    • Use Deploy Keys: requires using SSH, which severely complicates things, compared to just downloading over HTTPS. Also these are only good for single repositories, meaning a new deploy key would need to be documented and maintained for every single repo used by every single integration. And some integrations may need to access multiple repos. So this is not realistically scalable.
    • Build proper OAuth Apps: Has the same scalability issue as Deploy Keys, only with much more baggage and staff expertise required.

    Formerly we were using GitLab, and we actually did sanitize a good chunk of the content just so we could make repos public. This limited the usefulness to some degree, but the simplification was worth it. I just can't, in good conscience, migrate this methodology to GitHub. At least with our GitLab instance I didn't have to think about the countless bots that are constantly scraping content.

    I see GitHub's priorities are in the right place though (/s): https://skyline.github.com/

  23. Nakilon commented on Jun 11, 2022

    @Nakilon

    I see GitHub's priorities are in the right place though (/s): https://skyline.github.com/

    haha, yes, this thing is so cringe
    I guess it was made following some tutorial by some chief officer employe's child
    very important thing to have, thanks, Microsoft

  24. GitHunter0 commented on Jun 11, 2022

    @GitHunter0

    Hi @gwestersf , is there a specific reason for not having a personal access token with READ-ONLY access for private repositories? I imagine it would be pretty easy to implement although highly valuable to the community. Thank you.

  25. gy-mate commented on Sep 25, 2023

    @gy-mate

    Is this still an open case after 7 years? Wow.

  26. mmseng commented on Sep 25, 2023

    @mmseng

    They grow up so fast, don't they 😢

    In seriousness, a while back Github released an announcement that "fine-grained personal access tokens" were on their roadmap: github/roadmap#184

    And then later announced their release: https://github.blog/2022-10-18-introducing-fine-grained-personal-access-tokens-for-github/

    I never got around to sifting through the details to figure out if it would work for my use case. I doubt it addresses all the use cases shared here, but maybe useful for some people in this thread.

  27. rlafrance commented on Sep 27, 2023

    @rlafrance

    yeah - github's permissions schemes are severely lacking -> even in enterprise. i want to give a user permissions to push branches, but prevent them from pushing tags. not possible.

    i want to take an artifact from one repository and use it in another repository... try again.

    seriously github feels like a beta product. I would never choose it for a professional dev setup.

  28. GitHunter0 commented on Sep 27, 2023

    @GitHunter0

    seriously github feels like a beta product. I would never choose it for a professional dev setup.

    @rlafrance , what service are you using instead?

  29. rlafrance commented on Sep 27, 2023

    @rlafrance

    @rlafrance , what service are you using instead?

    we just migrated to github from bitbucket + Jenkins and I wish we hadn't. it would have been better to just upgrade build server instead of trying to merge SCM and build server(github actions) together. we lost a lot of configurability and its causing a lot of process issues

  30. Nakilon commented on Nov 13, 2023

    @Nakilon

    I see GitHub's priorities are in the right place though (/s): https://skyline.github.com/

    Oh no, the toy is broken!

    image

    I bet they'll fix it quicker than the permissions issue.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions