Skip to content

Allow a verified OIDC domain to be shared across multiple organizations (single-tenant / self-hosted deployments) #8382

Description

@iftika1

Summary

Hive enforces that a verified OIDC email domain can belong to only one organization in the
entire instance. At the same time, both SCIM user provisioning and OIDC sign-in require the
user's email domain to be verified for that specific organization. These two rules are in direct
tension for self-hosted, single-tenant deployments where one company runs Hive and structures
many organizations by line of business, but every user shares one corporate email domain (e.g.
@company.com).

The result: only the first organization to verify company.com can provision or admit
@company.com users. Every other organization is permanently blocked.

Proposal

Add an opt-in, instance-level configuration (env var) listing operator-trusted email domains.
Default is empty → no behavior change (per-org uniqueness preserved for Cloud). When a domain is
listed:

  • SCIM email validation (handleEmailValidation) and OIDC sign-in treat the domain as verified for
    any organization, without requiring a per-org oidc_integration_domains row.
  • This leaves the strict per-org verification path, the register/verify guards, and the
    only_one_verified_domain_name_idx index completely intact — no schema change. Trusted
    domains simply short-circuit the verified-domain lookup at the consumer.

Sketch:

// consumer check becomes:
if (isTrustedEmailDomain(email, env.trustedEmailDomains)) return ok;
// else fall back to the existing per-org findVerifiedDomainByOIDCIntegrationIdAndDomainName(...)

This is the least invasive option: it doesn't relax the DB uniqueness constraint (so nothing about
Cloud's guarantees changes) and reframes verification from "per-org domain ownership" to
"instance-level operator-declared trust," which matches the single-tenant reality that the operator
(not any one org) owns the domain.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions