Skip to content

0002. Tenant provisioning and membership sync โ€‹

Status: accepted. Applies to crates/doors and orbit tenant provision.

Decision โ€‹

  • Tenants are provisioned explicitly. orbit tenant provision --org-id <sidecar org id> --name <name> [--module <id> ...] runs on the owner connection: it creates the tenant (Registry::provision_tenant), maps the sidecar organisation to it in doors.identities and writes the tenant's first audit entry with actor and door System. That command is the only place a request-independent System audit entry is written. No tenant is ever created from a token: a token whose org_id is not mapped is UNAUTHENTICATED.
  • Membership roles are synced from tokens, outside the bus. The web process sets a person's role to the token's org_role through doors.set_role, a definer function only orbit_doors may execute. That role is held only by the web process (never by handlers, which run as orbit_runtime, nor by workers). Every change is audited in the same transaction (authz.membership.sync) and rate-limited per actor. The input is only ever a verified token. Moving it behind an audited bus command is tracked in issue #7.
  • Open sign-up is off by default. The sidecar refuses email sign-up unless AUTH_ALLOW_SIGNUP=true (the dev stack sets it; the self-hosted stack does not). The first user and their organisation are created by deploy/bootstrap.sh, which runs the sidecar's src/bootstrap.ts in its container and then orbit tenant provision. Users of the optional OIDC provider are still created on first sign-in: the provider decides who may sign in, and a user without a provisioned organisation reaches no tenant.
  • Any signed-in user can create organisations in the sidecar. That is harmless: an organisation reaches no tenant until an operator provisions it.
  • The owner connection never reaches a serving process (ADR 0004): orbit migrate and orbit tenant provision are its only users.

Consequences โ€‹

  • An organisation created in the sidecar cannot use Orbit until an operator provisions it. Self-serve sign-up for the managed cloud needs a later decision (e.g. a provisioning service that holds the owner role and checks billing), not a token-triggered path.
  • Anyone holding orbit_doors credentials can set any mapped person's role in any mapped tenant: treat its connection string like the owner's and give it to the web process only.

Orbit by SkySync Tech. Licensed under AGPL-3.0.