Skip to content

fix(scim): scope the managed-membership lock to workspaces the member's directory groups map - #10381

Merged
waleedlatif1 merged 3 commits into
stagingfrom
fix/scim-lock-scoped-to-mapped-workspaces
Nov 24, 2026
Merged

waleedlatif1 merged 3 commits into
stagingfrom
fix/scim-lock-scoped-to-mapped-workspaces

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Lock managed membership refused every manual workspace grant for directory-provisioned members, including workspaces no group mapping reaches, so they could never be shared into a new workspace. The refusal message also claimed the next sync would grant access, which it never does without a mapping.
  • The lock now owns org membership and org role (unchanged), and workspace access only where one of the member's groups is mapped to that workspace: exactly the grants reconciliation sets and withdraws. Ownership is derived from reconciliation's own loadMappingRows + resolveDesiredGrants (moved loadMappingRows to projection/mapping-rows.ts), so the two can't drift.
  • Same model as IdP-linked teams elsewhere (GitHub team sync, Linear linked teams): the directory owns what's linked; other access is managed in-app.
  • Applied at all three manual workspace-access paths: invitations (up-front check so a multi-workspace invite can't half-apply), direct grants, and the workspace role editor
  • Inviting a provisioned person who isn't an org member is still refused; org-admin promotion through ensure-at-least provisioning is now refused explicitly for provisioned members (the blanket check used to cover it)
  • Accurate refusal messages; setting copy and SCIM docs updated

Type of Change

  • Bug fix

Testing

  • New scim-locked-invitations.integration.ts drives the real v2 invitations route on PostgreSQL: unmapped workspace grants, mapped workspace refuses with no row written, provisioned member outside the mapped group is granted, provisioned non-member is refused with no invitation
  • members.integration.ts: role change allowed on an unmapped workspace, SCIM_MANAGED_MEMBERSHIP kept on a workspace the member's group is mapped to
  • Red→green locally: the pre-fix code fails the unmapped cases; removing each guard (group scoping, non-member invite check, role-change check) turns its test red
  • managed-membership.integration.ts, related unit suites (ee/scim, invitations, permissions route, enterprise provisioning, member manager) and biome on changed files pass; type-check, check:audits and the full suite run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…'s directory groups map

The lock refused every manual workspace grant for directory-provisioned members,
including workspaces no group mapping reaches, so they could never be shared into
new workspaces. It now owns org membership and role, plus workspace access that
reconciliation itself sets through the member's mapped groups, derived from the
same mapping rows and rules.
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 24, 2026 10:27pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 12 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

This PR changes authentication, authorization, or input validation. Ultrareviews find 2.4x more serious bugs than standard reviews. Comment @cubic-dev-ai ultrareview to run one.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

This PR limits directory-owned workspace access to a member’s mapped workspaces and grants still awaiting withdrawal. Other workspaces remain shareable by hand.

  • The directory lock covers only workspace access tied to its group mappings.
  • Manual invites cannot add provisioned people to an organization.

Reviews (3) · Last reviewed commit: "test(scim): cover the mapped-workspace l..." · Reviewed by Greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 13 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 9186be5 into staging Nov 24, 2026
87 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/scim-lock-scoped-to-mapped-workspaces branch November 24, 2026 22:34

This branch was previously deployed

1 inactive deployment
Preview — ec594a7b Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant