-
Notifications
You must be signed in to change notification settings - Fork 0
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
ref: Use a bot access token to check for Github org membership #307
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple initial questions.
Why will tests fail? It looks like we didn't add tests for this functionality. Should we? |
Actually, it looks like the tests call Also without the the token the API call would be unauthenticated, and I think it will return a 404 and mark everyone external. |
Here's some internal docs on available GH bots for reference. |
6c62ce0
to
1a3ad20
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments inline, mostly renaming a few other q's.
The Github API for checking organization membership will only show membership for people with the "private" setting if the API call is made by a member of that organization. Since the Github application is not a user thus not part of the Sentry org, we need to use a bot account's Personal Access Token to correctly check that a user is part of the Github org.
1a3ad20
to
12d3d00
Compare
Co-authored-by: Chad Whitacre <chadwhitacre@sentry.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, another couple questions:
- Can we cache the user client?
- Remove duplicate line?
Also, next step is going to be to review available bots, form an opinion about which to use here (or new one!?) for GH_USER_TOKEN, and file a Jira request with Security so we have papertrail (cc me).
Co-authored-by: Billy Vong <billyvg@users.noreply.github.com>
I've generated a PAT for @getsentry-bot with |
I've gained access to the Google account for @getsentry-bot, and I've configured SSO to authorize the PAT for use with the org. I believe this is ready to deploy! 👍 |
Confirmed working, I am seeing @antonpirker start to show up in company vs. community. 👍 😉 |
The Github API for checking organization membership will only show membership for people with the "private" setting if the API call is made by a member of that organization.
Since the Github application is not a user thus not part of the Sentry org, we need to use a bot account's Personal Access Token to correctly check that a user is part of the Github org.
Fixes #216
NOTE: Someone with the right permissions will need to generate and add the access token to this repo's secrets.