Skip to content

feat(ui): optional single-tenant static auth mode for self-hosted deployments (no WorkOS) - #2702

Open
AR-2910 wants to merge 1 commit into
diggerhq:developfrom
AR-2910:ui-static-auth-mode
Open

AR-2910 wants to merge 1 commit into
diggerhq:developfrom
AR-2910:ui-static-auth-mode

Conversation

@AR-2910

@AR-2910 AR-2910 commented Aug 23, 2026

Copy link
Copy Markdown

Problem

The UI hard-requires WorkOS: without WORKOS_* env vars it cannot authenticate anyone, which is a hurdle for self-hosted single-tenant deployments that already control access in front of the UI (network perimeter, VPN, or an authenticating reverse proxy). Related friction exists for any deployment whose backend organisation wasn't created through WorkOS (e.g. the GitHub OAuth path) — the UI's hardcoded DIGGER_ORG_SOURCE: workos header can't resolve such orgs.

Change (fully opt-in — default behavior unchanged)

  • New DIGGER_UI_AUTH_MODE=static mode: withAuth() returns a fixed identity from DIGGER_STATIC_* env vars and WorkOS is never called — no WORKOS_* env is needed to boot. Unset (or any other value) keeps WorkOS auth exactly as today.
  • getOrganisationDetails / getOrganization / ensureOrgExists return a static organisation (DIGGER_STATIC_ORG_NAME) in static mode instead of the WorkOS org lookup; terminateSession redirects home instead of building a WorkOS logout URL.
  • The DIGGER_ORG_SOURCE header sent to the backend is now env-configurable (default workos, unchanged), so deployments whose org has a different external source can resolve it.
  • withAuth() now has an explicit Promise<UserInfo | NoUserInfo> return type (required for the widened union to typecheck; also tightens the existing inference).
  • DIGGER_STATIC_ORG_ID is required in static mode and fails loudly with a clear message if missing.
  • Docs: new "Static auth mode (no WorkOS)" subsection in self-hosting/configuration.mdx.

Testing

  • vite build + tsc --noEmit clean.
  • This mode has been running in our production fork since 2026-08-05 (single-tenant deployment behind a network perimeter): the drift dashboard, projects, and repos pages all resolve real backend data with zero WorkOS configuration.

Happy to rename the env vars / adjust the flag shape if maintainers prefer a different convention.

🧠 Ai UsageDetails (if applicable):

Per the contributing guide: implemented with AI assistance (Claude Code) in our production fork, then human-reviewed and production-validated before being generalized (opt-in flag, neutral defaults) for upstream.

…loyments

Add an opt-in DIGGER_UI_AUTH_MODE=static that runs the UI as one fixed
identity (DIGGER_STATIC_* env) without calling WorkOS, for self-hosted
single-tenant deployments where access is already controlled in front of
the UI (network perimeter, VPN, or an authenticating reverse proxy). No
WORKOS_* env is required in this mode. Default behavior is unchanged:
unset (or any other value) keeps WorkOS auth as-is.

- withAuth() returns the static identity in static mode, and now has an
  explicit UserInfo | NoUserInfo return type so the union typechecks
- getOrganisationDetails/getOrganization/ensureOrgExists return a static
  organisation instead of the WorkOS org lookup; terminateSession
  redirects home instead of building a WorkOS logout URL
- the DIGGER_ORG_SOURCE header sent to the backend is env-configurable
  (default workos, unchanged) so orgs created outside WorkOS (e.g. the
  GitHub OAuth path) can resolve
- document the mode in self-hosting/configuration.mdx
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.

1 participant