-
Notifications
You must be signed in to change notification settings - Fork 384
Description
Authentication & Authorization – GitHub SSO Integration
🧭 Epic
Depends on: Add SSO & IdP-Issued Tokens to Gateway
Title: Turn-key GitHub SSO for the Gateway
Goal: Ship a plug-and-play GitHub identity-provider module plus step-by-step docs so that, once the generic SSO framework is in place, an operator can enable GitHub login & RBAC in ≤ 10 minutes by dropping a handful of env-vars.
Why now: GitHub is the canonical developer identity source for most teams. Offering a first-class, documented integration right after core SSO lands will unblock adoption and avoid every project reinventing the same “GitHub OAuth callback” glue.
🧭 Type of Feature
- Developer-experience / Docs
- New functionality (pluggable IdP)
- Security hardening (stronger account hygiene)
🙋♂️ User Story 1 – One-click GitHub Login
As a: Platform engineer
I want: to set GITHUB_OIDC_CLIENT_ID/SECRET + GITHUB_ORG in my .env and have the UI redirect to GitHub OAuth automatically
So that: users authenticate with the same account they push code with.
✅ Acceptance Criteria
Scenario: Successful GitHub OAuth login
Given the generic SSO feature-flag is ON
And the GitHub provider is configured with valid client-id/secret
When an unauthenticated browser visits "/"
Then the gateway MUST redirect to GitHub's consent screen
And MUST honour the received OIDC code
And MUST create an encrypted session cookie carrying the user's GH login & teams🙋♂️ User Story 2 – Team-to-Role Mapping
As a: Security admin
I want: GitHub organisation teams to map automatically to RBAC groups
So that: membership in tools-maintainers on GitHub grants the mcp-admin role in the gateway.
✅ Acceptance Criteria
Scenario: Enforce RBAC via GitHub team
Given a user belongs to GitHub team "finance-analysts"
When the callback finishes
Then the gateway MUST attach group "finance-analysts" to the session
And subsequent API calls MUST evaluate RBAC policies using that group list🙋♂️ User Story 3 – Copy-paste Setup Guide
As an: Operator
I want: a README section with copy-paste cURL/Make targets & screenshots for creating the GitHub OAuth App
So that: I can enable the integration without reading GitHub docs end-to-end.
✅ Acceptance Criteria
-
README.mdgains a “GitHub SSO” subsection directly after the existing Authentication table . -
It lists the new variables:
Setting Description Example GITHUB_OIDC_CLIENT_IDOAuth App / GitHub App Client ID Iv1.abc123GITHUB_OIDC_CLIENT_SECRETOAuth Client secret shhh_very_secretGITHUB_ORGRestrict login to a single organisation my-companyGITHUB_TEAM_CLAIM(opt) Comma-sep team slugs treated as groups platform,financeGITHUB_CALLBACK_PATHCallback endpoint exposed by gateway /auth/github/callback -
Includes a Make target
make github-sso-demothat spins up a local tunnel (e.g.ngrok) and echoes the callback URL.
📐 Design Sketch
flowchart TD
Browser -->|OAuth 2.0| GitHub[(GitHub OIDC)]
GitHub --> AuthSvc[Gateway Auth Service]
subgraph Gateway
AuthSvc --> RBAC[Role Mapper]
RBAC --> API["UI / JSON-RPC / REST"]
end
| Component | Change | Detail |
|---|---|---|
auth_providers/github.py |
NEW | OIDC discovery, code-exchange & token verification |
auth_service.py |
UPDATE | Register “github” provider under the generic SSO plugin interface |
| DB | UPDATE | Store gh_id, login, avatar_url in users table |
| Config | ADD | GITHUB_* vars shown above |
🔄 Roll-out Plan
- Phase 0: Feature-flag
EXPERIMENTAL_SSO_GITHUB(off by default). - Phase 1: Ship docs & terraform-friendly env-var examples.
- Phase 2: Promote to Supported once three gateways run it in staging.
- Phase 3: Deprecate bespoke GitHub login scripts; rely solely on the provider.
📝 Spec-Draft Clauses
- GitHub Auth Clause – “Gateways MUST support OAuth 2.0 Authorisation Code flow with PKCE for
github.comand GitHub Enterprise Server ≥ 3.11.” - Team Claim Clause – “When the
teamsscope is granted, the gateway SHOULD translate<org>/<team>slugs into RBAC groups of the same name.”
📣 Next Steps
- Prototype provider against GitHub public cloud & GHES.
- Integrate unit-tests mocking
/login/oauth/access_token&/user/orgsendpoints. - Draft README insert & record a 60 sec asciicast demo.
This epic ensures that - once generic SSO groundwork ships - enabling GitHub SSO is literally a five-line diff in .env plus the documented callback route.