GitHub App authentication
Central approves repository access and issues temporary credentials. Pilot clones and fetches directly from GitHub.
One App. Central owns access.
Keep the App private key in Central. Give Pilot a token for one approved repository.
App settings, team and server grants, selected repository IDs.
Connection reference. Temporary token in a private process cache.
App installation, repository permissions, token expiry.
Connect an account
Authenticate the person in Central, then approve the GitHub repositories.
Reuse the existing IAM check on the exact target server. A Pilot admin session does not identify the Central user.
Verify the user’s right to grant ongoing deployment access. Read access alone is insufficient.
Choose an existing installation. Otherwise install the App and resume discovery. Organization approval may be required.
Save a team deployment grant. It continues after sign-out until an administrator or installation change removes access.
Endpoint contract
Proposed names. Machine calls use the verified Pilot credential; browser writes use the Central session.
Pilot Admin API
/api/v1| Endpoint | Purpose |
|---|---|
POST /git/connection-attempts | Return the Central authorization URL. |
GET /git/connection | Safe connection status, account, and authentication method. |
GET /git/repositoriesGET /git/branches | Browse approved sources and branches. Return no credentials. |
DELETE /git/connection | Disable the App grant in Central, then clear local state. |
Keep the existing PAT request shape on PUT /git/connection. Records without auth_type remain PAT records.
Central GitHub API
/api/method/central.api.github.| Method + function | Authentication | Result |
|---|---|---|
POST start_connection | Pilot credential | Short-lived attempt + connection URL. Derive team and server. |
POST begin_authorization | Central session | Check server:console; start state-bound authorization with PKCE. |
GET oauth_callbackGET installation_setup | Bound session + state | Exchange the code or resume installation discovery. Neither creates a deployment grant. |
POST complete_connection | Central session | Verify repository rights. Save the selected repository grant once. |
GET connectionsGET repositories | Pilot credential | Safe summaries scoped to that credential. |
POST repository_token | Pilot credential | One repository token + expires_at. Backend only; no-store response. |
POST disconnect_pilotPOST disconnect_connection | Pilot / Central session | Pilot removes its own grants. A Central user needs server:console. |
POST webhook | GitHub HMAC signature | Process installation and repository access changes. Reconcile missed events. |
Do not add token issuance to the existing site-scoped Central proxy. Only explicit backend methods on CentralClient can request GitHub credentials.
Data and access rules
Bind every grant to Central’s verified identity, not a supplied team ID or local bench path.
| State | Essential fields |
|---|---|
| Central Settings New GitHub tab | App ID, client ID, slug, private key, client secret, webhook secret. Secrets use Password fields. |
| GitHub Connection New DocType + repository child rows | Team, server, Pilot Credential, installation ID, status, version, selected repository IDs. Unique on credential + installation. |
| Connection attempt Expiring, site-scoped Redis | Target identity, user/session binding, state, PKCE verifier, encrypted temporary user token. Proposed expiry: 15 minutes. |
Check both identities
The person needs server:console and verified GitHub administration rights. Token issuance checks the credential, current server/team ownership, active grant, and selected repository.
Limit the token
Use contents: read and an explicit repository ID. Recheck the grant version after the GitHub call. Reject stale results. Do not hold a database lock over that call.
Handle an outage
Running apps stay up. A valid cached token may still serve Git requests. New credentials need Central. Report unavailable separately from revoked access or rate limits.
Disconnect precisely
Block new issuance first. Clear reachable caches and revoke known tokens. Previously issued credentials can remain valid until revoked or expired. Keep other server grants intact.
Token issuance · essential pseudocode
grant = require_active_grant(credential, connection, repository_id)
token = github.create_installation_token(
grant.installation_id,
repository_ids=[repository_id],
permissions={"contents": "read"},
)
if not grant_is_still_authorized(grant, credential):
github.revoke_token(token)
raise ConnectionChanged()
return token, token.expires_atImplementation order
Approve the contract, then deliver one complete private-repository journey.
Authorize and issue
Add the settings, connection record, server-scoped permissions, and expiring attempts. Build GitHub calls under central/integrations/github.py and routes under central/api/github.py.
Resolve credentials once
Extend CentralClient. Use one Git credential resolver for API requests, CLI, and workers. Update settings/Git.vue and regenerate connection types. Preserve PAT and public-repository behavior.
Prove recovery and isolation
Test cross-team denial, callback replay, expiry, disconnect races, missed webhooks, and Central outages. Verify a private clone and later fetch, including required private dependencies.