Repository navigation
Require company SSO for every sign-in of a company address - #306
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
widefleet-docs | a4ed65b | Nov 23 2026, 04:12 PM |
tnkuehne
force-pushed
the
company-sso-domain-rule
branch
from
November 23, 2026 09:31
dc1f42f to
354b215
Compare
An organization with company SSO proves its email domains through DNS, but addresses on those domains could still sign in with an email code, Google or Microsoft and reach their other memberships without the company's sign-in. Organizations now own sign-in for their verified domains, like WorkOS domain policies: - organization_settings.domain_sso_required turns on when company SSO is activated and switches off when the connection is removed. The migration copies sso_required, so organizations that already require SSO keep it. Administrators switch it with the Company sign-in page, PUT /api/v1/settings/domain-sso or widefleet settings domain-sso. - Session creation rejects a personal session for such an address with COMPANY_SSO_REQUIRED and the provider ID. Every personal sign-in method passes this check. Company SSO, another organization's SSO and recovery stay available. - Email codes are not sent for these addresses. The sign-in form continues with company SSO instead, as the email field already does. - Google and Microsoft return to the connect page with an encrypted hint, which starts company SSO for the address without showing it in the URL. - A domain can be verified by one organization only, so its addresses have exactly one company sign-in. - Existing sessions and CLI grants remain valid until they end.
- Verification locks each domain inside its transaction and checks other organizations' claims there, so concurrent verifications leave one claim. - The domain rule lookup filters every matching provider by admission, so a shared claim from before exclusive verification still requires company SSO. - Browser writes to the domain rule respect external management; API and CLI writes remain available. - The switch saves changes in order and shows the latest choice, so a slower earlier save cannot overwrite it.
A save whose value matched the latest choice cleared it, so a pending earlier save could still show an older value. Only the latest click's save clears the local choice now.
Addresses on a domain with required company SSO cannot sign in with Google or Microsoft, so those sign-ins can no longer prove the domain. A linked company SSO account of an organization that verified the domain by DNS now proves it as well.
tnkuehne
force-pushed
the
company-sso-domain-rule
branch
from
November 23, 2026 16:15
a4ed65b to
e687348
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An organization with company SSO proves its email domains through DNS. Since #291, its SSO session also reaches the person's other memberships for an address on those domains. The company still did not own sign-in for these addresses:
The resulting personal session reached every membership without passing the company's sign-in. Required SSO protected only the organization itself.
Change
Organizations with active company SSO now own sign-in for their verified domains, as WorkOS domain policies do.
Setting
organization_settings.domain_sso_required(migration0040_domain_sso).sso_required, so organizations that already require SSO keep that requirement for their domains.PUT /api/v1/settings/domain-ssoor withwidefleet settings domain-sso true|false. Turning it on requires active SSO and a verified domain.GET /settingsaddsdomainSsoRequired.Enforcement
COMPANY_SSO_REQUIREDand the provider ID. Every personal sign-in method passes this check. Company SSO, another organization's SSO for a guest, and recovery stay available.send-verification-otpandsign-in/email-otpreturn the same error, so no code is sent. The sign-in form continues with company SSO, as the email field already does.validateUserInforejects the address before any user, account or session is created. The callback returns to/sign-in/connectwitherror=company_sso_requiredand an encrypted, 10-minute hint (symmetricEncodeJWTwith the auth secret). The page decrypts it and starts company SSO with the address as login hint and the originalnext, so OAuth and device continuations survive. A loop guard falls back to a button.UI
Toasterandtoastexport are the same lines as in Save member roles optimistically on selection #288./sign-in/connectgets a Continue with company SSO state.Tests
social-sign-in.test.ts:COMPANY_SSO_REQUIRED.organization-sso.integration.test.ts:organization-settings.integration.test.ts:company-sso-plugin.integration.test.ts:cli.test.ts:settings domain-sso.vitest run: 1255 passed, 667 skipped.RUN_CLI_TESTS=1CLI tests: 60 passed.svelte-check, oxlint and oxfmt on the changed files.cargo fmt --checkandcargo clippy -p platform-cli -D warnings.Visual review
Goal: administrators see which addresses the rule covers and can switch it. A person who picks Google is taken to their company's sign-in.
Checked at 1280 and 390 px in light and dark themes, rendered with the built server and synthetic fixtures. No horizontal overflow, the switch stays aligned with the title at 390 px, and the domain list wraps.
Company sign-in, before → after (1280, light)
Switched off at once (390, dark) and narrow layout (390, light)
Google or Microsoft with a company address: shown only when the automatic start is skipped by the loop guard; otherwise the browser goes straight to company SSO.
Not checked visually: the toast after a failed switch (same component and pattern as #288), and the expired-hint state, which shows the text without the button.
Documentation: #307 (draft until a release includes this change).


Confidence Score: 5/5 
The PR appears safe to merge with #307’s immediate switch handler included.Summary
Requires company SSO when a personal sign-in uses an address on an admitted organization’s verified domains.
Tests and browser checks were not rerun.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A["Email code, Google, or Microsoft"] --> B{"Company SSO required for this domain?"} B -->|No| C["Create personal session"] B -->|Yes| D["Continue with company SSO"] D --> E["Create company session"] F["Other organization SSO or recovery"] --> E G["Other personal sign-in methods"] --> H["Check domain rule before creating session"] H --> BReviews (8) · Last reviewed commit: "Accept company SSO on a verified domain ..." · Reviewed by Greptile