Skip to content
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

Minimize Github API access #220

Closed
Hofer-Julian opened this issue May 10, 2023 · 3 comments
Closed

Minimize Github API access #220

Hofer-Julian opened this issue May 10, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Hofer-Julian
Copy link

When trying to connect fasterthanli.me with my Github, I saw that it would give you read access to organization data.
I might be naive there, but I've hoped that you can verify me without this kind of data.
I assume many companies will not be fond of their private project boards leaking that way.

image

@fasterthanlime
Copy link
Owner

The "private project boards" thing (and wording) is news to me.

I /think/ the reasoning is that I needed to be able to query if an organisation you're a part of is sponsoring me to grant you the early access bonus?

I can probably make this opt-in though (at the very least) so it only asks for it, if it finds you don't support me directly. (Or maybe organisations supporting me shouldn't give access to all their members anyway..)

I'll definitely take a look at this (no ETA guarantees, but I agree this looks fishy)

@fasterthanlime fasterthanlime added the bug Something isn't working label May 10, 2023
@fasterthanlime fasterthanlime self-assigned this May 10, 2023
@fasterthanlime
Copy link
Owner

I've deployed a version of the codebase that only asks for user:read. I think org:read was a mistake and never needed.

I've also deleted all records from the github_credentials table:

app=# delete from github_credentials;
DELETE 835
app=#

...which means I don't have "too-powerful" credentials in my DB anymore and can't accidentally use them.

⚠️ However, if me, or someone with my OAuth credentials, were malicious, they still could obtain tokens with org:read permissions, because GitHub remembers consent was given.

To reset this:

(This doesn't delete your user settings on fasterthanli.me.)

After that, Log out and Log into fasterthanli.me again. Hopefully everything still works!


New flow:

github login screen showing only read-only access to user data same image but the user bit is expanded and has a link to github docs

/profile shows your access level:

screenshot of my site, I have creator tier

Thanks for catching this!

@fasterthanlime
Copy link
Owner

Okay, so the mystery is now fully solved: the scope was useful, but only for me!

I run a different set of GraphQL queries to generate the list at https://fasterthanli.me/patron-list - and those require the read:org scope.

I simply added code that asks me (and only me) to re-log in with broader scopes when I log in with GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants