Skip to content

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

misc: remove encrypted data key from org response

Sheen Capadnganb99b98b6a44c
diff --git a/backend/src/server/routes/v1/organization-router.ts b/backend/src/server/routes/v1/organization-router.ts
index 1327faeb1e..1048980992 100644
--- a/backend/src/server/routes/v1/organization-router.ts
+++ b/backend/src/server/routes/v1/organization-router.ts
@@ -16,6 +16,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { slugSchema } from "@app/server/lib/schemas";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode, MfaMethod } from "@app/services/auth/auth-type";
+import { sanitizedOrganizationSchema } from "@app/services/org/org-schema";
import { integrationAuthPubSchema } from "../sanitizedSchemas";
@@ -29,9 +30,11 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
schema: {
response: {
200: z.object({
- organizations: OrganizationsSchema.extend({
- orgAuthMethod: z.string()
- }).array()
+ organizations: sanitizedOrganizationSchema
+ .extend({
+ orgAuthMethod: z.string()
+ })
+ .array()
})
}
},
diff --git a/backend/src/server/routes/v2/user-router.ts b/backend/src/server/routes/v2/user-router.ts
index a52a45fa9a..851d9c4ff3 100644
--- a/backend/src/server/routes/v2/user-router.ts
+++ b/backend/src/server/routes/v2/user-router.ts
@@ -1,10 +1,11 @@
import { z } from "zod";
-import { AuthTokenSessionsSchema, OrganizationsSchema, UserEncryptionKeysSchema, UsersSchema } from "@app/db/schemas";
+import { AuthTokenSessionsSchema, UserEncryptionKeysSchema, UsersSchema } from "@app/db/schemas";
import { ApiKeysSchema } from "@app/db/schemas/api-keys";
import { authRateLimit, readLimit, writeLimit } from "@app/server/config/rateLimiter";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { AuthMethod, AuthMode, MfaMethod } from "@app/services/auth/auth-type";
+import { sanitizedOrganizationSchema } from "@app/services/org/org-schema";
export const registerUserRouter = async (server: FastifyZodProvider) => {
server.route({
@@ -134,7 +135,7 @@ export const registerUserRouter = async (server: FastifyZodProvider) => {
description: "Return organizations that current user is part of",
response: {
200: z.object({
- organizations: OrganizationsSchema.array()
+ organizations: sanitizedOrganizationSchema.array()
})
}
},
diff --git a/backend/src/services/org/org-schema.ts b/backend/src/services/org/org-schema.ts
new file mode 100644
index 0000000000..8f5b854037
--- /dev/null
+++ b/backend/src/services/org/org-schema.ts
@@ -0,0 +1,16 @@
+import { OrganizationsSchema } from "@app/db/schemas";
+
+export const sanitizedOrganizationSchema = OrganizationsSchema.pick({
+ id: true,
+ name: true,
+ customerId: true,
+ slug: true,
+ createdAt: true,
+ updatedAt: true,
+ authEnforced: true,
+ scimEnabled: true,
+ kmsDefaultKeyId: true,
+ defaultMembershipRole: true,
+ enforceMfa: true,
+ selectedMfaMethod: true
+});