Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(scim): scope group role sync to the group's organization

Vlad Ligaiee6182436711
diff --git a/backend/src/ee/services/scim/scim-service.ts b/backend/src/ee/services/scim/scim-service.ts
index 6d8f37fd5a..87853003fa 100644
--- a/backend/src/ee/services/scim/scim-service.ts
+++ b/backend/src/ee/services/scim/scim-service.ts
@@ -994,11 +994,13 @@ export const scimServiceFactory = ({
// no mapping, user will have default org membership
if (!externalGroupMapping) return;
- // only get org memberships that are new (invites)
+ // only get org memberships that are new (invites), scoped to the group's organization
+ // (consistent with the other membership lookups in this service)
const newOrgMemberships = await membershipUserDAL.find(
{
status: "invited",
scope: AccessScope.Organization,
+ scopeOrgId: group.orgId,
$in: {
id: members.map((member) => member.value)
}