Skip to content

Commit 31f7529

Browse files
authored
fix(scim): harden directory lifecycle and clarify group mappings (#9429)
* fix(scim): harden directory lifecycle and clarify group mappings * fix(scim): close provisioning races and refresh policy state
1 parent 77dfe17 commit 31f7529

30 files changed

Lines changed: 1245 additions & 357 deletions

File tree

‎apps/docs/content/docs/platform/enterprise/scim/entra.mdx‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use a non-gallery enterprise application in Microsoft Entra ID to create, update
1111

1212
## Before you start
1313

14-
- Use an Enterprise organization in Sim and an organization owner or admin account.
14+
- On Sim Cloud, use an Enterprise organization. Use an organization owner or admin account to configure provisioning.
1515
- [Verify each provisioned email domain](/platform/enterprise/verified-domains).
1616
- Use an Entra administrator who can create enterprise applications and manage provisioning.
1717
- Make Sim reachable by Entra over HTTPS. Self-hosted deployments must meet the [SCIM rollout requirements](/platform/enterprise/scim#deployment-and-upgrades).
@@ -20,6 +20,8 @@ Automated user provisioning is available with Entra ID Free. Group provisioning
2020

2121
Start with dedicated test accounts. Provisioned members use a seat and receive workspace access through mappings or existing grants.
2222

23+
An existing SAML or OIDC sign-in setup can remain in place. Use the same account email for authentication and provisioning, and review app assignments if they use separate enterprise applications. See [Plan membership and access](/platform/enterprise/scim#plan-membership-and-access) for the distinction between sign-in, organization membership, workspace access, and permission policy.
24+
2325
## Connect Entra to Sim
2426

2527
<Steps>
@@ -101,12 +103,13 @@ Sim deactivation suspends access while retaining membership, ownership, and the
101103

102104
## Provision groups and verify access
103105

104-
With P1 or higher, create a security group with **Assigned** membership and add test accounts as direct members. Assign it under **Users and groups**. Review **Attribute mapping** and keep group provisioning enabled.
106+
With P1 or higher, create a security group with **Assigned** membership and add test accounts as direct members. Assign it under **Users and groups**. Review **Attribute mapping** and keep group provisioning enabled. Create the target workspace and a dedicated permission group in Sim, configuring that policy's restrictions and workspace scope before mapping it.
105107

106108
1. Run **Provision on demand** for one group and select up to five test members, or wait for a scheduled cycle. Nested membership is unsupported; see [Microsoft group assignment](https://learn.microsoft.com/en-us/entra/identity/enterprise-apps/assign-user-or-group-access-portal).
107-
2. Once the group appears under **Single sign-on → Provisioning → Group mappings** in Sim, map it to a workspace, permission group, or organization admin role. Start with a workspace mapping and confirm access.
108-
3. Remove a test member from the group while retaining a separate direct app assignment. After synchronization, confirm the directory workspace grant is withdrawn while the account remains active.
109-
4. Add the member back and verify access returns.
109+
2. Once the group appears under **Single sign-on → Provisioning → Group mappings** in Sim, add a **Workspace** mapping and a **Permission group** mapping to the policy created above. Confirm both workspace access and policy restrictions. A permission-group mapping alone does not grant workspace access; an organization-admin mapping is a separate privilege.
110+
3. For automatic policy matching, enable **Provisioning rules → Manage rules → Match permission groups by name**. Names must match an existing non-default Sim permission group exactly, including case. Select **Reconcile now** for groups already synced. Sim does not create the permission group.
111+
4. Remove a test member from the group while retaining a separate direct app assignment. After synchronization, confirm the directory workspace grant is withdrawn while the account remains active. Check the [fallback policy](/platform/enterprise/scim#how-access-is-withdrawn) on any workspace the person can still access.
112+
5. Add the member back and verify access and restrictions return.
110113

111114
Read [How access is withdrawn](/platform/enterprise/scim#how-access-is-withdrawn) before mapping groups that overlap manual access.
112115

@@ -133,6 +136,8 @@ Issue a replacement token in Sim while the current one remains active. In Entra'
133136
| Disablement or deletion has not reached Sim | Inspect the scheduled log, `IsSoftDeleted` mapping to `active`, enabled **Update** actions, and accidental deletion protection. Confirm **Skip out of scope deletions** is disabled. A connection test does not verify lifecycle changes. |
134137
| Group assignment is unavailable | Check licensing. Free supports individual assignment; group assignment and provisioning require an upgrade. |
135138
| Member has no workspace access | Provision the directory group and add a Sim workspace mapping. User provisioning adds organization membership. |
139+
| Member has access but the expected policy does not apply | Check **Group mappings** for unassigned members. Resolve overlapping membership or workspace scope under **Permission groups**, then select **Reconcile now**. For name matching, also check the exact group name. |
140+
| A removed mapping returns | Turn off name matching or use different names before removing a same-name mapping. See [mapping behavior](/platform/enterprise/scim#map-directory-groups). |
136141
| A disabled member still uses a seat | Deactivation suspends access; organization removal is separate. |
137142

138143
Use Entra's **Provisioning logs** and Sim's **Provisioning → Activity**. Invalid or revoked tokens appear only in Entra because Sim cannot associate them with a connection.

‎apps/docs/content/docs/platform/enterprise/scim/index.mdx‎

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ description: Sync organization members and group-based access from your identity
55

66
import { Callout } from 'fumadocs-ui/components/callout'
77
import { Step, Steps } from 'fumadocs-ui/components/steps'
8+
import { Image } from '@/components/ui/image'
89
import { Tab, Tabs } from '@/components/ui/tabs'
910

1011
Directory provisioning uses SCIM 2.0, a standard protocol for syncing accounts, to create, update, and deactivate organization members from your identity provider. Map directory groups to workspace access, permission groups, or the organization admin role.
@@ -17,19 +18,36 @@ Configure [SSO](/platform/enterprise/sso) separately for authentication. SCIM ca
1718
- [Verify every email domain](/platform/enterprise/verified-domains) you will provision. Sim refuses account creation or an email change to an unverified domain.
1819
- 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).
1920

21+
## Plan membership and access
22+
23+
If your organization already uses SAML or OIDC, keep that sign-in configuration. SCIM adds directory synchronization alongside it. Configure these four controls separately:
24+
25+
| Control | What it decides |
26+
| --- | --- |
27+
| SSO | How a person authenticates. Use the same account email in SSO and provisioning. |
28+
| SCIM user provisioning | Whether the person is an organization member and whether their account is active. |
29+
| Workspace mapping | Which workspace the person can access, at Read, Write, or Admin level. |
30+
| Permission-group mapping | Which models, integrations, and actions the person can use in the permission group's selected workspaces. It does not grant workspace access. |
31+
32+
Create the workspaces and [permission groups](/platform/enterprise/access-control#create-and-configure-a-group) in Sim before mapping directory groups. For example, map a pushed `Finance` group to **Finance workspace → Write** and to a dedicated **Finance policy** permission group scoped to that workspace. These can be two mappings on the same directory group.
33+
34+
Configure a restrictive organization default permission group for people who retain workspace access after leaving a mapped policy group. Sim selects one governing policy per person and workspace; it does not intersect every policy attached to their directory groups. Review [policy selection and conflicts](/platform/enterprise/access-control#general) before rolling out overlapping groups.
35+
2036
## What it does
2137

2238
| Directory request | Sim behavior |
2339
| --- | --- |
2440
| Provision a person | Creates or links an account and adds new organization members as Members. Workspace access requires a mapping or existing grant. |
25-
| Update name or email | Updates the account. An email change ends its sessions. |
41+
| Update name or email | Updates the account. An email change ends its sessions and OAuth grants. |
2642
| Deactivate a person | Suspends sign-in and personal API keys, and blocks scheduled runs or triggers acting as that person. Ownership, credentials, grants, and workspace history are retained. Shared workspace keys keep working. |
2743
| Reactivate a person | Lifts the suspension. Current group memberships and mappings govern directory access. |
28-
| Send SCIM `DELETE` | Removes organization membership, ends sessions, deletes personal API keys, and reassigns owned resources. The Sim account survives. |
44+
| Send SCIM `DELETE` | Removes organization membership, ends sessions and OAuth grants, deletes personal API keys, and reassigns owned resources. The Sim account survives. |
2945
| Add or remove group membership | Applies or withdraws the group's mapped access. |
3046

3147
Deactivation itself does not withdraw grants. Group or mapping changes can still withdraw access and reassign ownership while someone is suspended. A deactivated member keeps their seat until removed from the organization.
3248

49+
Deactivation stops the person's active Chat runs. Reactivation permits new runs; it does not resume runs stopped during suspension.
50+
3351
Deactivation deletes the member's sessions and stops personal API-key authentication when it completes. Organization security-version invalidation reaches cached browser sessions on other application instances within up to 60 seconds.
3452

3553
Sim refuses directory suspension or removal of an organization owner. Transfer ownership in Sim first.
@@ -124,7 +142,7 @@ Select **Test Connection**, enable group management if you will map groups, then
124142

125143
Under **Provisioning → Group mappings**, map each synced group to one or more targets:
126144

127-
- A **Permission group**, which governs models, integrations, and capabilities.
145+
- A **Permission group**, which governs models, integrations, and capabilities in its selected workspaces. Create and configure it in Sim first; this mapping does not grant workspace access.
128146
- A **Workspace**, with **Read**, **Write**, or **Admin** access.
129147
- The **Organization admin** role.
130148

@@ -134,18 +152,28 @@ When multiple groups grant the same workspace at different levels, the strongest
134152
Mapping a permission group permanently switches it to explicit membership: it applies only to its members, and an empty mapped group applies to nobody. A group that previously applied to everyone in its workspaces stops doing so when mapped. Use permission groups created for directory membership rather than existing organization-wide groups.
135153
</Callout>
136154

137-
Under **Provisioning rules → Manage rules**, **Match permission groups by name** maps new or renamed directory groups to existing non-default permission groups with an exact, case-sensitive name match. Sim does not create permission groups. A rename updates automatic mappings and preserves manually added ones.
155+
Under **Provisioning rules → Manage rules**, **Match permission groups by name** maps new or renamed directory groups to existing non-default permission groups with an exact, case-sensitive name match. Sim does not create permission groups. These mappings are labeled **Automatic**. A rename updates automatic mappings and preserves manually added ones.
138156

139157
For groups already synced before enabling name matching, select **Reconcile now** or wait for scheduled reconciliation.
158+
159+
Turning off name matching stops future automatic matching; it does not remove existing mappings. Before removing a mapping whose target still has the same name, turn off **Match permission groups by name** or change the names so they no longer match. Otherwise a later group push or reconciliation can recreate it. A manually added mapping keeps its target when the directory group is renamed.
160+
161+
A person can belong to only one explicit permission group for a given workspace. A conflicting policy assignment can be skipped even when the directory group itself synchronizes successfully. **Group mappings** shows how many directory members are not assigned to each mapped policy. Open **Permission groups**, resolve the overlapping membership or workspace scope, then select **Reconcile now**. Confirm the warning clears and the person's effective restrictions are correct.
162+
163+
<Image src="/static/enterprise/scim-group-mappings.png" alt="Directory group mappings with an automatic permission-group match, workspace access, and a warning for an unassigned policy membership" width={769} height={314} variant="detail" />
140164
</Step>
141165
</Steps>
142166

143167
## How access is withdrawn
144168

145169
Sim tracks grants made through directory mappings. Removing a member from a group or removing its mapping withdraws the tracked access.
146170

171+
Other directory mappings and independent access can still keep the person in a workspace. Removing a permission-group membership changes their governing policy; it does not remove workspace access. Sim then uses another applicable workspace policy, the organization default, or no permission-group restrictions if neither exists. An empty mapped group applies to nobody and never turns into an all-members policy. Verify both workspace access and the fallback policy when testing a removal.
172+
147173
**Lock managed membership** is enabled by default on a new connection. It makes the directory authoritative for provisioned members: Sim refuses manual invitations, workspace grants, workspace role changes, and organization role changes for them. Manual access already held when a mapping begins covering it becomes directory-managed and is withdrawn with that mapping. Administrators can still remove access in an emergency.
148174

175+
The lock does not prevent editing permission-group membership directly in Sim. A manual removal can be restored by reconciliation, and a manual addition to an overlapping policy can block a directory assignment. Manage mapped policy membership through the directory and check **Group mappings** for unassigned members after resolving conflicts.
176+
149177
With locking off, prior manual workspace access is preserved. If a member had manual Read access and a directory mapping raises it to Admin, removing the mapping restores Read. A role manually raised above the directory's level also remains. [Older grants have a baseline limitation](#deployment-and-upgrades).
150178

151179
You can manually invite people the directory does not manage. For managed members with locking on, grant access through directory groups.
@@ -162,12 +190,16 @@ Connection switches, rules, tokens, and mappings save immediately. **Provisionin
162190

163191
**Provisioning → Activity** shows recent authenticated requests, their status, and failure details. A wrong, expired, or revoked token cannot be associated with a connection, so its authentication error appears only in the provider's logs.
164192

165-
**Reconcile now** reapplies group mappings and changed connection rules. For scheduled reconciliation, call `GET /api/cron/scim-reconcile` with the configured `CRON_SECRET`. Helm and production Docker Compose include an hourly schedule when their cron service is configured and running. This endpoint runs directly; it does not require Trigger.dev. See [Background schedules](/platform/enterprise/self-hosted#schedule-the-background-jobs).
193+
**Reconcile now** reapplies stored group memberships, mappings, and changed connection rules. It does not fetch changes from Okta or Entra. If a directory change has not reached Sim, inspect the provider's provisioning job and retry or repush there first.
194+
195+
For scheduled reconciliation, call `GET /api/cron/scim-reconcile` with the configured `CRON_SECRET`. Helm and production Docker Compose include an hourly schedule when their cron service is configured and running. This endpoint runs directly; it does not require Trigger.dev. See [Background schedules](/platform/enterprise/self-hosted#schedule-the-background-jobs).
166196

167197
## Disable provisioning
168198

169199
Turning the connection off stops synchronization; it does not reverse suspension or prior access changes. Deactivated members stay deactivated. To restore an account without the directory, remove it from the organization and invite it again.
170200

201+
While the connection is disabled, **Lock managed membership** and **Disable just-in-time provisioning** no longer apply. Manual membership changes and the SSO provider's first-sign-in setting govern those operations again. Review them before disabling the connection; disabling synchronization is not an offboarding action.
202+
171203
## Deployment and upgrades
172204

173205
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.

0 commit comments

Comments
 (0)