Skip to content

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

refactor: update SSO validation to apply only for user actors and conditionally render SSO permission row for root organizations

Victor Hugo dos Santos0f3242f7a8fe
diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts
index adafbe62f2..8a71dd5161 100644
--- a/backend/src/ee/services/permission/permission-service.ts
+++ b/backend/src/ee/services/permission/permission-service.ts
@@ -418,13 +418,16 @@ export const permissionServiceFactory = ({
const hasRole = (role: string) =>
permissionData.some((memberships) => memberships.roles.some((el) => role === (el.customRoleSlug || el.role)));
- validateOrgSSO(
- actorAuthMethod,
- permissionData?.[0].orgAuthEnforced,
- Boolean(permissionData?.[0].orgGoogleSsoAuthEnforced),
- Boolean(permissionData?.[0].bypassOrgAuthEnabled),
- hasRole(ProjectMembershipRole.Admin)
- );
+ // SSO enforcement applies only to users
+ if (actor === ActorType.USER) {
+ validateOrgSSO(
+ actorAuthMethod,
+ permissionData?.[0].orgAuthEnforced,
+ Boolean(permissionData?.[0].orgGoogleSsoAuthEnforced),
+ Boolean(permissionData?.[0].bypassOrgAuthEnabled),
+ hasRole(ProjectMembershipRole.Admin)
+ );
+ }
const rules = buildProjectPermissionRules(permissionFromRoles);
const templatedRules = handlebars.compile(JSON.stringify(rules), { data: false });
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/RolePermissionsSection.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/RolePermissionsSection.tsx
index 27c19ffae8..7025ecef3e 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/RolePermissionsSection.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/RolePermissionsSection.tsx
@@ -171,11 +171,13 @@ export const RolePermissionsSection = ({ roleId }: Props) => {
/>
);
})}
- <OrgPermissionSsoRow
- control={control}
- setValue={setValue}
- isEditable={isCustomRole}
- />
+ {isRootOrganization && (
+ <OrgPermissionSsoRow
+ control={control}
+ setValue={setValue}
+ isEditable={isCustomRole}
+ />
+ )}
<OrgPermissionAuditLogsRow
control={control}
setValue={setValue}