Skip to content

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

fix(sub-org): check parent org permissions for update and delete operations

Igor Correa5675f6935448
diff --git a/backend/src/ee/services/sub-org/sub-org-service.ts b/backend/src/ee/services/sub-org/sub-org-service.ts
index d1cabd9c63..bb4f9d7541 100644
--- a/backend/src/ee/services/sub-org/sub-org-service.ts
+++ b/backend/src/ee/services/sub-org/sub-org-service.ts
@@ -136,10 +136,10 @@ export const subOrgServiceFactory = ({
const { permission: orgPermission } = await permissionService.getOrgPermission({
actorId: permission.id,
actor: permission.type,
- orgId: subOrgId,
- actorOrgId: subOrgId,
+ orgId: permission.rootOrgId,
+ actorOrgId: permission.rootOrgId,
actorAuthMethod: permission.authMethod,
- scope: OrganizationActionScope.ChildOrganization
+ scope: OrganizationActionScope.ParentOrganization
});
ForbiddenError.from(orgPermission).throwUnlessCan(
@@ -265,10 +265,10 @@ export const subOrgServiceFactory = ({
const { permission: orgPermission } = await permissionService.getOrgPermission({
actorId: permission.id,
actor: permission.type,
- orgId: subOrgId,
- actorOrgId: subOrgId,
+ orgId: permission.rootOrgId,
+ actorOrgId: permission.rootOrgId,
actorAuthMethod: permission.authMethod,
- scope: OrganizationActionScope.ChildOrganization
+ scope: OrganizationActionScope.ParentOrganization
});
ForbiddenError.from(orgPermission).throwUnlessCan(