Skip to content

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

fix(permission): update error message structure in ForbiddenRequestError for consistency

Victor Hugo dos Santos2c4370c92a1d
diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts
index 2927a30028..109971f6c4 100644
--- a/backend/src/ee/services/permission/permission-service.ts
+++ b/backend/src/ee/services/permission/permission-service.ts
@@ -337,7 +337,7 @@ export const permissionServiceFactory = ({
}
if (projectDetails.orgId !== actorOrgId) {
- throw new ForbiddenRequestError({ name: "This project does not belong to your selected organization." });
+ throw new ForbiddenRequestError({ message: "This project does not belong to your selected organization." });
}
if (actionProjectType !== ActionProjectType.Any && actionProjectType !== projectDetails.type) {
@@ -478,7 +478,7 @@ export const permissionServiceFactory = ({
// Re-validate org and project type on cache hit (actorOrgId is not in cache key)
if (projectDetails.orgId !== actorOrgId) {
- throw new ForbiddenRequestError({ name: "This project does not belong to your selected organization." });
+ throw new ForbiddenRequestError({ message: "This projec t does not belong to your selected organization." });
}
if (actionProjectType !== ActionProjectType.Any && actionProjectType !== projectDetails.type) {
throw new BadRequestError({
diff --git a/backend/src/lib/cache/with-cache.test.ts b/backend/src/lib/cache/with-cache.test.ts
index 211469b92b..6a261912a3 100644
--- a/backend/src/lib/cache/with-cache.test.ts
+++ b/backend/src/lib/cache/with-cache.test.ts
@@ -593,7 +593,7 @@ describe("withCacheFingerprint", () => {
expect(dataFetcher).toHaveBeenCalledOnce();
expect(mockKeyStore.setItemWithExpiry).not.toHaveBeenCalled();
expect(logger.error).toHaveBeenCalledWith(
- expect.objectContaining({ err: expect.any(Error) }) as unknown as Record<string, unknown>,
+ expect.objectContaining({ err: expect.any(Error) as Error }) as unknown as Record<string, unknown>,
expect.stringContaining("fingerprint fetch failed")
);
});