Conversation
hanikesn
marked this pull request as ready for review
September 10, 2026 16:31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Users synced from an org whose SAML SSO is enforced at the enterprise level come through without any email when the connector authenticates as a GitHub App.
checkOrgSAMLdetects enterprise SAML, sees no--enterprises, and lands insamlStateDisabled. Even with--enterprisesset, the enterprise path reads/enterprises/{enterprise}/consumed-licenses, which GitHub does not enable for GitHub Apps, so it needs a classic PAT withread:enterprise. GitHub's REST API for org members never returns emails, and most members keep their public email private.Without an email C1 cannot correlate a GitHub account with an identity user. In our tenant every GitHub account had to be linked by hand after the user accepted the org invitation, and grant tasks for team memberships failed against the unlinked account in the meantime. Switching the connector to PAT auth just to read one endpoint trades an app installation for a personal token bound to an enterprise owner, which we did not want.
What
GitHub exposes
User.organizationVerifiedDomainEmails(login:)via GraphQL to org-scoped credentials regardless of where SAML is configured. It returns the member's verified emails on the org's verified domains and needs only the Members read permission the app already has.This adds a per-user fallback after the existing SAML branches: when no valid email was found, take the member's verified-domain emails, first valid one as primary, remaining as secondary. GraphQL errors are logged at warn and skipped, so orgs without verified domains behave exactly as before. SAML branches are untouched, no config changes.
Verification
Listpath against a GraphQL stub with no SAML provider and asserts on the emitted user trait: primary and secondary emails set, invalid entries dropped, empty list leaves the email empty without failing the sync. The test fails on upstream main.go build,go test ./...,go vet,golangci-lint run --new-from-rev=upstream/mainall clean.