Skip to content

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

feat(rbac): resolved batch bug in permission check

Akhil Mohane8f7b0c18134
diff --git a/backend/src/controllers/v2/secretsController.ts b/backend/src/controllers/v2/secretsController.ts
index 84b3af6815..1088152df5 100644
--- a/backend/src/controllers/v2/secretsController.ts
+++ b/backend/src/controllers/v2/secretsController.ts
@@ -163,19 +163,19 @@ export const batchSecrets = async (req: Request, res: Response) => {
// not using service token using auth
if (!(req.authData.authPayload instanceof ServiceTokenData)) {
const { permission } = await getUserProjectPermissions(req.user._id, workspaceId);
- if (!createSecrets.length)
+ if (createSecrets.length)
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Create,
subject(ProjectPermissionSub.Secrets, { environment, secretPath })
);
- if (!updateSecrets.length)
+ if (updateSecrets.length)
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Edit,
subject(ProjectPermissionSub.Secrets, { environment, secretPath })
);
- if (!deleteSecrets.length)
+ if (deleteSecrets.length)
ForbiddenError.from(permission).throwUnlessCan(
ProjectPermissionActions.Delete,
subject(ProjectPermissionSub.Secrets, { environment, secretPath })
diff --git a/frontend/src/views/DashboardPage/DashboardPage.tsx b/frontend/src/views/DashboardPage/DashboardPage.tsx
index 46cb89835d..5935d088f4 100644
--- a/frontend/src/views/DashboardPage/DashboardPage.tsx
+++ b/frontend/src/views/DashboardPage/DashboardPage.tsx
@@ -333,6 +333,10 @@ export const DashboardPage = () => {
permission.cannot(
ProjectPermissionActions.Edit,
subject(ProjectPermissionSub.Secrets, { environment, secretPath })
+ ) &&
+ permission.cannot(
+ ProjectPermissionActions.Create,
+ subject(ProjectPermissionSub.Secrets, { environment, secretPath })
);
const canDoRollback = !isReadOnly;
diff --git a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx
index 745e988782..c31c6df2e5 100644
--- a/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx
+++ b/frontend/src/views/DashboardPage/components/SecretInputRow/SecretInputRow.tsx
@@ -304,10 +304,6 @@ export const SecretInputRow = memo(
(isOverridden ? isAddOnly : shouldBeBlockedInAddOnly)
}
{...field}
- onChange={(val) => {
- console.log(val);
- field.onChange(val);
- }}
/>
)}
/>