diff --git a/.github/scripts/http-e2e.sh b/.github/scripts/http-e2e.sh index 56cbab01147..d1ac13c2546 100755 --- a/.github/scripts/http-e2e.sh +++ b/.github/scripts/http-e2e.sh @@ -187,10 +187,10 @@ case "$group" in scim) export NEXT_PUBLIC_FORCE_HOSTED=true export BILLING_ENABLED=true NEXT_PUBLIC_BILLING_ENABLED=true - export ENTERPRISE_ENABLED=true NEXT_PUBLIC_ENTERPRISE_ENABLED=true - export SCIM_ENABLED=true NEXT_PUBLIC_SCIM_ENABLED=true - export SSO_ENABLED=true NEXT_PUBLIC_SSO_ENABLED=true - export ORGANIZATIONS_ENABLED=true NEXT_PUBLIC_ORGANIZATIONS_ENABLED=true + export ENTERPRISE_ENABLED=true + export SCIM_ENABLED=true + export SSO_ENABLED=true + export ORGANIZATIONS_ENABLED=true export INTERNAL_API_SECRET=scim-http-ci-local-secret-at-least-32-characters export DB_TX_TRIPWIRE=throw export NEXT_PUBLIC_CHAT_DISABLED=true @@ -282,7 +282,6 @@ case "$group" in export NEXT_PUBLIC_FORCE_HOSTED=false export COPILOT_TOOL_PERMISSIONS_ENABLED=true export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true - export NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true NEXT_PUBLIC_ORGANIZATIONS_ENABLED=true case "$group" in assistant-actions|organization-search) needs_browser=true ;; *) needs_browser=false ;; esac if [ "$needs_browser" = true ]; then start_browser_install "$group" --only-shell chromium; fi export INTERNAL_API_SECRET=desktop-inbox-http-ci-local-secret-at-least-32-characters @@ -335,7 +334,6 @@ case "$group" in export NEXT_PUBLIC_FORCE_HOSTED=false export KNOWLEDGE_MEMBER_ACCESS=true CREDENTIAL_GROUPS=true ACCESS_CONTROL_ENABLED=true export SIM_LINKS=true - export NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true export API_ENCRYPTION_KEY="$ENCRYPTION_KEY" start_browser_install "$group" --no-shell chromium extension_identity=$(bun - <<'JS' diff --git a/apps/docs/content/docs/chat/mailer.mdx b/apps/docs/content/docs/chat/mailer.mdx index 670debb607d..b4d73d1505a 100644 --- a/apps/docs/content/docs/chat/mailer.mdx +++ b/apps/docs/content/docs/chat/mailer.mdx @@ -11,7 +11,7 @@ Sim Mailer gives an enabled workspace an email address. Send or forward a messag A workspace **Admin** configures the inbox. On Sim Cloud, availability follows the workspace's Max or Enterprise plan and active billing, rather than the sender's individual plan. -On self-hosted deployments, availability depends on configured Chat and email services. `INBOX_ENABLED` or billing-disabled configuration can allow access, but the required Chat service key must still be configured. See [self-hosted environment variables](/platform/self-hosting/environment-variables). +On self-hosted deployments without billing, the inbox is on by default. Set `INBOX_ENABLED=false` to turn it off; that closes it on the server and removes it from the interface. It still needs the Chat service key and email services configured to work. See [self-hosted environment variables](/platform/self-hosting/environment-variables). Members keep their own workspace permissions when submitting email tasks. An allowed external email sender can submit read-only tasks; allowlisting does not grant workspace membership, workflow execution, mutation access, or raw-secret access. diff --git a/apps/docs/content/docs/platform/enterprise/access-control.mdx b/apps/docs/content/docs/platform/enterprise/access-control.mdx index 3b3b27c4e3f..4c5097c245e 100644 --- a/apps/docs/content/docs/platform/enterprise/access-control.mdx +++ b/apps/docs/content/docs/platform/enterprise/access-control.mdx @@ -147,7 +147,6 @@ On billing-disabled deployments, enable permission groups through the enterprise ```bash ACCESS_CONTROL_ENABLED=true -NEXT_PUBLIC_ACCESS_CONTROL_ENABLED=true ``` The enterprise master configuration can enable the feature; an explicit feature value takes precedence. Billing-enabled self-hosted deployments still require Enterprise. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). diff --git a/apps/docs/content/docs/platform/enterprise/audit-logs.mdx b/apps/docs/content/docs/platform/enterprise/audit-logs.mdx index f7f58c486bb..c052d61cd71 100644 --- a/apps/docs/content/docs/platform/enterprise/audit-logs.mdx +++ b/apps/docs/content/docs/platform/enterprise/audit-logs.mdx @@ -118,7 +118,6 @@ On billing-disabled deployments, enable audit logs through enterprise configurat ```bash AUDIT_LOGS_ENABLED=true -NEXT_PUBLIC_AUDIT_LOGS_ENABLED=true ``` Explicit feature values take precedence over the enterprise master setting. Billing-enabled self-hosted deployments retain the Enterprise gate. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). diff --git a/apps/docs/content/docs/platform/enterprise/custom-blocks.mdx b/apps/docs/content/docs/platform/enterprise/custom-blocks.mdx index 27ca548f35c..2e101ce10e9 100644 --- a/apps/docs/content/docs/platform/enterprise/custom-blocks.mdx +++ b/apps/docs/content/docs/platform/enterprise/custom-blocks.mdx @@ -7,7 +7,7 @@ import { Callout } from '@/components/ui/callout' Publish a workflow as a custom block so teammates can provide its inputs and use selected outputs without access to its source workflow. The block always runs the source's latest deployment. Use it for a shared knowledge lookup, an authenticated internal API, an enrichment step, or a prompt and guardrail maintained in one place. -Publishing and managing a block requires admin access to its source workspace. Billing-enabled deployments require an Enterprise organization. On billing-disabled deployments, enable the custom-block feature through enterprise configuration or `CUSTOM_BLOCKS_ENABLED=true` and `NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED=true`. An organization is still required; see [self-hosted enterprise setup](/platform/enterprise/self-hosted). +Publishing and managing a block requires admin access to its source workspace. Billing-enabled deployments require an Enterprise organization. On billing-disabled deployments, enable the custom-block feature through enterprise configuration or `CUSTOM_BLOCKS_ENABLED=true`. An organization is still required; see [self-hosted enterprise setup](/platform/enterprise/self-hosted). ## Publish a block diff --git a/apps/docs/content/docs/platform/enterprise/data-drains.mdx b/apps/docs/content/docs/platform/enterprise/data-drains.mdx index aa15772c507..002e11a0ab9 100644 --- a/apps/docs/content/docs/platform/enterprise/data-drains.mdx +++ b/apps/docs/content/docs/platform/enterprise/data-drains.mdx @@ -248,10 +248,9 @@ Enable the feature through enterprise configuration or explicitly set: ```bash DATA_DRAINS_ENABLED=true -NEXT_PUBLIC_DATA_DRAINS_ENABLED=true ``` -An explicit feature value takes precedence over `ENTERPRISE_ENABLED`. When disabled, the page is hidden, mutating drain requests return `404`, and the dispatcher does no work. Billing-enabled deployments retain the Enterprise gate. Keep server and public feature configuration aligned; `bunx sim-setup doctor` checks the pair. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). +An explicit feature value takes precedence over `ENTERPRISE_ENABLED`. When disabled, the page is hidden, mutating drain requests return `404`, and the dispatcher does no work. Billing-enabled deployments retain the Enterprise gate. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). The dispatcher requires scheduled calls to `GET /api/cron/run-data-drains`. Set the same `CRON_SECRET` on the app and its caller; the endpoint returns `401` when it is unset. Generate a secret if needed, then install it in both configurations: diff --git a/apps/docs/content/docs/platform/enterprise/data-retention.mdx b/apps/docs/content/docs/platform/enterprise/data-retention.mdx index c3252f45023..82652802ebc 100644 --- a/apps/docs/content/docs/platform/enterprise/data-retention.mdx +++ b/apps/docs/content/docs/platform/enterprise/data-retention.mdx @@ -128,7 +128,6 @@ On billing-disabled deployments, enable retention through enterprise configurati ```bash DATA_RETENTION_ENABLED=true -NEXT_PUBLIC_DATA_RETENTION_ENABLED=true ``` An explicit feature value takes precedence over the enterprise master configuration. No plan-based default window is introduced: configure the windows you intend to apply. diff --git a/apps/docs/content/docs/platform/enterprise/forks.mdx b/apps/docs/content/docs/platform/enterprise/forks.mdx index b9ad8d99ef5..12868c33f0c 100644 --- a/apps/docs/content/docs/platform/enterprise/forks.mdx +++ b/apps/docs/content/docs/platform/enterprise/forks.mdx @@ -188,7 +188,6 @@ On billing-disabled deployments, enable forking through enterprise configuration ```bash FORKING_ENABLED=true -NEXT_PUBLIC_FORKING_ENABLED=true ``` Explicit feature values take precedence over the master configuration. Billing-enabled self-hosted deployments still require Enterprise. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). diff --git a/apps/docs/content/docs/platform/enterprise/index.mdx b/apps/docs/content/docs/platform/enterprise/index.mdx index 7ccf39afa11..7ef66101373 100644 --- a/apps/docs/content/docs/platform/enterprise/index.mdx +++ b/apps/docs/content/docs/platform/enterprise/index.mdx @@ -26,7 +26,6 @@ On a self-hosted deployment with billing disabled, enable enterprise features th ```bash ENTERPRISE_ENABLED=true -NEXT_PUBLIC_ENTERPRISE_ENABLED=true ``` Individual feature flags override the master switch. Most enterprise settings also need an organization that owns the workspace. Choose one instance-wide organization or provision separate organizations through the Admin API. diff --git a/apps/docs/content/docs/platform/enterprise/scim/index.mdx b/apps/docs/content/docs/platform/enterprise/scim/index.mdx index 7414b2e0d42..0882bc06595 100644 --- a/apps/docs/content/docs/platform/enterprise/scim/index.mdx +++ b/apps/docs/content/docs/platform/enterprise/scim/index.mdx @@ -16,7 +16,7 @@ Configure [SSO](/platform/enterprise/sso) separately for authentication. SCIM ca - On Sim Cloud, use an Enterprise organization and an organization owner or admin account. - [Verify every email domain](/platform/enterprise/verified-domains) you will provision. Sim refuses account creation or an email change to an unverified domain. -- On self-hosted deployments, enable SSO to reach **Single sign-on → Provisioning**, and enable SCIM. The enterprise master pair enables both; individual setup uses `SSO_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED`, `SCIM_ENABLED`, and `NEXT_PUBLIC_SCIM_ENABLED`. See [Self-hosted SSO setup](/platform/enterprise/sso#self-hosted-setup) and [Deployment and upgrades](#deployment-and-upgrades). +- On self-hosted deployments, enable SSO to reach **Single sign-on → Provisioning**, and enable SCIM. `ENTERPRISE_ENABLED` enables both; individual setup uses `SSO_ENABLED` and `SCIM_ENABLED`. See [Self-hosted SSO setup](/platform/enterprise/sso#self-hosted-setup) and [Deployment and upgrades](#deployment-and-upgrades). ## Plan membership and access @@ -205,7 +205,7 @@ While the connection is disabled, **Lock managed membership** and **Disable just Apply database migrations before the new application code. The SCIM tables and suspension fields are additive, allowing older code to run against the expanded schema during rollout. - Keep `SCIM_ENABLED=false` and `NEXT_PUBLIC_SCIM_ENABLED=false` until all older application instances and workers are drained. Older code does not enforce SCIM suspension or explicit permission-group membership. These explicit flags also override the hosted default. + Keep `SCIM_ENABLED=false` until all older application instances and workers are drained. Older code does not enforce SCIM suspension or explicit permission-group membership. This explicit flag also overrides the hosted default. After SCIM has suspended accounts or established managed access, rolling back to code that predates SCIM is unsafe: it cannot enforce those restrictions. Disabling synchronization does not undo suspension or restore earlier membership semantics. diff --git a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx index 8ac8b0e825f..f7702feb060 100644 --- a/apps/docs/content/docs/platform/enterprise/self-hosted.mdx +++ b/apps/docs/content/docs/platform/enterprise/self-hosted.mdx @@ -13,22 +13,19 @@ This guide covers the standard billing-disabled configuration. If billing is ena ## Enable the feature set -Set both the server flag and its browser twin, then restart the application: +Set the server flag, then restart the application: ```bash ENTERPRISE_ENABLED=true -NEXT_PUBLIC_ENTERPRISE_ENABLED=true ``` -The server flag controls access and the server-resolved workspace settings. The browser twin also enables controls that read browser configuration directly, including SSO on the login page and the Function block's **Sandbox** selector. On a Compose install or source checkout, `bunx sim-setup doctor` reports mismatched twins. See [Verify your install](/platform/self-hosting/verify). +The server flag controls access and everything the browser shows, including SSO on the login page and the Function block's **Sandbox** selector: the browser reads the server's resolved settings, so there is no `NEXT_PUBLIC_` variable to set. Browser variables left over from older releases do nothing; on a Compose install or source checkout, `bunx sim-setup doctor` reports them. See [Verify your install](/platform/self-hosting/verify). Individual flags override the master switch. For example, to enable the suite with data drains disabled: ```bash ENTERPRISE_ENABLED=true -NEXT_PUBLIC_ENTERPRISE_ENABLED=true DATA_DRAINS_ENABLED=false -NEXT_PUBLIC_DATA_DRAINS_ENABLED=false ``` You can also leave the master switch unset and enable individual features. The [feature flag reference](#feature-flag-reference) lists them all. @@ -238,29 +235,31 @@ OAuth token cleanup removes expired and revoked credentials independently of sig Explicit individual flags override the master switch, including when set to `false`. With billing disabled and no enterprise flags set, session policies and the Sim Mailer inbox remain enabled by default. Other features require opt-in. -| Feature | Server variable | Browser variable | -| --- | --- | --- | -| Enterprise suite | `ENTERPRISE_ENABLED` | `NEXT_PUBLIC_ENTERPRISE_ENABLED` | -| Organizations | `ORGANIZATIONS_ENABLED` | `NEXT_PUBLIC_ORGANIZATIONS_ENABLED` | -| Permission groups | `ACCESS_CONTROL_ENABLED` | `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED` | -| SAML and OIDC sign-in | `SSO_ENABLED` | `NEXT_PUBLIC_SSO_ENABLED` | -| Directory provisioning | `SCIM_ENABLED` | `NEXT_PUBLIC_SCIM_ENABLED` | -| Audit logs | `AUDIT_LOGS_ENABLED` | `NEXT_PUBLIC_AUDIT_LOGS_ENABLED` | -| Insights | `USAGE_MONITORING_ENABLED` | `NEXT_PUBLIC_USAGE_MONITORING_ENABLED` | -| Custom blocks | `CUSTOM_BLOCKS_ENABLED` | `NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED` | -| Session policies — enabled by default | `SESSION_POLICIES_ENABLED` | `NEXT_PUBLIC_SESSION_POLICIES_ENABLED` | -| Retention deletion | `DATA_RETENTION_ENABLED` | `NEXT_PUBLIC_DATA_RETENTION_ENABLED` | -| Data drains | `DATA_DRAINS_ENABLED` | `NEXT_PUBLIC_DATA_DRAINS_ENABLED` | -| Credential groups | `CREDENTIAL_GROUPS` | — | -| Workspace forks | `FORKING_ENABLED` | `NEXT_PUBLIC_FORKING_ENABLED` | -| Sim Mailer inbox — enabled by default | `INBOX_ENABLED` | `NEXT_PUBLIC_INBOX_ENABLED` | -| Sandboxes | `SANDBOXES_ENABLED` | `NEXT_PUBLIC_SANDBOXES_ENABLED` | +Each feature is one server variable. Permission groups also turn on organizations, and organizations are always on when billing is enabled. + +| Feature | Variable | +| --- | --- | +| Enterprise suite | `ENTERPRISE_ENABLED` | +| Organizations | `ORGANIZATIONS_ENABLED` | +| Permission groups | `ACCESS_CONTROL_ENABLED` | +| SAML and OIDC sign-in | `SSO_ENABLED` | +| Directory provisioning | `SCIM_ENABLED` | +| Audit logs | `AUDIT_LOGS_ENABLED` | +| Insights | `USAGE_MONITORING_ENABLED` | +| Custom blocks | `CUSTOM_BLOCKS_ENABLED` | +| Session policies — enabled by default | `SESSION_POLICIES_ENABLED` | +| Retention deletion | `DATA_RETENTION_ENABLED` | +| Data drains | `DATA_DRAINS_ENABLED` | +| Credential groups | `CREDENTIAL_GROUPS` | +| Workspace forks | `FORKING_ENABLED` | +| Sim Mailer inbox — enabled by default | `INBOX_ENABLED` | +| Sandboxes | `SANDBOXES_ENABLED` | ### Sandbox readiness A Sandbox entitlement also requires a remote execution provider with credentials and an immutable Function base image. Until the server verifies readiness, the Function block offers no **Shell** language, and **Settings → Sandboxes** shows an upgrade notice instead of a sandbox list. -`NEXT_PUBLIC_SANDBOXES_ENABLED` exposes the Function block's **Sandbox** selector; it asserts readiness rather than checking it. Set it only after configuring the selected provider and Function base. `bunx sim-setup doctor` compares it with provider readiness. +The Function block's **Sandbox** selector appears once the server confirms both the entitlement and a ready provider. There is no browser variable to set. JavaScript without `import`, `require`, a selected sandbox, or a sandbox file-path reference runs in local Node child workers in the app container when Sandbox flags are off. Python, Shell, JavaScript with external imports, and selected custom Sandboxes require the remote Function base and fail with a configuration error until it is ready. See [Sandboxes](/platform/self-hosting/sandboxes). @@ -269,7 +268,7 @@ JavaScript without `import`, `require`, a selected sandbox, or a sandbox file-pa | Symptom | Check | | --- | --- | | A settings section is missing | Check its server flag and restart the app after changing environment variables. These values load at boot; a rebuild is not needed. | -| The login page has no SSO option, or Function has no Sandbox selector | Set the matching `NEXT_PUBLIC_` flag. Run `bunx sim-setup doctor` to check twins and Sandbox readiness. | +| The login page has no SSO option, or Function has no Sandbox selector | Check `SSO_ENABLED` (or `ENTERPRISE_ENABLED`) and Sandbox readiness, then restart the app. Run `bunx sim-setup doctor` to check Sandbox readiness. | | **Settings → Sandboxes** shows an upgrade notice | Check Sandbox entitlement, provider credentials, and the immutable Function base. | | An enabled feature has no effect in a workspace | Confirm that the workspace belongs to an organization. Use the backfill or workspace move procedure if needed. | | Retention deletes nothing | Check `DATA_RETENTION_ENABLED`, explicit windows, scheduler requests, and `CRON_SECRET`. | diff --git a/apps/docs/content/docs/platform/enterprise/sso.mdx b/apps/docs/content/docs/platform/enterprise/sso.mdx index a36c162158b..31076443614 100644 --- a/apps/docs/content/docs/platform/enterprise/sso.mdx +++ b/apps/docs/content/docs/platform/enterprise/sso.mdx @@ -275,22 +275,19 @@ Different domains can also use different providers, such as Okta for `eng.acme.c ## Self-hosted setup -For a deployment with billing disabled, enable SSO and its browser twin: +For a deployment with billing disabled, enable SSO: ```bash SSO_ENABLED=true -NEXT_PUBLIC_SSO_ENABLED=true # Organization membership on first SSO sign-in ORGANIZATIONS_ENABLED=true -NEXT_PUBLIC_ORGANIZATIONS_ENABLED=true # Optional directory provisioning tab SCIM_ENABLED=true -NEXT_PUBLIC_SCIM_ENABLED=true ``` -The enterprise master pair also enables these features. See [Self-hosted enterprise](/platform/enterprise/self-hosted) for organization setup. +`ENTERPRISE_ENABLED=true` also enables these features. See [Self-hosted enterprise](/platform/enterprise/self-hosted) for organization setup. `SSO_TRUSTED_PROVIDER_IDS` is an optional comma-separated list for non-SSO provider account linking. It does not authorize SSO linking; SSO trust comes from the provider's verified domain. diff --git a/apps/docs/content/docs/platform/enterprise/usage-tracking.mdx b/apps/docs/content/docs/platform/enterprise/usage-tracking.mdx index 53f42f47227..401a491eb0a 100644 --- a/apps/docs/content/docs/platform/enterprise/usage-tracking.mdx +++ b/apps/docs/content/docs/platform/enterprise/usage-tracking.mdx @@ -97,7 +97,6 @@ Enable Insights through enterprise configuration or explicitly set: ```bash USAGE_MONITORING_ENABLED=true -NEXT_PUBLIC_USAGE_MONITORING_ENABLED=true ``` Explicit values take precedence over the enterprise master configuration. Billing-enabled deployments retain the Enterprise gate. Organization owner/admin access is still required. See [self-hosted enterprise setup](/platform/enterprise/self-hosted). diff --git a/apps/docs/content/docs/platform/enterprise/verified-domains.mdx b/apps/docs/content/docs/platform/enterprise/verified-domains.mdx index bf39ae424e2..8ad9e3e03bd 100644 --- a/apps/docs/content/docs/platform/enterprise/verified-domains.mdx +++ b/apps/docs/content/docs/platform/enterprise/verified-domains.mdx @@ -41,10 +41,9 @@ Enable SSO to expose **Domains** in the single sign-on settings: ```bash SSO_ENABLED=true -NEXT_PUBLIC_SSO_ENABLED=true ``` -You can instead enable the enterprise suite with both `ENTERPRISE_ENABLED=true` and `NEXT_PUBLIC_ENTERPRISE_ENABLED=true`. Set the browser twin too: the login page's SSO entry point reads it before a workspace loads. See [Self-hosted enterprise](/platform/enterprise/self-hosted). +You can instead enable the enterprise suite with `ENTERPRISE_ENABLED=true`. The login page's SSO entry point reads the server's setting, so there is no browser variable to set. See [Self-hosted enterprise](/platform/enterprise/self-hosted). The older `/workspace//settings/domains` path still resolves to **Single sign-on → Domains**. diff --git a/apps/docs/content/docs/platform/self-hosting/authentication.mdx b/apps/docs/content/docs/platform/self-hosting/authentication.mdx index 32669b65d41..ca374b2b267 100644 --- a/apps/docs/content/docs/platform/self-hosting/authentication.mdx +++ b/apps/docs/content/docs/platform/self-hosting/authentication.mdx @@ -61,11 +61,33 @@ Google and Microsoft share their client credentials with integrations. Register ## Control registration and sign-in [#controlling-who-can-sign-up] +`REGISTRATION_MODE` decides who can create an account and whether email/password and email OTP work at all: + +| `REGISTRATION_MODE` | New accounts | Email/password and email OTP sign-in | +| --- | --- | --- | +| `open` (default) | Any enabled method | On | +| `no-email-signup` | Social login only | On | +| `closed` | None | On | +| `no-email` | Social login only | **Off, including for existing accounts** | +| `closed-no-email` | None | **Off, including for existing accounts** | + +In the `closed` modes, existing accounts can still sign in, including to accept workspace invitations. No mode affects accounts created by SSO on first sign-in or by SCIM provisioning. An unrecognized value closes self-serve registration (sign-in keeps working) and logs an error until you correct it. + +`REGISTRATION_MODE` replaces three variables. They still work and log a deprecation warning; set alongside `REGISTRATION_MODE`, the more restrictive setting wins: + +| Deprecated variable | Equivalent | +| --- | --- | +| `DISABLE_REGISTRATION=true` | `closed` | +| `DISABLE_EMAIL_SIGNUP=true` | `no-email-signup` | +| `EMAIL_PASSWORD_SIGNUP_ENABLED=false` (or `NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED=false`) | `no-email` | +| `DISABLE_REGISTRATION=true` with `EMAIL_PASSWORD_SIGNUP_ENABLED=false` | `closed-no-email` | + +`NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED=false` used to only hide the email form in the browser. It now also turns off email/password and email OTP sign-in on the server for every account, existing ones included; set `REGISTRATION_MODE` explicitly to choose the behavior you want. + +The other sign-in controls: + | Variable | Effect | | --- | --- | -| `DISABLE_REGISTRATION=true` | Blocks new email/password, email OTP, and social accounts. Existing accounts can sign in, including to accept workspace invitations. SSO registration is unaffected. | -| `DISABLE_EMAIL_SIGNUP=true` | Blocks new email/password and email OTP registrations. Existing accounts can still sign in through those methods. | -| `EMAIL_PASSWORD_SIGNUP_ENABLED=false` | Disables email/password and email OTP sign-in and signup, including for existing accounts. | | `ALLOWED_LOGIN_DOMAINS` | Comma-separated email domain allowlist, such as `acme.com,acme.co.uk`. Applies to email/password and email OTP sign-in as well as email signup. | | `ALLOWED_LOGIN_EMAILS` | Comma-separated address allowlist. An address or its domain may satisfy the allowlists. | | `BLOCKED_SIGNUP_DOMAINS` | Comma-separated blocked domains. Blocks signup, sign-in, and executions for addresses in those domains, including subdomains. | @@ -74,16 +96,15 @@ Google and Microsoft share their client credentials with integrations. Register | `BLOCKED_EMAIL_MX_HOSTS` | MX-host substrings to reject when MX validation is enabled. | - Email allowlists do not filter first-time Google, GitHub, or Microsoft sign-in. To restrict social access, disable login providers you have not vetted or restrict membership through your identity provider and use SSO. MX validation applies only to email/password signup, not sign-in or email OTP. Registration-disabled and blocked-domain/address controls also cover social accounts. + Email allowlists do not filter first-time Google, GitHub, or Microsoft sign-in. To restrict social access, disable login providers you have not vetted or restrict membership through your identity provider and use SSO. MX validation applies only to email/password signup, not sign-in or email OTP. The `closed` registration modes and the blocked-domain/address controls also cover social accounts. For example, an installation using SSO while allowing existing company email accounts to sign in can set: ```bash ALLOWED_LOGIN_DOMAINS=acme.com -DISABLE_EMAIL_SIGNUP=true +REGISTRATION_MODE=no-email-signup SSO_ENABLED=true -NEXT_PUBLIC_SSO_ENABLED=true ``` This does not restrict enabled social providers to `acme.com`. Configure or disable those login methods separately. @@ -94,17 +115,15 @@ For a standard billing-disabled self-hosted deployment, enable the enterprise su ```bash ENTERPRISE_ENABLED=true -NEXT_PUBLIC_ENTERPRISE_ENABLED=true ``` Or enable SSO alone: ```bash SSO_ENABLED=true -NEXT_PUBLIC_SSO_ENABLED=true ``` -Set both the server flag and its UI counterpart. Register providers under **Settings → Organization → Single sign-on**. A provider can belong to an organization or be registered without one. +Each is a server variable; the login page and settings read the server's setting, so there is no browser counterpart. Register providers under **Settings → Organization → Single sign-on**. A provider can belong to an organization or be registered without one. Most other enterprise features read settings from the organization that owns a workspace. Set `INSTANCE_ORG_NAME` to place new members in one organization, or provision organizations through the Admin API. See [SSO](/platform/enterprise/sso) and [Self-hosted enterprise features](/platform/enterprise/self-hosted) for provider setup, organization patterns, and billing-enabled behavior. diff --git a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx index 277229e234e..e39b0556278 100644 --- a/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx +++ b/apps/docs/content/docs/platform/self-hosting/environment-variables.mdx @@ -174,7 +174,7 @@ See [AWS credentials](/integrations/aws-credentials#self-hosted-deployments) for ## Access control -Who may sign up and sign in — the allowlists, blocklists, `DISABLE_REGISTRATION`, `DISABLE_INVITATIONS`, `DISABLE_PUBLIC_API`, and `DISABLE_AUTH` — is documented in [Authentication](/platform/self-hosting/authentication). +Who may sign up and sign in — the allowlists, blocklists, `REGISTRATION_MODE`, `DISABLE_INVITATIONS`, `DISABLE_PUBLIC_API`, and `DISABLE_AUTH` — is documented in [Authentication](/platform/self-hosting/authentication). ## Code execution @@ -187,7 +187,7 @@ Who may sign up and sign in — the allowlists, blocklists, `DISABLE_REGISTRATIO | `E2B_FUNCTION_TEMPLATE_GENERATION` | Monotonic release generation printed by the same build. Required for E2B | | `DAYTONA_FUNCTION_SNAPSHOT_ID` | Immutable snapshot **ID** (not a name) for the Function base image. Required for Daytona | | `E2B_PI_TEMPLATE_ID` / `DAYTONA_PI_SNAPSHOT_ID` | The image Pi runs on. Separate from the Function base — configuring the provider and Function image alone leaves Pi failing closed | -| `SANDBOXES_ENABLED` / `NEXT_PUBLIC_SANDBOXES_ENABLED` | Enable custom sandbox entitlement through deployment configuration where supported; see the [enterprise guide](/platform/enterprise/self-hosted) for billing-mode requirements. Neither is sufficient on its own — a provider key **and** an immutable Function base must also be configured. Set the `NEXT_PUBLIC_` twin only after the server side works; it enables nothing by itself — it reveals the Function block's Sandbox selector, and on a Compose install or source checkout `bunx sim-setup doctor` confirms it agrees with the selected provider's readiness | +| `SANDBOXES_ENABLED` | Enable custom sandbox entitlement through deployment configuration where supported; see the [enterprise guide](/platform/enterprise/self-hosted) for billing-mode requirements. Not sufficient on its own — a provider key **and** an immutable Function base must also be configured. The Function block's Sandbox selector appears once the server confirms both | | `IVM_MAX_EXECUTIONS_PER_WORKER` | Executions before an isolated-vm worker is recycled | | `IVM_MAX_BROKERS_PER_EXECUTION` | Host-call brokers per execution | | `IVM_MAX_BROKER_ARGS_JSON_CHARS` | Max argument payload size | @@ -216,10 +216,10 @@ On standard billing-disabled self-hosted deployments, configuration enables ente | Variable | Description | |----------|-------------| -| `ENTERPRISE_ENABLED`, `NEXT_PUBLIC_ENTERPRISE_ENABLED` | Enable the whole enterprise feature set | -| `SSO_ENABLED`, `NEXT_PUBLIC_SSO_ENABLED` | Enable SAML and OIDC single sign-on on its own. See [Authentication](/platform/self-hosting/authentication#sso-saml-and-oidc) | +| `ENTERPRISE_ENABLED` | Enable the whole enterprise feature set. Each feature is one server variable; the browser reads the server's settings, so no `NEXT_PUBLIC_` counterpart is needed | +| `SSO_ENABLED` | Enable SAML and OIDC single sign-on on its own. See [Authentication](/platform/self-hosting/authentication#sso-saml-and-oidc) | | `SSO_SKIP_DOMAIN_VERIFICATION` | Skip the DNS challenge when an administrator clicks Verify on a domain. Off by default; self-hosted only. Trusts administrator claims for SSO and SCIM across the instance. See [Verified domains](/platform/enterprise/verified-domains#skip-dns-verification) | -| `SCIM_ENABLED`, `NEXT_PUBLIC_SCIM_ENABLED` | Enable directory provisioning on its own. Needs SSO. See [Directory provisioning](/platform/enterprise/scim) | +| `SCIM_ENABLED` | Enable directory provisioning on its own. Needs SSO. See [Directory provisioning](/platform/enterprise/scim) | | `INSTANCE_ORG_NAME` | Name of the organization every user joins automatically at signup | | `INSTANCE_ORG_SLUG` | Slug for that organization (derived from the name when omitted) | | `INSTANCE_ORG_OWNER_EMAIL` | Owner of that organization (defaults to the first user to sign up) | diff --git a/apps/docs/content/docs/platform/self-hosting/index.mdx b/apps/docs/content/docs/platform/self-hosting/index.mdx index f5bb49c276a..a997df1561f 100644 --- a/apps/docs/content/docs/platform/self-hosting/index.mdx +++ b/apps/docs/content/docs/platform/self-hosting/index.mdx @@ -75,7 +75,6 @@ In a standard billing-disabled self-hosted deployment, enterprise features are e ```bash ENTERPRISE_ENABLED=true -NEXT_PUBLIC_ENTERPRISE_ENABLED=true ``` Organizations, SSO, permission groups, audit logs, session policies, retention, and data drains also need their feature-specific configuration. Most read settings from the organization that owns a workspace. Enabling the suite can enable retention processing; review the configured policy before turning it on. diff --git a/apps/docs/content/docs/platform/self-hosting/sandboxes.mdx b/apps/docs/content/docs/platform/self-hosting/sandboxes.mdx index 6195a0e664b..763d5869541 100644 --- a/apps/docs/content/docs/platform/self-hosting/sandboxes.mdx +++ b/apps/docs/content/docs/platform/self-hosting/sandboxes.mdx @@ -111,11 +111,8 @@ DAYTONA_FUNCTION_SNAPSHOT_ID= | Variable | Effect | |---|---| | `SANDBOXES_ENABLED=true` | Grants the server-side sandbox entitlement on a billing-disabled self-hosted deployment | -| `NEXT_PUBLIC_SANDBOXES_ENABLED=true` | Reveals the Function block's **Sandbox** selector; asserts readiness rather than checking it | -On a billing-disabled deployment, `ENTERPRISE_ENABLED=true` also grants the entitlement when `SANDBOXES_ENABLED` is unset. The server must verify provider credentials and the immutable Function base before offering Shell and the sandbox list. **Settings → Sandboxes** remains in the sidebar but shows an upgrade notice until access/readiness resolves. Python remains selectable; execution still requires the remote configuration. - -Set the browser flag only after provider verification succeeds. On Compose or a source checkout, `bunx sim-setup doctor` compares the public flag with selected-provider readiness. +On a billing-disabled deployment, `ENTERPRISE_ENABLED=true` also grants the entitlement when `SANDBOXES_ENABLED` is unset. The server must verify provider credentials and the immutable Function base before offering Shell, the Function block's **Sandbox** selector, and the sandbox list. **Settings → Sandboxes** remains in the sidebar but shows an upgrade notice until access/readiness resolves. Python remains selectable; execution still requires the remote configuration. ## Promote or roll back a build diff --git a/apps/docs/content/docs/platform/self-hosting/security.mdx b/apps/docs/content/docs/platform/self-hosting/security.mdx index 5cfb65dc7a5..c0142d72341 100644 --- a/apps/docs/content/docs/platform/self-hosting/security.mdx +++ b/apps/docs/content/docs/platform/self-hosting/security.mdx @@ -15,7 +15,7 @@ Review access, secrets, networking, and code execution before exposing a self-ho - TLS terminating at the ingress; HTTP redirected or disabled - `NEXT_PUBLIC_APP_URL` and `BETTER_AUTH_URL` set to the real public origin - `AUTH_TRUSTED_PROXIES` set if behind a load balancer -- Signup restricted (`DISABLE_REGISTRATION` or `ALLOWED_LOGIN_DOMAINS`) +- Signup restricted (`REGISTRATION_MODE=closed` or `ALLOWED_LOGIN_DOMAINS`) - `DISABLE_AUTH` **not** set - NetworkPolicy enabled and `ingressFrom` scoped to the ingress controller - Namespace labelled `pod-security.kubernetes.io/enforce=restricted`, with the GPU device-plugin exception reviewed if GPU Ollama is enabled @@ -197,14 +197,13 @@ continues to run in the local isolate when no remote provider is configured. Without valid provider credentials and the required Function image, code that needs a remote sandbox fails with a configuration error. Verify readiness before enabling its browser controls. -Two browser-side variables assert readiness in the UI; neither is derived automatically: +The Function block's Sandbox selector, Shell, and **Settings → Sandboxes** follow the server's own readiness check; no browser variable is involved. One browser-side variable relates to sandbox readiness and is not derived automatically: | Variable | Effect when unset | |---|---| -| `NEXT_PUBLIC_SANDBOXES_ENABLED` | The Function block's Sandbox selector stays hidden, even with a working provider. Shell and **Settings → Sandboxes** are unaffected — Shell appears, and the settings page swaps its upgrade notice for the sandbox list, from the server's own readiness check. Python stays selectable; whether it runs depends on the server-side provider and Function image, not on this flag | | `NEXT_PUBLIC_E2B_ENABLED` | The E2B-backed Pi block modes stay hidden; `sim-setup doctor` reports it as a mismatch against `E2B_ENABLED`. Revealing them is not enough to make them run — Pi executes on its own image, pinned with `E2B_PI_TEMPLATE_ID` or `DAYTONA_PI_SNAPSHOT_ID`, and fails closed without it | -Set the public values only **after** the server-side configuration above is complete — they are assertions about readiness, not switches, and the server-side check has its own conditions beyond them. See [Sandboxes](/platform/self-hosting/sandboxes) for the base-image build and promotion procedure. `bunx sim-setup doctor` reports a mismatch in either direction. +Set it only **after** the server-side configuration above is complete — it is an assertion about readiness, not a switch, and the server-side check has its own conditions beyond it. See [Sandboxes](/platform/self-hosting/sandboxes) for the base-image build and promotion procedure. `bunx sim-setup doctor` reports a mismatch in either direction. With the default local sandbox, treat everyone who can author a workflow as someone running code in your app container's security context. If your Sim instance is open to a wide or partly-trusted audience, use a remote sandbox provider and enable the NetworkPolicy egress restrictions. diff --git a/apps/docs/scripts/fixtures/content-baseline.json b/apps/docs/scripts/fixtures/content-baseline.json index 4382245ee9c..8300736be86 100644 --- a/apps/docs/scripts/fixtures/content-baseline.json +++ b/apps/docs/scripts/fixtures/content-baseline.json @@ -169006,6 +169006,11 @@ "url": "#how-enforcement-applies", "depth": 2 }, + { + "title": "Access requests", + "url": "#access-requests", + "depth": 2 + }, { "title": "Self-hosted setup", "url": "#self-hosted-setup", @@ -169043,16 +169048,16 @@ { "lang": "bash", "meta": null, - "sha256": "5617143714516fb95298c56885f1822df0b37044909b07c3c812a9453349c39d", - "bytes": 67, - "line": 119 + "sha256": "c56f3129cd839eb27b1ea397c70f6ccdf3d56805289ef03af78dd401fae405ad", + "bytes": 27, + "line": 148 }, { "lang": "bash", "meta": null, "sha256": "7dbc4e5846f219188ac4f07044bc836a465a646c9466c447b061944c87b2265a", "bytes": 57, - "line": 128 + "line": 156 } ], "links": [ @@ -169121,28 +169126,28 @@ "meta": null, "sha256": "727ac94bbc5ad1419c00e634b199238498bdc351c3345906cec49e933c34674a", "bytes": 52, - "line": 31 + "line": 35 }, { "lang": "json", "meta": null, "sha256": "286c528b87ebb7414ef307a9b624171e1434caef21bd0fb16305da53a4655580", "bytes": 917, - "line": 52 + "line": 56 }, { "lang": "bash", "meta": null, - "sha256": "84569115924bc5382bd3e4238adbb84120218042ac3d5aff4371da6dc5a1663a", - "bytes": 59, - "line": 114 + "sha256": "935c6db998ffa465e6d82d163730306a7d2abc09fd01e29e315b1a25b82269b7", + "bytes": 23, + "line": 119 }, { "lang": "http", "meta": null, "sha256": "afb3f5993f52bbfcdfe818296007f1bf8e4322c7da3745ce34725044e7a07e3e", "bytes": 57, - "line": 125 + "line": 129 } ], "links": [ @@ -169379,56 +169384,56 @@ "meta": null, "sha256": "a4f9459a582be50cc5977f7af22bd8d37654191db106d7a56ce3108dfbcd0198", "bytes": 65, - "line": 53 + "line": 57 }, { "lang": "json", "meta": null, "sha256": "f23fbb113c65ca47fe59142b56031f2df5ba6acaf18862b5898eea1b37073475", "bytes": 337, - "line": 86 + "line": 90 }, { "lang": "json", "meta": null, "sha256": "33330d4eca75fb65ce662dedd24ef02872aa83c41656bec96165c721edc3c9f2", "bytes": 337, - "line": 111 + "line": 115 }, { "lang": "kusto", "meta": null, "sha256": "5a916f4f17dfcaf41c553fe6f2aa7a659f1e6989a815599b8cccd280d9d3d78c", "bytes": 257, - "line": 133 + "line": 137 }, { "lang": "http", "meta": null, "sha256": "7dbc44e74034de4df3a2d7effe3cfdc961ef4607696864081e496b8c81d9f6b2", "bytes": 369, - "line": 183 + "line": 187 }, { "lang": "bash", "meta": null, - "sha256": "ee4ee953a8b78edde2fb55b4ec6484fd997d105dba40fd22b41e089e5663b638", - "bytes": 61, - "line": 245 + "sha256": "89a6cc0a2f6762092e850616af000eefe136a7d71fd777758a432464ff5ab060", + "bytes": 24, + "line": 249 }, { "lang": "bash", "meta": null, "sha256": "7d97a6b426ef74cb32e0ffa6e79ca0077d52c7310571598a2c5afd90294fdb8c", "bytes": 20, - "line": 254 + "line": 257 }, { "lang": "bash", "meta": null, "sha256": "e73f35ffda5d403666517dc4d44408b5040f356ab99158cf6e7ae5747fc27efd", "bytes": 118, - "line": 260 + "line": 263 } ], "links": [ @@ -169616,23 +169621,23 @@ { "lang": "bash", "meta": null, - "sha256": "fdb1ffde41476ae0be0ef8409dcc90f2aa58e9253154315dbe9d27491cadf172", - "bytes": 67, - "line": 123 + "sha256": "6a7117556efe8695899ff5ffaacc94676f53216c4ec1b35e586d140ca6053ac3", + "bytes": 27, + "line": 129 }, { "lang": "bash", "meta": null, "sha256": "19eee792f1e8f57143bf18a2f727e69d63671c6be54205b712bb8a8248c8571e", "bytes": 110, - "line": 143 + "line": 148 }, { "lang": "bash", "meta": null, "sha256": "9cf21010b26a260c8342dabc0527927ec38f431906aa5980799f5afa564452e2", "bytes": 23, - "line": 155 + "line": 160 } ], "links": [ @@ -169857,9 +169862,9 @@ { "lang": "bash", "meta": null, - "sha256": "adac386435fb082984a333d14d686ae3b4edd64af8ba5b654698b6981f027371", - "bytes": 53, - "line": 185 + "sha256": "05a588925ebb2ef9447128c4292a86a4d165434c5cfdc0bf21802037445e9cdf", + "bytes": 20, + "line": 189 } ], "links": [ @@ -169923,9 +169928,9 @@ { "lang": "bash", "meta": null, - "sha256": "32bb48d9015f1554d2af3251db885990823fe0d84464d6f0e17a40116958e3e5", - "bytes": 59, - "line": 24 + "sha256": "c9ec4341bddca160d4c16be81aa710e6e4265299d72b66529e53d280fef31416", + "bytes": 23, + "line": 27 } ], "links": [ @@ -170449,14 +170454,14 @@ "meta": null, "sha256": "17ecb9dad7049b5e8a2c4016cae739af5a5fc7c5040a99bc456818c4431e54ad", "bytes": 37, - "line": 71 + "line": 75 }, { "lang": null, "meta": null, "sha256": "21bb6a84478ed87ce69c977cd4b280ee85384674b52ba6295ca99ffe121afcde", "bytes": 23, - "line": 92 + "line": 96 } ], "links": [ @@ -170982,128 +170987,128 @@ { "lang": "bash", "meta": null, - "sha256": "32bb48d9015f1554d2af3251db885990823fe0d84464d6f0e17a40116958e3e5", - "bytes": 59, - "line": 14 + "sha256": "c9ec4341bddca160d4c16be81aa710e6e4265299d72b66529e53d280fef31416", + "bytes": 23, + "line": 18 }, { "lang": "bash", "meta": null, - "sha256": "73aeb98d174714dbd916c2ef9cdcf60dfe0388cf3856cb7f5eec1afb58094212", - "bytes": 123, - "line": 23 + "sha256": "e067941a8a2a2408ef0a23e5d8ca2ec2b46dd82d508fa3374ff7f0b8a39fd81f", + "bytes": 49, + "line": 26 }, { "lang": "bash", "meta": null, "sha256": "753fe5f4ad217bb3b925a9f10ee4e42f4564c0d3e73bcb3432ce1d82a3970b9b", "bytes": 28, - "line": 38 + "line": 39 }, { "lang": "bash", "meta": null, "sha256": "ae0c4c7820a9b6044f0ef6ee96417d250427499ee28e9c8a9c31c8f14b3b2b99", "bytes": 66, - "line": 44 + "line": 45 }, { "lang": "bash", "meta": null, "sha256": "0d9609b882a7de9d24dcb82457d7a9e437473f324ff7e6b03504b5da96e9b593", "bytes": 371, - "line": 55 + "line": 56 }, { "lang": "bash", "meta": null, "sha256": "7d97a6b426ef74cb32e0ffa6e79ca0077d52c7310571598a2c5afd90294fdb8c", "bytes": 20, - "line": 77 + "line": 78 }, { "lang": "bash", "meta": null, "sha256": "35a659600f625998825880b9ef2c61f31643794f162cea93ac0a452a44afd4e3", "bytes": 60, - "line": 83 + "line": 84 }, { "lang": "bash", "meta": null, "sha256": "6c2185082640d0b65536a365814c76fa8e8912f6a73f69c3894edd6062a167c3", "bytes": 213, - "line": 95 + "line": 96 }, { "lang": "bash", "meta": null, "sha256": "2e7d79ed3ff649f4d0422cefda572de8d9d32f9ae57a9ea8a1b5744b96f0654b", "bytes": 206, - "line": 108 + "line": 109 }, { "lang": "bash", "meta": null, "sha256": "75e0baef1d56b961ebea2bd2092ec8a88ac77cd715491f4903f90c52609f2a7c", "bytes": 361, - "line": 121 + "line": 122 }, { "lang": "bash", "meta": null, "sha256": "22705f3967073647398ef7d9df7eac3c3c00efee4c0d043cfa9f484750f6af05", "bytes": 179, - "line": 132 + "line": 133 }, { "lang": "bash", "meta": null, "sha256": "61e14846227b90c89e246e23545e0fce1382071604baf8d34a6c77068fb206b4", "bytes": 201, - "line": 153 + "line": 146 }, { "lang": "bash", "meta": null, "sha256": "6c1556584bb4cb1a38846fe3b00649621480b7cfd8c93497550fc0e1bc21f47f", "bytes": 222, - "line": 161 + "line": 154 }, { "lang": "bash", "meta": null, "sha256": "4c0612380e42a29622c0a6035754548d9cab56645bb0e0b9ff5ecbd39a72b76e", "bytes": 495, - "line": 178 + "line": 171 }, { "lang": "bash", "meta": null, "sha256": "a8cbc35ababf53266a5e9923690792611d501e3b6e5499ee897ed004ba2b432a", "bytes": 133, - "line": 200 + "line": 193 }, { "lang": "bash", "meta": null, "sha256": "7d97a6b426ef74cb32e0ffa6e79ca0077d52c7310571598a2c5afd90294fdb8c", "bytes": 20, - "line": 209 + "line": 202 }, { "lang": "bash", "meta": null, "sha256": "17cfc882579b166a330ba3db25658c49df1a0a7da7da42cfa5ffd4b8e6395f9e", "bytes": 89, - "line": 227 + "line": 221 }, { "lang": "sql", "meta": null, "sha256": "02adf60c53b082d7301da96b4dea3399fb5c723b985b00b357bc77a428130494", "bytes": 64, - "line": 283 + "line": 278 } ], "links": [ @@ -171432,63 +171437,63 @@ "meta": null, "sha256": "4e0b3a3b451d1f31f092f80e7be773e4c976e61611c05b9854dacd70768bab1d", "bytes": 57, - "line": 79 + "line": 83 }, { "lang": null, "meta": null, "sha256": "0c9c0b9cfb20afefc05bc2d91827dd039fabf394b31e29ad01927c460dec1e3a", "bytes": 46, - "line": 99 + "line": 103 }, { "lang": null, "meta": null, "sha256": "a651721d57c576204f09f7bafd0269da402cf41d49cc6fede94e0209de7a4371", "bytes": 58, - "line": 110 + "line": 114 }, { "lang": null, "meta": null, "sha256": "f384a777dafb7fb0f77cc8f3aa620c38005e09d9788caeb7e2d083eeefb80bf9", "bytes": 59, - "line": 161 + "line": 165 }, { "lang": null, "meta": null, "sha256": "9f0feb1b6f4817c7cf8b6ad9da89b01a932fb6929b8190024b4866c7a55a22a9", "bytes": 63, - "line": 184 + "line": 188 }, { "lang": "bash", "meta": null, - "sha256": "595f16b051fa3ca256ea924f9eec2016497f66fdd5b89d4a673437b386ea2727", - "bytes": 246, - "line": 276 + "sha256": "188acc605116697130e3f4cc63c6d82b055196cc059bc901e94c3a29be04a2d6", + "bytes": 148, + "line": 280 }, { "lang": "bash", "meta": null, "sha256": "ba17671ce0de9f85e2c4173a6732f71dff0976f27382c920a6e53f5ae569cf99", "bytes": 395, - "line": 305 + "line": 306 }, { "lang": "bash", "meta": null, "sha256": "48048b50229cba29a69fab805d501d38d315fb4c175c815dfa99636e801c5aa1", "bytes": 501, - "line": 322 + "line": 323 }, { "lang": "bash", "meta": null, "sha256": "af141a70a3c0b00b1225e35374930b523a60088a65c95b989306328284f321ca", "bytes": 133, - "line": 344 + "line": 345 } ], "links": [ @@ -171584,9 +171589,9 @@ { "lang": "bash", "meta": null, - "sha256": "7d12eedf709c60767192795dd793d7f4890b6fa1a6d2c8e91e5bd6c0a41b4a1c", - "bytes": 71, - "line": 94 + "sha256": "c24cfc1066656a2c8230b471f2e15df1a113c68fbe88e44075b5da81390ca345", + "bytes": 29, + "line": 98 } ], "links": [ @@ -171703,23 +171708,23 @@ { "lang": "bash", "meta": null, - "sha256": "281bc47e1b9a2a7b09154f95a1d7396e49b55d7248bca3f5473a12307ed971d9", - "bytes": 45, - "line": 38 + "sha256": "9da605beb512cdfd1f2ea43e1e1a3de1a25d6c5d3fdc1100ebaac40fd24e6e4a", + "bytes": 16, + "line": 42 }, { "lang": "bash", "meta": null, "sha256": "a5c143dcad14f0580d836c7417482ea764e987f20b1de0cb856ad935c7c870ce", "bytes": 33, - "line": 61 + "line": 64 }, { "lang": "yaml", "meta": null, "sha256": "b508cd6f363886a8a68f911c5d797a09a1e956632e12638d0010b95d3c0b2a1a", "bytes": 116, - "line": 69 + "line": 72 } ], "links": [ @@ -172128,70 +172133,70 @@ "meta": null, "sha256": "25949435e4669ebe2ccb7d4d4747f5402a3ac5b1231626f5c4984a65c5cd443e", "bytes": 131, - "line": 8 + "line": 12 }, { "lang": "bash", "meta": null, "sha256": "33245f21a0564db26bfcffd7a7638c63153ab286cf295ca2ea415fc1cfb3f5d7", "bytes": 63, - "line": 22 + "line": 26 }, { "lang": "bash", "meta": null, "sha256": "89a849d62d938f0ff55e4937d3bfc694f14b7a3e7501b4e32f761ce7c4eba467", "bytes": 31, - "line": 30 + "line": 34 }, { "lang": "bash", "meta": null, "sha256": "5fc946a14d42f679df7805f3465cb367c354be18afb7f557fb839d37c86339bc", "bytes": 77, - "line": 50 + "line": 54 }, { "lang": "bash", "meta": null, - "sha256": "e7c564ba9dd062044afed2f105ad84eea4edfa126cf43d1c8c37a38b374a2c46", - "bytes": 102, - "line": 78 + "sha256": "341d45806fe1148043272665cf561585b5a3f452082214381a9894da046eca8c", + "bytes": 81, + "line": 104 }, { "lang": "bash", "meta": null, - "sha256": "32bb48d9015f1554d2af3251db885990823fe0d84464d6f0e17a40116958e3e5", - "bytes": 59, - "line": 91 + "sha256": "c9ec4341bddca160d4c16be81aa710e6e4265299d72b66529e53d280fef31416", + "bytes": 23, + "line": 116 }, { "lang": "bash", "meta": null, - "sha256": "281bc47e1b9a2a7b09154f95a1d7396e49b55d7248bca3f5473a12307ed971d9", - "bytes": 45, - "line": 98 + "sha256": "9da605beb512cdfd1f2ea43e1e1a3de1a25d6c5d3fdc1100ebaac40fd24e6e4a", + "bytes": 16, + "line": 122 }, { "lang": "bash", "meta": null, "sha256": "635b47a629b500b1ac5a4917b5f3c7155e18b141924e83680aff17238f2ddce4", "bytes": 43, - "line": 111 + "line": 134 }, { "lang": "bash", "meta": null, "sha256": "ecee104bb06da27ab5c3d4df3b6aecbe68e3336895b338a5cdeee9ef7eb9fbc7", "bytes": 223, - "line": 133 + "line": 156 }, { "lang": "bash", "meta": null, "sha256": "c43d59a719d84bf4958d3c1fbcf1a3709aa110eac45e7a01f55bc9dcba7c3c82", "bytes": 17, - "line": 155 + "line": 178 } ], "links": [ @@ -173390,14 +173395,14 @@ "meta": null, "sha256": "a68c0e57699fd1b6173497de2b48e69da088d4f060252545cc6073e05474d543", "bytes": 14, - "line": 20 + "line": 24 }, { "lang": "bash", "meta": null, - "sha256": "32bb48d9015f1554d2af3251db885990823fe0d84464d6f0e17a40116958e3e5", - "bytes": 59, - "line": 72 + "sha256": "c9ec4341bddca160d4c16be81aa710e6e4265299d72b66529e53d280fef31416", + "bytes": 23, + "line": 76 } ], "links": [ @@ -175393,49 +175398,49 @@ "meta": null, "sha256": "a1502406088f7a5d4e71cb8aef714aea2a5c9b8a12b14f22c4054a12d88fa295", "bytes": 99, - "line": 25 + "line": 29 }, { "lang": "bash", "meta": null, "sha256": "09771c76de7b81039a3624cb4cd1317773c1d0bd72968a569c7f0d4e19c566c0", "bytes": 284, - "line": 35 + "line": 39 }, { "lang": "bash", "meta": null, "sha256": "17668fe8e845dcda79d7e6e82e5b574d9c4b9459f697960e2947194ec8a2da43", "bytes": 177, - "line": 52 + "line": 56 }, { "lang": "bash", "meta": null, "sha256": "8b7e37aa32e0cd6833fbc4266ca8856b1135751c8306cbfa92ce74f8382f6e33", "bytes": 220, - "line": 61 + "line": 65 }, { "lang": "dotenv", "meta": null, "sha256": "be326544996868802899ad53fe8694caaed57d70fdf233338f579bcade002989", "bytes": 152, - "line": 85 + "line": 89 }, { "lang": "dotenv", "meta": null, "sha256": "bdf612edf0d1667645e7464448f7a80f4da3f4d32d48acad25db2e3c6625b2e4", "bytes": 89, - "line": 96 + "line": 100 }, { "lang": "dotenv", "meta": null, "sha256": "0407e2ff602d613878e4df847ab42b4785deaf55451bcdb56ae672edfb44fb22", "bytes": 135, - "line": 128 + "line": 129 } ], "links": [ @@ -175810,35 +175815,35 @@ "meta": null, "sha256": "4fd1ce391cf85e5093c6348b4d57dac12c1302939037c308314bd8e12c260b38", "bytes": 117, - "line": 244 + "line": 243 }, { "lang": "bash", "meta": null, "sha256": "68d150e3ac8a0f2ab0a0a8e7b7f000dd0b4eeb533f074057fc3f0272e314b060", "bytes": 41, - "line": 262 + "line": 261 }, { "lang": "yaml", "meta": null, "sha256": "97a9e97bd237a84b46a8dd55ddde2685442b763d4b00279d9b4d6db05883cfae", "bytes": 110, - "line": 296 + "line": 295 }, { "lang": "yaml", "meta": null, "sha256": "dd2274ef28334de3fd41b204f57e8af3c3fba12c3af4457c44234c72da35b56c", "bytes": 551, - "line": 309 + "line": 308 }, { "lang": "yaml", "meta": null, "sha256": "a6efcc859a8531bfec1e7434aded7fbbacd567afe8875f4bdee025f428f267d2", "bytes": 137, - "line": 353 + "line": 352 } ], "links": [ diff --git a/apps/extension/README.md b/apps/extension/README.md index b5a4621c7d1..9d8be29ab15 100644 --- a/apps/extension/README.md +++ b/apps/extension/README.md @@ -57,7 +57,7 @@ The E2E suite uses real Chromium, the packaged extension, and a disposable HTTP Release verification must additionally exercise typing `go/` in Chrome's real address bar on a clean profile (the e2e proves the visits, not the address bar), the native toolbar and shortcut, Chrome's real grant/revoke prompt, sign-in/SSO and expiry against the running Sim app, side-panel closing/reopening, workspace changes, narrow widths, and the real Mothership streaming response. The fixture suite does not establish those integrations. The design document records launch scope and release criteria. -The authenticated acceptance suite runs against a real local app, Better Auth, and a disposable Postgres database whose name contains `test`. Enable `KNOWLEDGE_MEMBER_ACCESS`, `CREDENTIAL_GROUPS`, `ACCESS_CONTROL_ENABLED`, and `NEXT_PUBLIC_ACCESS_CONTROL_ENABLED` on that app to exercise restricted organization members: +The authenticated acceptance suite runs against a real local app, Better Auth, and a disposable Postgres database whose name contains `test`. Enable `KNOWLEDGE_MEMBER_ACCESS`, `CREDENTIAL_GROUPS`, and `ACCESS_CONTROL_ENABLED` on that app to exercise restricted organization members: ```sh EXTENSION_APP_E2E_BASE_URL=http://127.0.0.1:3007 \ diff --git a/apps/sim/.env.example b/apps/sim/.env.example index 687acd09473..15899f16392 100644 --- a/apps/sim/.env.example +++ b/apps/sim/.env.example @@ -12,6 +12,9 @@ BETTER_AUTH_URL=http://localhost:3000 # Authentication Bypass (Optional - for self-hosted deployments behind private networks) # DISABLE_AUTH=true # Uncomment to bypass authentication entirely. Creates an anonymous session for all requests. +# Registration (Optional) +# REGISTRATION_MODE=open # open (default) | no-email-signup | closed | no-email | closed-no-email. `closed*` stops self-serve signup by any method; `no-email*` also turns off email/password and OTP sign-in for existing accounts. Replaces DISABLE_REGISTRATION, DISABLE_EMAIL_SIGNUP, and EMAIL_PASSWORD_SIGNUP_ENABLED. + # Private-network egress allowlist (Optional - self-hosted only; ignored on Sim Cloud) # EGRESS_ALLOWED_HOSTS=host.docker.internal,*.svc.cluster.local # Uncomment to let outbound requests reach these hosts on a private network. Widens the SSRF boundary; only use on a trusted private network. # EGRESS_ALLOWED_IP_RANGES=10.0.0.0/8 # Same, by CIDR. Cloud metadata endpoints stay blocked regardless, and neither setting is honored for URLs harvested from content or for a proxy. @@ -37,7 +40,6 @@ NEXT_PUBLIC_APP_URL=http://localhost:3000 # Copilot/Mothership code tools use a separate shell image. It is selected only # for those code-tool calls and is never a fallback for Function blocks. # SANDBOXES_ENABLED=true # Enables custom sandboxes for self-hosted workspaces -# NEXT_PUBLIC_SANDBOXES_ENABLED=true # Shows remote Function languages and custom sandbox settings; set only after the provider/base is ready # # E2B (default provider) # After exporting E2B_API_KEY, build with: bun run apps/sim/scripts/build-function-e2b-template.ts @@ -199,25 +201,27 @@ CRON_SECRET=your_cron_secret # Use `openssl rand -hex 32` to generate. Authentic # Enterprise Features (Optional - self-hosted). One switch enables organizations, SSO, # permission groups, audit logs, custom blocks, session policies, data retention, data -# drains, forks, and the inbox. Set both — the server value grants access, the -# NEXT_PUBLIC_ value decides what the settings UI shows. +# drains, forks, and the inbox. Each feature is one server variable: the browser reads +# the server-resolved state, so there are no NEXT_PUBLIC_ twins to set. # Docs: https://docs.sim.ai/platform/enterprise/self-hosted # ENTERPRISE_ENABLED=true -# NEXT_PUBLIC_ENTERPRISE_ENABLED=true # Per-feature overrides. An explicitly set flag wins over ENTERPRISE_ENABLED, so use these # to enable one feature on its own or to switch a single feature back off. -# ACCESS_CONTROL_ENABLED= / NEXT_PUBLIC_ACCESS_CONTROL_ENABLED= # Permission groups -# SSO_ENABLED= / NEXT_PUBLIC_SSO_ENABLED= # SAML and OIDC sign-in -# AUDIT_LOGS_ENABLED= / NEXT_PUBLIC_AUDIT_LOGS_ENABLED= # Audit logging -# CUSTOM_BLOCKS_ENABLED= / NEXT_PUBLIC_CUSTOM_BLOCKS_ENABLED= # Reusable org-wide blocks -# SESSION_POLICIES_ENABLED= / NEXT_PUBLIC_SESSION_POLICIES_ENABLED= -# DATA_RETENTION_ENABLED= / NEXT_PUBLIC_DATA_RETENTION_ENABLED= # Runs retention deletion — off by default -# DATA_DRAINS_ENABLED= / NEXT_PUBLIC_DATA_DRAINS_ENABLED= # Export streams -# FORKING_ENABLED= # Workspace forks -# CREDENTIAL_GROUPS= # Enterprise managed OAuth collections -# KNOWLEDGE_MEMBER_ACCESS= # Per-member knowledge connectors and hybrid-by-default retrieval -# ORGANIZATIONS_ENABLED= / NEXT_PUBLIC_ORGANIZATIONS_ENABLED= # Organizations only +# ACCESS_CONTROL_ENABLED= # Permission groups (implies organizations) +# SSO_ENABLED= # SAML and OIDC sign-in +# SCIM_ENABLED= # Directory provisioning (needs SSO) +# AUDIT_LOGS_ENABLED= # Audit logging +# CUSTOM_BLOCKS_ENABLED= # Reusable org-wide blocks +# SESSION_POLICIES_ENABLED= # On by default without billing +# INBOX_ENABLED= # Sim Mailer; on by default without billing +# DATA_RETENTION_ENABLED= # Runs retention deletion — off by default +# DATA_DRAINS_ENABLED= # Export streams +# USAGE_MONITORING_ENABLED= # Org-wide credit usage +# FORKING_ENABLED= # Workspace forks +# CREDENTIAL_GROUPS= # Enterprise managed OAuth collections +# KNOWLEDGE_MEMBER_ACCESS= # Per-member knowledge connectors and hybrid-by-default retrieval +# ORGANIZATIONS_ENABLED= # Organizations only # SSO domain verification (Optional - self-hosted, off by default). Trust every organization # owner and admin to claim email domains without DNS proof. Add a domain and click Verify. diff --git a/apps/sim/app/(auth)/layout.tsx b/apps/sim/app/(auth)/layout.tsx index 5afc2e400a2..1683ac85994 100644 --- a/apps/sim/app/(auth)/layout.tsx +++ b/apps/sim/app/(auth)/layout.tsx @@ -1,5 +1,5 @@ import type { Metadata } from 'next' -import { isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { isSelfServeRegistrationClosed } from '@/lib/core/config/env-flags' import { AttributionCapture } from '@/app/_shell/consent/attribution-capture' import { AuthShell } from '@/app/(auth)/components' @@ -9,7 +9,7 @@ export const metadata: Metadata = { export default function AuthLayout({ children }: { children: React.ReactNode }) { return ( - + {children} diff --git a/apps/sim/app/(auth)/login/login-form.tsx b/apps/sim/app/(auth)/login/login-form.tsx index b14e3867741..046e2830c73 100644 --- a/apps/sim/app/(auth)/login/login-form.tsx +++ b/apps/sim/app/(auth)/login/login-form.tsx @@ -9,7 +9,6 @@ import { useRouter, useSearchParams } from 'next/navigation' import { requestJson } from '@/lib/api/client/request' import { forgetPasswordContract } from '@/lib/api/contracts' import { client } from '@/lib/auth/client' -import { getEnv, isFalsy } from '@/lib/core/config/env' import { isSsoEnabled } from '@/lib/core/config/env-flags' import { validateCallbackUrl } from '@/lib/core/security/input-validation' import { getBaseUrl } from '@/lib/core/utils/urls' @@ -79,10 +78,13 @@ export default function LoginPage({ githubAvailable, googleAvailable, microsoftAvailable, + emailPasswordEnabled, }: { githubAvailable: boolean googleAvailable: boolean microsoftAvailable: boolean + /** Whether `REGISTRATION_MODE` leaves email/password and email OTP sign-in on. */ + emailPasswordEnabled: boolean }) { const router = useRouter() const searchParams = useSearchParams() @@ -346,18 +348,17 @@ export default function LoginPage({ } const ssoEnabled = isSsoEnabled - const emailEnabled = !isFalsy(getEnv('NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED')) const hasSocial = githubAvailable || googleAvailable || microsoftAvailable - const hasOnlySSO = ssoEnabled && !emailEnabled && !hasSocial + const hasOnlySSO = ssoEnabled && !emailPasswordEnabled && !hasSocial const showTopSSO = hasOnlySSO const showBottomSection = hasSocial || (ssoEnabled && !hasOnlySSO) - const showDivider = (emailEnabled || showTopSSO) && showBottomSection + const showDivider = (emailPasswordEnabled || showTopSSO) && showBottomSection const emailFieldErrors = showEmailValidationError && emailErrors.length > 0 ? emailErrors : [] const passwordFieldErrors = showValidationError && passwordErrors.length > 0 ? passwordErrors : [] const canSubmit = email.trim().length > 0 && password.length > 0 - if (!emailEnabled && !ssoEnabled && !hasSocial) + if (!emailPasswordEnabled && !ssoEnabled && !hasSocial) return ( )} - {emailEnabled && ( + {emailPasswordEnabled && (
diff --git a/apps/sim/app/(auth)/login/page.tsx b/apps/sim/app/(auth)/login/page.tsx index 4e2223d3af4..e5687891917 100644 --- a/apps/sim/app/(auth)/login/page.tsx +++ b/apps/sim/app/(auth)/login/page.tsx @@ -1,5 +1,6 @@ import { Suspense } from 'react' import type { Metadata } from 'next' +import { isEmailPasswordAuthEnabled } from '@/lib/core/config/env-flags' import { getOAuthProviderStatus } from '@/app/(auth)/components/oauth-provider-checker' import LoginLoading from '@/app/(auth)/login/loading' import LoginForm from '@/app/(auth)/login/login-form' @@ -19,6 +20,7 @@ export default async function LoginPage() { githubAvailable={githubAvailable} googleAvailable={googleAvailable} microsoftAvailable={microsoftAvailable} + emailPasswordEnabled={isEmailPasswordAuthEnabled} /> ) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts index a809d300c6b..8e3068b3131 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.test.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.test.ts @@ -21,7 +21,7 @@ function redirectParts(response: Response): { destination: URL; callback: URL } describe('OAuth login bridge', () => { beforeEach(() => { - setEnvFlags({ isAuthDisabled: false, isRegistrationDisabled: false }) + setEnvFlags({ isAuthDisabled: false, isSelfServeRegistrationClosed: false }) setEnv({ NEXT_PUBLIC_APP_URL: 'https://sim.test' }) }) diff --git a/apps/sim/app/(auth)/oauth/sign-in/route.ts b/apps/sim/app/(auth)/oauth/sign-in/route.ts index ff4b8b582ef..41971c7be68 100644 --- a/apps/sim/app/(auth)/oauth/sign-in/route.ts +++ b/apps/sim/app/(auth)/oauth/sign-in/route.ts @@ -1,5 +1,5 @@ import { type NextRequest, NextResponse } from 'next/server' -import { isAuthDisabled, isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { isAuthDisabled, isSelfServeRegistrationClosed } from '@/lib/core/config/env-flags' import { getBaseUrl } from '@/lib/core/utils/urls' import { withRouteHandler } from '@/lib/core/utils/with-route-handler' import { buildAuthCrossLink } from '@/app/(auth)/auth-redirect' @@ -33,9 +33,9 @@ function consumeInteractivePrompt(params: URLSearchParams): boolean { * client hooks to keep in step. * * Signup rather than login by default, for the same reason the CLI handoff - * chooses it: this is reached from a terminal, often on a fresh install. Under - * DISABLE_REGISTRATION nobody can create an account, so login is the only hop - * that can succeed. + * chooses it: this is reached from a terminal, often on a fresh install. When + * `REGISTRATION_MODE` closes self-serve registration nobody can create an + * account, so login is the only hop that can succeed. */ export const GET = withRouteHandler(async (request: NextRequest) => { /** Avoid sending a newly signed-in user to a disabled provider's JSON 404. */ @@ -49,7 +49,7 @@ export const GET = withRouteHandler(async (request: NextRequest) => { const authorizeUrl = `/api/auth/oauth2/authorize?${params.toString()}` const destination = buildAuthCrossLink( - isRegistrationDisabled || requiresLogin ? '/login' : '/signup', + isSelfServeRegistrationClosed || requiresLogin ? '/login' : '/signup', { callbackUrl: authorizeUrl, isInviteFlow: false, diff --git a/apps/sim/app/(auth)/signup/page.tsx b/apps/sim/app/(auth)/signup/page.tsx index 496f779b7fb..aed7c5093b1 100644 --- a/apps/sim/app/(auth)/signup/page.tsx +++ b/apps/sim/app/(auth)/signup/page.tsx @@ -1,6 +1,6 @@ import type { Metadata } from 'next' import type { SearchParams } from 'nuqs/server' -import { isEmailSignupDisabled, isRegistrationDisabled } from '@/lib/core/config/env-flags' +import { isEmailSignupAllowed, isSelfServeRegistrationClosed } from '@/lib/core/config/env-flags' import { validateCallbackUrl } from '@/lib/core/security/input-validation' import { isEmailVerificationEffectivelyEnabled } from '@/lib/messaging/email/verification' import { resolveAuthRedirect } from '@/app/(auth)/auth-redirect' @@ -20,7 +20,7 @@ export default async function SignupPage({ }: { searchParams: Promise }) { - if (isRegistrationDisabled) { + if (isSelfServeRegistrationClosed) { const { redirect, callbackUrl, inviteFlow } = await signupSearchParamsCache.parse(searchParams) const { rawCallbackUrl, isInviteFlow } = resolveAuthRedirect({ redirect, @@ -43,7 +43,7 @@ export default async function SignupPage({ githubAvailable={githubAvailable} googleAvailable={googleAvailable} microsoftAvailable={microsoftAvailable} - emailSignupEnabled={!isEmailSignupDisabled} + emailSignupEnabled={isEmailSignupAllowed} emailVerificationEnabled={isEmailVerificationEffectivelyEnabled()} /> ) diff --git a/apps/sim/app/(auth)/signup/registration-disabled.tsx b/apps/sim/app/(auth)/signup/registration-disabled.tsx index e9dd550423d..ab1ca1e5a09 100644 --- a/apps/sim/app/(auth)/signup/registration-disabled.tsx +++ b/apps/sim/app/(auth)/signup/registration-disabled.tsx @@ -8,7 +8,8 @@ interface RegistrationDisabledProps { } /** - * The signup page under DISABLE_REGISTRATION. Visitors reach it from a stale + * The signup page when `REGISTRATION_MODE` closes self-serve registration + * (`closed` or `closed-no-email`). Visitors reach it from a stale * link, a bookmark, or an invitation, so it wears the same shell as the form it * replaces and carries the post-auth destination over to login — an invited * visitor who lands here can still sign in and end up back on their invitation diff --git a/apps/sim/app/(auth)/signup/signup-form.tsx b/apps/sim/app/(auth)/signup/signup-form.tsx index d74c61ddb88..25cd401aa83 100644 --- a/apps/sim/app/(auth)/signup/signup-form.tsx +++ b/apps/sim/app/(auth)/signup/signup-form.tsx @@ -9,7 +9,7 @@ import { trackGoogleEvent } from '@/lib/analytics/google' import { client, useSession } from '@/lib/auth/client' import { DISPOSABLE_EMAIL_ERROR_CODE, DISPOSABLE_EMAIL_MESSAGE } from '@/lib/auth/constants' import { useTrackingConsent } from '@/lib/consent/tracking-consent' -import { getEnv, isFalsy } from '@/lib/core/config/env' +import { getEnv } from '@/lib/core/config/env' import { isSsoEnabled } from '@/lib/core/config/env-flags' import { validateCallbackUrl } from '@/lib/core/security/input-validation' import { quickValidateEmail } from '@/lib/messaging/email/validation' @@ -95,6 +95,7 @@ interface SignupFormProps { githubAvailable: boolean googleAvailable: boolean microsoftAvailable: boolean + /** Whether `REGISTRATION_MODE` lets new accounts sign up with email/password or email OTP. */ emailSignupEnabled: boolean /** Server-derived: verification is enabled AND a mail provider is configured. */ emailVerificationEnabled: boolean @@ -387,12 +388,10 @@ function SignupFormContent({ } const ssoEnabled = isSsoEnabled - const emailEnabled = - !isFalsy(getEnv('NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED')) && emailSignupEnabled const hasSocial = githubAvailable || googleAvailable || microsoftAvailable - const hasOnlySSO = ssoEnabled && !emailEnabled && !hasSocial + const hasOnlySSO = ssoEnabled && !emailSignupEnabled && !hasSocial const showBottomSection = hasSocial || (ssoEnabled && !hasOnlySSO) - const showDivider = (emailEnabled || hasOnlySSO) && showBottomSection + const showDivider = (emailSignupEnabled || hasOnlySSO) && showBottomSection const nameFieldErrors = showNameValidationError && nameErrors.length > 0 ? nameErrors : [] const emailHasError = Boolean(emailError) || (showEmailValidationError && emailErrors.length > 0) @@ -409,7 +408,7 @@ function SignupFormContent({
- {!emailEnabled && !hasSocial && !ssoEnabled && ( + {!emailSignupEnabled && !hasSocial && !ssoEnabled && ( No sign-in methods are enabled. Contact your administrator for access. @@ -419,7 +418,7 @@ function SignupFormContent({ )} - {emailEnabled && ( + {emailSignupEnabled && (
diff --git a/apps/sim/app/(auth)/sso/page.tsx b/apps/sim/app/(auth)/sso/page.tsx index d84b8d67834..5181fc6e970 100644 --- a/apps/sim/app/(auth)/sso/page.tsx +++ b/apps/sim/app/(auth)/sso/page.tsx @@ -1,7 +1,11 @@ import { Suspense } from 'react' import type { Metadata } from 'next' import { redirect } from 'next/navigation' -import { isRegistrationDisabled, isSsoEnabled } from '@/lib/core/config/env-flags' +import { + isEmailPasswordAuthEnabled, + isSelfServeRegistrationClosed, + isSsoEnabled, +} from '@/lib/core/config/env-flags' import SSOLoading from '@/app/(auth)/sso/loading' import SSOForm from '@/ee/sso/components/sso-form' @@ -18,7 +22,10 @@ export default async function SSOPage() { return ( }> - + ) } diff --git a/apps/sim/app/(landing)/components/auth-modal/auth-modal.tsx b/apps/sim/app/(landing)/components/auth-modal/auth-modal.tsx index 371865563bf..a0d865c921e 100644 --- a/apps/sim/app/(landing)/components/auth-modal/auth-modal.tsx +++ b/apps/sim/app/(landing)/components/auth-modal/auth-modal.tsx @@ -1,6 +1,7 @@ 'use client' import { useEffect, useRef, useState } from 'react' +import { getRegistrationPolicy } from '@sim/deployment-config/registration' import { cn, Loader, @@ -19,8 +20,7 @@ import { GithubIcon, GoogleIcon, MicrosoftIcon } from '@/components/icons' import { requestJson } from '@/lib/api/client/request' import { type AuthProviderStatusResponse, getAuthProvidersContract } from '@/lib/api/contracts/auth' import { type SocialSignInProvider, startSocialSignIn } from '@/lib/auth/social-sign-in' -import { getEnv, isFalsy } from '@/lib/core/config/env' -import { isSsoEnabled } from '@/lib/core/config/env-flags' +import { useDeploymentShape } from '@/lib/core/config/deployment-shape' import { APP_ENTRY_PATH } from '@/lib/navigation/paths' import { captureClientEvent } from '@/lib/posthog/client' import type { PostHogEventMap } from '@/lib/posthog/events' @@ -36,15 +36,15 @@ interface AuthModalProps { source: PostHogEventMap['auth_modal_opened']['source'] } -type ProviderStatus = AuthProviderStatusResponse +/** Registration comes from the deployment shape; the response's `registrationDisabled` is for older clients. */ +type ProviderStatus = Omit -let fetchPromise: Promise | null = null +let fetchPromise: Promise | null = null const FALLBACK_STATUS: ProviderStatus = { githubAvailable: false, googleAvailable: false, microsoftAvailable: false, - registrationDisabled: false, } const SOCIAL_BTN = @@ -60,11 +60,10 @@ function focusAuthDialog(event: Event): void { function fetchProviderStatus(): Promise { if (fetchPromise) return fetchPromise fetchPromise = requestJson(getAuthProvidersContract, {}) - .then(({ githubAvailable, googleAvailable, microsoftAvailable, registrationDisabled }) => ({ + .then(({ githubAvailable, googleAvailable, microsoftAvailable }) => ({ githubAvailable, googleAvailable, microsoftAvailable, - registrationDisabled, })) .catch(() => { fetchPromise = null @@ -84,15 +83,20 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal fetchProviderStatus().then(setProviderStatus) }, []) - const ssoEnabled = isSsoEnabled - const emailEnabled = !isFalsy(getEnv('NEXT_PUBLIC_EMAIL_PASSWORD_SIGNUP_ENABLED')) + const shape = useDeploymentShape() + const ssoEnabled = shape.features.sso + const { + selfServeRegistrationClosed: registrationDisabled, + emailSignupAllowed, + emailPasswordAuthEnabled, + } = getRegistrationPolicy(shape.registrationMode ?? 'open') /** * Signup is unavailable when registration is disabled, so the shown view is * clamped to login rather than mirrored into state through an effect. */ - const effectiveView: AuthView = - view === 'signup' && providerStatus?.registrationDisabled ? 'login' : view + const effectiveView: AuthView = view === 'signup' && registrationDisabled ? 'login' : view + const emailEnabled = effectiveView === 'signup' ? emailSignupAllowed : emailPasswordAuthEnabled /** * Tracks whether the visitor still wants the modal open. Cleared on dismiss so a @@ -107,11 +111,11 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal if (!hasModalContent) { /** Close the loader (no-op if never opened) and route out; disabled registration sends signup to login. */ setOpen(false) - router.push(status.registrationDisabled || defaultView === 'login' ? '/login' : '/signup') + router.push(registrationDisabled || defaultView === 'login' ? '/login' : '/signup') return } const initialView: AuthView = - defaultView === 'signup' && status.registrationDisabled ? 'login' : defaultView + defaultView === 'signup' && registrationDisabled ? 'login' : defaultView setOpen(true) setView(initialView) captureClientEvent('auth_modal_opened', { view: initialView, source }) @@ -290,7 +294,7 @@ export function AuthModal({ children, defaultView = 'login', source }: AuthModal ? "Don't have an account? " : 'Already have an account? '} - {effectiveView === 'login' && providerStatus.registrationDisabled ? ( + {effectiveView === 'login' && registrationDisabled ? ( Registration is disabled ) : (