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

github: Use noreply email if public email is private. #2618

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wlynch
Copy link

@wlynch wlynch commented Aug 3, 2022

Overview

This change adds an option to Dex to return these emails instead of fetching
their primary email. Since this only appears to work for public and
Enterprise Cloud flavors of GitHub (notably this doesn't appear to be
supported on Enterprise Server), this is restricted to the github.com
domain for now.

What this PR does / why we need it

GitHub has a feature for commit emails that allows users to set a noreply email that uniquely identifies them in commit messages:

{id}+{login}@users.noreply.github.com

See https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#about-commit-email-addresses

This is typically used on GitHub to associated user accounts with
commits without exposing the users real email.
Dex can use this in a similar manner to ID users in a stable way without
needing to fetch emails marked as private on GitHub.

Fixes #2617
Part of sigstore/gitsign#65

Special notes for your reviewer

Does this PR introduce a user-facing change?

Adds new config option "noreplyPrivateEmail" to GitHub connector. 
If set, configures the connector to use
{id}+{login}@users.noreply.github.com as the user email if the user has
marked their email as private on GitHub.
Only works for public and Enterprise Cloud versions of GitHub (i.e. github.com).

GitHub has a feature for commit emails that allows users to set a noreply email that uniquely identifies them in commit messages:

```
{id}+{login}@users.noreply.github.com
```

See https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#about-commit-email-addresses

This is typically used on GitHub to associated user accounts with
commits without exposing the users real email.
Dex can use this in a similar manner to ID users in a stable way without
needing to fetch emails marked as private on GitHub.

This change adds an option to Dex to return these emails instead of fetching
their primary email. Since this only appears to work for public and
Enterprise Cloud flavors of GitHub (notably this doesn't appear to be
supported on Enterprise Server), this is restricted to the github.com
domain for now.

Signed-off-by: Billy Lynch <[email protected]>
@wlynch wlynch changed the title github: github: Use noreply email if public email is private. github: Use noreply email if public email is private. Aug 4, 2022
Copy link
Contributor

@haydentherapper haydentherapper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great change, thanks!

@wlynch
Copy link
Author

wlynch commented Aug 23, 2022

@sagikazarmark would you be able to take a look at this? 👀

@wlynch
Copy link
Author

wlynch commented Sep 21, 2022

Friendly bump. Let me know if there's anything I can do on my end to move this along! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

github: Use noreply email if public email not set.
2 participants