Skip to content

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

fix: handle undefined rules in policy editor

Scott Wilson230cf9b42ca8
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index 6313f521a8..0aad362a23 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -1956,7 +1956,7 @@ export const formRolePermission2API = (formVal: TFormSchema["permissions"]) => {
// other than workspace everything else follows same
// if in future there is a different follow the above on how workspace is done
Object.entries(formVal || {}).forEach(([subject, rules]) => {
- rules.forEach((actions) => {
+ (rules ?? []).forEach((actions) => {
const caslActions = Object.keys(actions).filter(
(el) => actions?.[el as keyof typeof actions] && el !== "conditions" && el !== "inverted"
);