Skip to content

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

feat: resolved deeprollback error

=3c4338869435
diff --git a/backend/src/ee/services/pit/pit-service.ts b/backend/src/ee/services/pit/pit-service.ts
index 0ca81def9e..7db97de9c8 100644
--- a/backend/src/ee/services/pit/pit-service.ts
+++ b/backend/src/ee/services/pit/pit-service.ts
@@ -362,13 +362,32 @@ export const pitServiceFactory = ({
actionProjectType: ActionProjectType.SecretManager
});
- ForbiddenError.from(userPermission).throwUnlessCan(
- ProjectPermissionCommitsActions.PerformRollback,
- subject(ProjectPermissionSub.Commits, {
- environment,
- secretPath: folderWithPath.path
- })
- );
+ if (deepRollback) {
+ ForbiddenError.from(userPermission).throwUnlessCan(
+ ProjectPermissionCommitsActions.PerformRollback,
+ subject(ProjectPermissionSub.Commits, {
+ environment,
+ secretPath: folderWithPath.path
+ })
+ );
+
+ const deeperPath = folderWithPath.path === "/" ? "/**" : `${folderWithPath.path.replace(/\/$/, "")}/**`;
+ ForbiddenError.from(userPermission).throwUnlessCan(
+ ProjectPermissionCommitsActions.PerformRollback,
+ subject(ProjectPermissionSub.Commits, {
+ environment,
+ secretPath: deeperPath
+ })
+ );
+ } else {
+ ForbiddenError.from(userPermission).throwUnlessCan(
+ ProjectPermissionCommitsActions.PerformRollback,
+ subject(ProjectPermissionSub.Commits, {
+ environment,
+ secretPath: folderWithPath.path
+ })
+ );
+ }
const latestCommit = await folderCommitService.getLatestCommit({
folderId,