feat: add site-admin account creation mode for GHES#23
Conversation
Add account-creation-mode and site-admin-token config options to support GHES environments where email-based org invitations are disallowed by enterprise policy (e.g., SSO/LDAP-enforced environments). When account-creation-mode is set to "site_admin_create", the connector calls POST /admin/users via a site-admin PAT instead of sending org invitation emails. The user is created immediately with no invitation acceptance required. Vendors unreleased baton-github changes from: ConductorOne/baton-github#172 Fixes: CXH-1594
| siteAdminClient: gh.siteAdminClient, | ||
| instanceURL: gh.instanceURL, | ||
| }), | ||
| AppBuilder(gh.client, gh.orgCache), |
There was a problem hiding this comment.
🟠 Bug: AppBuilder is called here but is not defined anywhere in the vendored code. Similarly, skipEntitlementsAndGrantsAnnotations (used on line 112 to initialize resourceTypeApp) is also missing. This will cause a compilation failure. The upstream baton-github PR likely added these in a new file (e.g., app.go) that was not included when vendoring. Re-run go mod vendor against the dependency to pull in all files.
| orgs []string | ||
| client *github.Client | ||
| orgCache *orgNameCache | ||
| orgs []string |
There was a problem hiding this comment.
🟡 Suggestion: instanceURL is stored on the struct and passed through InvitationBuilderParams but is never read in any method. If it's not needed for a future change in this PR, consider removing it to avoid dead code.
| Org: ghc.Org, | ||
| DirectCollaboratorsOnly: ghc.DirectCollaboratorsOnly, | ||
| AccountCreationMode: ghc.AccountCreationMode, | ||
| SiteAdminToken: ghc.SiteAdminToken, |
There was a problem hiding this comment.
🟡 Suggestion: Once the vendoring issue is fixed and AppBuilder is available, DefaultCapabilitiesBuilder.ResourceSyncers() (line 46) should also include connector.AppBuilder(nil, nil) so the new app resource type is declared in the connector's capabilities.
Connector PR Review: feat: add site-admin account creation mode for GHESBlocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0 Review SummaryThis PR adds Security IssuesNone found. Correctness Issues
Suggestions
Prompt for AI agents |
Summary
account-creation-modeandsite-admin-tokenconfig options to baton-github-enterprisePOST /admin/usersinstead of email-based org invitationsDependency Notice
This PR vendors unreleased changes from ConductorOne/baton-github#172.
Before merging this PR, the dependency PR must be reviewed, merged, and released. After the dependency is released, update go.mod to point to the released version and re-vendor before merging.
Fixes: CXH-1594
Test plan
--account-creation-mode=site_admin_create --site-admin-token=<token>against a GHES instanceAutomated PR Notice
This PR was automatically created by c1-dev-bot as a potential implementation.
This code requires: