matrix-org / go-neb

Extensible matrix bot written in Go
Apache License 2.0
283 stars 92 forks source link

Allow different levels of Github OAuth access #65

Open ara4n opened 7 years ago

ara4n commented 7 years ago

We should give the option of what level of githubbery we'll let NEB do. From an infosec perspective some folks will be rightly very skeptical about giving a 3rd party bot any kind of access to their private GH repos

kegsay commented 7 years ago

Github are particularly annoying with that because they are way too broadly scoped OAuth scopes - it's either public_repo (FULL r/w access), private_repo (FULL r/w access), and so on. In reality, we only really want read access :/ but alas.

There are 3 kinds of "levels of githubbery" I think will be appropriate:

In practice, this means /requestAuthSession needs an additional parameter to say what level of auth you want to do on Github. If the level of auth is missing, then it'll do the minimal set (this is important because starter links have 0 args because Vector doesn't know how to interact with integrations). This parameter will be set depending on which of the 2 "Login with OAuth" buttons you click. This also requires a tweak to /getSession, as it will proudly proclaim you have authenticated when really it is the minimal set of things and you can't do webhooks. We'll need to check for failures due to lack of permissions (which are now recoverable failures) as well.

wezm commented 3 years ago

It appears that more fine grained access to private repositories is available though the GitHub Apps API. When done this way the app is "installed" into each private repo it should have access to and the permissions can be more fine grained. This is the approach the Slack integration takes.