mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
requested changes
This commit is contained in:
@@ -7,7 +7,7 @@ import { daysToMillisecond } from "@app/lib/dates";
|
|||||||
import { removeTrailingSlash } from "@app/lib/fn";
|
import { removeTrailingSlash } from "@app/lib/fn";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { DefaultResponseErrorsSchema, SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
import { SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvider) => {
|
export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -37,7 +37,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.CREATE.path)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.CREATE.path)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
lease: DynamicSecretLeasesSchema,
|
lease: DynamicSecretLeasesSchema,
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema,
|
dynamicSecret: SanitizedDynamicSecretSchema,
|
||||||
@@ -82,7 +81,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
|||||||
isForced: z.boolean().default(false).describe(DYNAMIC_SECRET_LEASES.DELETE.isForced)
|
isForced: z.boolean().default(false).describe(DYNAMIC_SECRET_LEASES.DELETE.isForced)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
lease: DynamicSecretLeasesSchema
|
lease: DynamicSecretLeasesSchema
|
||||||
})
|
})
|
||||||
@@ -136,7 +134,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.RENEW.environmentSlug)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.RENEW.environmentSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
lease: DynamicSecretLeasesSchema
|
lease: DynamicSecretLeasesSchema
|
||||||
})
|
})
|
||||||
@@ -177,7 +174,6 @@ export const registerDynamicSecretLeaseRouter = async (server: FastifyZodProvide
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.GET_BY_LEASEID.environmentSlug)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRET_LEASES.GET_BY_LEASEID.environmentSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
lease: DynamicSecretLeasesSchema.extend({
|
lease: DynamicSecretLeasesSchema.extend({
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema
|
dynamicSecret: SanitizedDynamicSecretSchema
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { daysToMillisecond } from "@app/lib/dates";
|
|||||||
import { removeTrailingSlash } from "@app/lib/fn";
|
import { removeTrailingSlash } from "@app/lib/fn";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { DefaultResponseErrorsSchema, SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
import { SanitizedDynamicSecretSchema } from "@app/server/routes/sanitizedSchemas";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerDynamicSecretRouter = async (server: FastifyZodProvider) => {
|
export const registerDynamicSecretRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -59,7 +59,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema
|
dynamicSecret: SanitizedDynamicSecretSchema
|
||||||
})
|
})
|
||||||
@@ -91,7 +90,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
clientSecret: z.string().min(1).describe("The client secret of the Azure Entra ID App Registration")
|
clientSecret: z.string().min(1).describe("The client secret of the Azure Entra ID App Registration")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z
|
200: z
|
||||||
.object({
|
.object({
|
||||||
name: z.string().min(1).describe("The name of the user"),
|
name: z.string().min(1).describe("The name of the user"),
|
||||||
@@ -157,7 +155,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema
|
dynamicSecret: SanitizedDynamicSecretSchema
|
||||||
})
|
})
|
||||||
@@ -197,7 +194,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
isForced: z.boolean().default(false).describe(DYNAMIC_SECRETS.DELETE.isForced)
|
isForced: z.boolean().default(false).describe(DYNAMIC_SECRETS.DELETE.isForced)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema
|
dynamicSecret: SanitizedDynamicSecretSchema
|
||||||
})
|
})
|
||||||
@@ -233,7 +229,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.GET_BY_NAME.environmentSlug)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.GET_BY_NAME.environmentSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
dynamicSecret: SanitizedDynamicSecretSchema.extend({
|
dynamicSecret: SanitizedDynamicSecretSchema.extend({
|
||||||
inputs: z.unknown()
|
inputs: z.unknown()
|
||||||
@@ -268,7 +263,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST.environmentSlug)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST.environmentSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
dynamicSecrets: SanitizedDynamicSecretSchema.array()
|
dynamicSecrets: SanitizedDynamicSecretSchema.array()
|
||||||
})
|
})
|
||||||
@@ -308,7 +302,6 @@ export const registerDynamicSecretRouter = async (server: FastifyZodProvider) =>
|
|||||||
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST_LEAES_BY_NAME.environmentSlug)
|
environmentSlug: z.string().min(1).describe(DYNAMIC_SECRETS.LIST_LEAES_BY_NAME.environmentSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
leases: DynamicSecretLeasesSchema.array()
|
leases: DynamicSecretLeasesSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import { z } from "zod";
|
|||||||
import { GroupsSchema, OrgMembershipRole, UsersSchema } from "@app/db/schemas";
|
import { GroupsSchema, OrgMembershipRole, UsersSchema } from "@app/db/schemas";
|
||||||
import { GROUPS } from "@app/lib/api-docs";
|
import { GROUPS } from "@app/lib/api-docs";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { DefaultResponseErrorsSchema } from "@app/server/routes/sanitizedSchemas";
|
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -27,7 +26,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(GROUPS.CREATE.role)
|
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(GROUPS.CREATE.role)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: GroupsSchema
|
200: GroupsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -53,7 +51,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
id: z.string().trim().describe(GROUPS.GET_BY_ID.id)
|
id: z.string().trim().describe(GROUPS.GET_BY_ID.id)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: GroupsSchema
|
200: GroupsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -76,7 +73,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
schema: {
|
schema: {
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: GroupsSchema.array()
|
200: GroupsSchema.array()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -116,7 +112,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
})
|
})
|
||||||
.partial(),
|
.partial(),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: GroupsSchema
|
200: GroupsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -143,7 +138,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
id: z.string().trim().describe(GROUPS.DELETE.id)
|
id: z.string().trim().describe(GROUPS.DELETE.id)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: GroupsSchema
|
200: GroupsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -174,7 +168,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
username: z.string().optional().describe(GROUPS.LIST_USERS.username)
|
username: z.string().optional().describe(GROUPS.LIST_USERS.username)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
users: UsersSchema.pick({
|
users: UsersSchema.pick({
|
||||||
email: true,
|
email: true,
|
||||||
@@ -217,7 +210,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
username: z.string().trim().describe(GROUPS.ADD_USER.username)
|
username: z.string().trim().describe(GROUPS.ADD_USER.username)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: UsersSchema.pick({
|
200: UsersSchema.pick({
|
||||||
email: true,
|
email: true,
|
||||||
username: true,
|
username: true,
|
||||||
@@ -251,7 +243,6 @@ export const registerGroupRouter = async (server: FastifyZodProvider) => {
|
|||||||
username: z.string().trim().describe(GROUPS.DELETE_USER.username)
|
username: z.string().trim().describe(GROUPS.DELETE_USER.username)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: UsersSchema.pick({
|
200: UsersSchema.pick({
|
||||||
email: true,
|
email: true,
|
||||||
username: true,
|
username: true,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import { alphaNumericNanoId } from "@app/lib/nanoid";
|
|||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import {
|
import {
|
||||||
DefaultResponseErrorsSchema,
|
|
||||||
ProjectPermissionSchema,
|
ProjectPermissionSchema,
|
||||||
ProjectSpecificPrivilegePermissionSchema,
|
ProjectSpecificPrivilegePermissionSchema,
|
||||||
SanitizedIdentityPrivilegeSchema
|
SanitizedIdentityPrivilegeSchema
|
||||||
@@ -53,7 +52,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
).optional()
|
).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privilege: SanitizedIdentityPrivilegeSchema
|
privilege: SanitizedIdentityPrivilegeSchema
|
||||||
})
|
})
|
||||||
@@ -133,7 +131,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
.describe(IDENTITY_ADDITIONAL_PRIVILEGE.CREATE.temporaryAccessStartTime)
|
.describe(IDENTITY_ADDITIONAL_PRIVILEGE.CREATE.temporaryAccessStartTime)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privilege: SanitizedIdentityPrivilegeSchema
|
privilege: SanitizedIdentityPrivilegeSchema
|
||||||
})
|
})
|
||||||
@@ -218,7 +215,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
.partial()
|
.partial()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privilege: SanitizedIdentityPrivilegeSchema
|
privilege: SanitizedIdentityPrivilegeSchema
|
||||||
})
|
})
|
||||||
@@ -274,7 +270,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.DELETE.projectSlug)
|
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.DELETE.projectSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privilege: SanitizedIdentityPrivilegeSchema
|
privilege: SanitizedIdentityPrivilegeSchema
|
||||||
})
|
})
|
||||||
@@ -316,7 +311,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.GET_BY_SLUG.projectSlug)
|
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.GET_BY_SLUG.projectSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privilege: SanitizedIdentityPrivilegeSchema
|
privilege: SanitizedIdentityPrivilegeSchema
|
||||||
})
|
})
|
||||||
@@ -354,7 +348,6 @@ export const registerIdentityProjectAdditionalPrivilegeRouter = async (server: F
|
|||||||
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.LIST.projectSlug)
|
projectSlug: z.string().min(1).describe(IDENTITY_ADDITIONAL_PRIVILEGE.LIST.projectSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
privileges: SanitizedIdentityPrivilegeSchema.array()
|
privileges: SanitizedIdentityPrivilegeSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,11 +6,7 @@ import { ProjectMembershipRole, ProjectMembershipsSchema, ProjectRolesSchema } f
|
|||||||
import { PROJECT_ROLE } from "@app/lib/api-docs";
|
import { PROJECT_ROLE } from "@app/lib/api-docs";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import {
|
import { ProjectPermissionSchema, SanitizedRoleSchema } from "@app/server/routes/sanitizedSchemas";
|
||||||
DefaultResponseErrorsSchema,
|
|
||||||
ProjectPermissionSchema,
|
|
||||||
SanitizedRoleSchema
|
|
||||||
} from "@app/server/routes/sanitizedSchemas";
|
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -49,7 +45,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.CREATE.permissions)
|
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.CREATE.permissions)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
role: SanitizedRoleSchema
|
role: SanitizedRoleSchema
|
||||||
})
|
})
|
||||||
@@ -110,7 +105,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.UPDATE.permissions).optional()
|
permissions: ProjectPermissionSchema.array().describe(PROJECT_ROLE.UPDATE.permissions).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
role: SanitizedRoleSchema
|
role: SanitizedRoleSchema
|
||||||
})
|
})
|
||||||
@@ -152,7 +146,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
roleId: z.string().trim().describe(PROJECT_ROLE.DELETE.roleId)
|
roleId: z.string().trim().describe(PROJECT_ROLE.DELETE.roleId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
role: SanitizedRoleSchema
|
role: SanitizedRoleSchema
|
||||||
})
|
})
|
||||||
@@ -189,7 +182,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
projectSlug: z.string().trim().describe(PROJECT_ROLE.LIST.projectSlug)
|
projectSlug: z.string().trim().describe(PROJECT_ROLE.LIST.projectSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
roles: ProjectRolesSchema.omit({ permissions: true }).array()
|
roles: ProjectRolesSchema.omit({ permissions: true }).array()
|
||||||
})
|
})
|
||||||
@@ -220,7 +212,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
slug: z.string().trim().describe(PROJECT_ROLE.GET_ROLE_BY_SLUG.roleSlug)
|
slug: z.string().trim().describe(PROJECT_ROLE.GET_ROLE_BY_SLUG.roleSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
role: SanitizedRoleSchema
|
role: SanitizedRoleSchema
|
||||||
})
|
})
|
||||||
@@ -251,7 +242,6 @@ export const registerProjectRoleRouter = async (server: FastifyZodProvider) => {
|
|||||||
projectId: z.string().trim()
|
projectId: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
data: z.object({
|
data: z.object({
|
||||||
membership: ProjectMembershipsSchema.extend({
|
membership: ProjectMembershipsSchema.extend({
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { AUDIT_LOGS, PROJECTS } from "@app/lib/api-docs";
|
|||||||
import { getLastMidnightDateISO, removeTrailingSlash } from "@app/lib/fn";
|
import { getLastMidnightDateISO, removeTrailingSlash } from "@app/lib/fn";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { DefaultResponseErrorsSchema } from "@app/server/routes/sanitizedSchemas";
|
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { KmsType } from "@app/services/kms/kms-types";
|
import { KmsType } from "@app/services/kms/kms-types";
|
||||||
|
|
||||||
@@ -34,7 +33,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
limit: z.coerce.number().default(20).describe(PROJECTS.GET_SNAPSHOTS.limit)
|
limit: z.coerce.number().default(20).describe(PROJECTS.GET_SNAPSHOTS.limit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secretSnapshots: SecretSnapshotsSchema.array()
|
secretSnapshots: SecretSnapshotsSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { SecretSnapshotsSchema, SecretTagsSchema } from "@app/db/schemas";
|
|||||||
import { PROJECTS } from "@app/lib/api-docs";
|
import { PROJECTS } from "@app/lib/api-docs";
|
||||||
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "@app/server/routes/sanitizedSchemas";
|
import { secretRawSchema } from "@app/server/routes/sanitizedSchemas";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerSnapshotRouter = async (server: FastifyZodProvider) => {
|
export const registerSnapshotRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -77,7 +77,6 @@ export const registerSnapshotRouter = async (server: FastifyZodProvider) => {
|
|||||||
secretSnapshotId: z.string().trim().describe(PROJECTS.ROLLBACK_TO_SNAPSHOT.secretSnapshotId)
|
secretSnapshotId: z.string().trim().describe(PROJECTS.ROLLBACK_TO_SNAPSHOT.secretSnapshotId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secretSnapshot: SecretSnapshotsSchema
|
secretSnapshot: SecretSnapshotsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import { TQueueServiceFactory } from "@app/queue";
|
|||||||
import { TSmtpService } from "@app/services/smtp/smtp-service";
|
import { TSmtpService } from "@app/services/smtp/smtp-service";
|
||||||
|
|
||||||
import { globalRateLimiterCfg } from "./config/rateLimiter";
|
import { globalRateLimiterCfg } from "./config/rateLimiter";
|
||||||
|
import { addErrorsToResponseSchemas } from "./plugins/add-errors-to-response-schemas";
|
||||||
import { fastifyErrHandler } from "./plugins/error-handler";
|
import { fastifyErrHandler } from "./plugins/error-handler";
|
||||||
import { registerExternalNextjs } from "./plugins/external-nextjs";
|
import { registerExternalNextjs } from "./plugins/external-nextjs";
|
||||||
import { serializerCompiler, validatorCompiler, ZodTypeProvider } from "./plugins/fastify-zod";
|
import { serializerCompiler, validatorCompiler, ZodTypeProvider } from "./plugins/fastify-zod";
|
||||||
@@ -75,6 +76,8 @@ export const main = async ({ db, smtp, logger, queue, keyStore }: TMain) => {
|
|||||||
credentials: true,
|
credentials: true,
|
||||||
origin: appCfg.SITE_URL || true
|
origin: appCfg.SITE_URL || true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await server.register(addErrorsToResponseSchemas);
|
||||||
// pull ip based on various proxy headers
|
// pull ip based on various proxy headers
|
||||||
await server.register(fastifyIp);
|
await server.register(fastifyIp);
|
||||||
|
|
||||||
|
|||||||
20
backend/src/server/plugins/add-errors-to-response-schemas.ts
Normal file
20
backend/src/server/plugins/add-errors-to-response-schemas.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import fp from "fastify-plugin";
|
||||||
|
|
||||||
|
import { DefaultResponseErrorsSchema } from "../routes/sanitizedSchemas";
|
||||||
|
|
||||||
|
export const addErrorsToResponseSchemas = fp(async (server) => {
|
||||||
|
server.addHook("onRoute", (routeOptions) => {
|
||||||
|
if (routeOptions.schema && routeOptions.schema.response) {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
routeOptions.schema.response = {
|
||||||
|
...DefaultResponseErrorsSchema,
|
||||||
|
...routeOptions.schema.response
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
routeOptions.schema = routeOptions.schema || {};
|
||||||
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
routeOptions.schema.response = { ...DefaultResponseErrorsSchema };
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -51,10 +51,10 @@ export const DefaultResponseErrorsSchema = {
|
|||||||
}),
|
}),
|
||||||
403: z.object({
|
403: z.object({
|
||||||
statusCode: z.literal(403),
|
statusCode: z.literal(403),
|
||||||
message: z.literal(
|
message: z.any(),
|
||||||
`<string>: Contains a human-readable message about what went wrong. 403 errors are forbidden errors, and will occur when attempting to access a resource without the necessary permissions`
|
error: z.literal(
|
||||||
),
|
`<string>: Contains a human-readable error name. The message can be both an object or a string. It will always be a string except if the error is happening due to a request validation error.`
|
||||||
error: z.literal(`<string>: Contains a human-readable error name.`)
|
)
|
||||||
}),
|
}),
|
||||||
500: z.object({
|
500: z.object({
|
||||||
statusCode: z.literal(500),
|
statusCode: z.literal(500),
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import {
|
|||||||
validateCaDateField
|
validateCaDateField
|
||||||
} from "@app/services/certificate-authority/certificate-authority-validators";
|
} from "@app/services/certificate-authority/certificate-authority-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerCaRouter = async (server: FastifyZodProvider) => {
|
export const registerCaRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -65,7 +63,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
ca: CertificateAuthoritiesSchema
|
ca: CertificateAuthoritiesSchema
|
||||||
})
|
})
|
||||||
@@ -111,7 +108,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
ca: CertificateAuthoritiesSchema
|
ca: CertificateAuthoritiesSchema
|
||||||
})
|
})
|
||||||
@@ -159,7 +155,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caCertId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT_BY_ID.caCertId)
|
caCertId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT_BY_ID.caCertId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.instanceof(Buffer)
|
200: z.instanceof(Buffer)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -192,7 +187,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(CERTIFICATE_AUTHORITIES.CREATE.requireTemplateForIssuance)
|
.describe(CERTIFICATE_AUTHORITIES.CREATE.requireTemplateForIssuance)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
ca: CertificateAuthoritiesSchema
|
ca: CertificateAuthoritiesSchema
|
||||||
})
|
})
|
||||||
@@ -240,7 +234,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.DELETE.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.DELETE.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
ca: CertificateAuthoritiesSchema
|
ca: CertificateAuthoritiesSchema
|
||||||
})
|
})
|
||||||
@@ -286,7 +279,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CSR.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CSR.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
csr: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CSR.csr)
|
csr: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CSR.csr)
|
||||||
})
|
})
|
||||||
@@ -336,7 +328,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
notAfter: validateCaDateField.describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.notAfter)
|
notAfter: validateCaDateField.describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.notAfter)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificate),
|
||||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificateChain),
|
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.RENEW_CA_CERT.certificateChain),
|
||||||
@@ -388,7 +379,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.array(
|
200: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.certificate),
|
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CA_CERTS.certificate),
|
||||||
@@ -437,7 +427,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CERT.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificate),
|
certificate: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificate),
|
||||||
certificateChain: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificateChain),
|
certificateChain: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CERT.certificateChain),
|
||||||
@@ -493,7 +482,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
maxPathLength: z.number().min(-1).default(-1).describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.maxPathLength)
|
maxPathLength: z.number().min(-1).default(-1).describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.maxPathLength)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificate),
|
||||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificateChain),
|
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_INTERMEDIATE.certificateChain),
|
||||||
@@ -555,7 +543,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.IMPORT_CERT.certificateChain)
|
certificateChain: z.string().trim().describe(CERTIFICATE_AUTHORITIES.IMPORT_CERT.certificateChain)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string().trim(),
|
message: z.string().trim(),
|
||||||
caId: z.string().trim()
|
caId: z.string().trim()
|
||||||
@@ -629,7 +616,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
||||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||||
@@ -712,7 +698,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
||||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||||
@@ -768,7 +753,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificateTemplates: CertificateTemplatesSchema.array()
|
certificateTemplates: CertificateTemplatesSchema.array()
|
||||||
})
|
})
|
||||||
@@ -814,7 +798,6 @@ export const registerCaRouter = async (server: FastifyZodProvider) => {
|
|||||||
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.caId)
|
caId: z.string().trim().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.caId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.array(
|
200: z.array(
|
||||||
z.object({
|
z.object({
|
||||||
id: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.id),
|
id: z.string().describe(CERTIFICATE_AUTHORITIES.GET_CRLS.id),
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import {
|
|||||||
validateCaDateField
|
validateCaDateField
|
||||||
} from "@app/services/certificate-authority/certificate-authority-validators";
|
} from "@app/services/certificate-authority/certificate-authority-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerCertRouter = async (server: FastifyZodProvider) => {
|
export const registerCertRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -29,7 +27,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
serialNumber: z.string().trim().describe(CERTIFICATES.GET.serialNumber)
|
serialNumber: z.string().trim().describe(CERTIFICATES.GET.serialNumber)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: CertificatesSchema
|
certificate: CertificatesSchema
|
||||||
})
|
})
|
||||||
@@ -121,7 +118,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.certificate),
|
||||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||||
@@ -223,7 +219,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
),
|
),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.SIGN_CERT.certificate),
|
||||||
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
issuingCaCertificate: z.string().trim().describe(CERTIFICATE_AUTHORITIES.ISSUE_CERT.issuingCaCertificate),
|
||||||
@@ -281,7 +276,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
revocationReason: z.nativeEnum(CrlReason).describe(CERTIFICATES.REVOKE.revocationReason)
|
revocationReason: z.nativeEnum(CrlReason).describe(CERTIFICATES.REVOKE.revocationReason)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string().trim(),
|
message: z.string().trim(),
|
||||||
serialNumber: z.string().trim().describe(CERTIFICATES.REVOKE.serialNumberRes),
|
serialNumber: z.string().trim().describe(CERTIFICATES.REVOKE.serialNumberRes),
|
||||||
@@ -333,7 +327,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
serialNumber: z.string().trim().describe(CERTIFICATES.DELETE.serialNumber)
|
serialNumber: z.string().trim().describe(CERTIFICATES.DELETE.serialNumber)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: CertificatesSchema
|
certificate: CertificatesSchema
|
||||||
})
|
})
|
||||||
@@ -380,7 +373,6 @@ export const registerCertRouter = async (server: FastifyZodProvider) => {
|
|||||||
serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumber)
|
serialNumber: z.string().trim().describe(CERTIFICATES.GET_CERT.serialNumber)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificate: z.string().trim().describe(CERTIFICATES.GET_CERT.certificate),
|
certificate: z.string().trim().describe(CERTIFICATES.GET_CERT.certificate),
|
||||||
certificateChain: z.string().trim().describe(CERTIFICATES.GET_CERT.certificateChain),
|
certificateChain: z.string().trim().describe(CERTIFICATES.GET_CERT.certificateChain),
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import { CertExtendedKeyUsage, CertKeyUsage } from "@app/services/certificate/ce
|
|||||||
import { sanitizedCertificateTemplate } from "@app/services/certificate-template/certificate-template-schema";
|
import { sanitizedCertificateTemplate } from "@app/services/certificate-template/certificate-template-schema";
|
||||||
import { validateTemplateRegexField } from "@app/services/certificate-template/certificate-template-validators";
|
import { validateTemplateRegexField } from "@app/services/certificate-template/certificate-template-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
const sanitizedEstConfig = CertificateTemplateEstConfigsSchema.pick({
|
const sanitizedEstConfig = CertificateTemplateEstConfigsSchema.pick({
|
||||||
id: true,
|
id: true,
|
||||||
certificateTemplateId: true,
|
certificateTemplateId: true,
|
||||||
@@ -31,7 +29,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.GET.certificateTemplateId)
|
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.GET.certificateTemplateId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedCertificateTemplate
|
200: sanitizedCertificateTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -93,7 +90,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
.describe(CERTIFICATE_TEMPLATES.CREATE.extendedKeyUsages)
|
.describe(CERTIFICATE_TEMPLATES.CREATE.extendedKeyUsages)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedCertificateTemplate
|
200: sanitizedCertificateTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -159,7 +155,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.UPDATE.certificateTemplateId)
|
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.UPDATE.certificateTemplateId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedCertificateTemplate
|
200: sanitizedCertificateTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -206,7 +201,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.DELETE.certificateTemplateId)
|
certificateTemplateId: z.string().describe(CERTIFICATE_TEMPLATES.DELETE.certificateTemplateId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedCertificateTemplate
|
200: sanitizedCertificateTemplate
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -253,7 +247,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
isEnabled: z.boolean().default(true)
|
isEnabled: z.boolean().default(true)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedEstConfig
|
200: sanitizedEstConfig
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -301,7 +294,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
isEnabled: z.boolean().optional()
|
isEnabled: z.boolean().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedEstConfig
|
200: sanitizedEstConfig
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -344,7 +336,6 @@ export const registerCertificateTemplateRouter = async (server: FastifyZodProvid
|
|||||||
certificateTemplateId: z.string().trim()
|
certificateTemplateId: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: sanitizedEstConfig.extend({
|
200: sanitizedEstConfig.extend({
|
||||||
caChain: z.string()
|
caChain: z.string()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import {
|
|||||||
validatePrincipalArns
|
validatePrincipalArns
|
||||||
} from "@app/services/identity-aws-auth/identity-aws-auth-validators";
|
} from "@app/services/identity-aws-auth/identity-aws-auth-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -30,7 +28,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
|||||||
iamRequestHeaders: z.string().describe(AWS_AUTH.LOGIN.iamRequestHeaders)
|
iamRequestHeaders: z.string().describe(AWS_AUTH.LOGIN.iamRequestHeaders)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -121,7 +118,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
|||||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AWS_AUTH.ATTACH.accessTokenNumUsesLimit)
|
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AWS_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAwsAuth: IdentityAwsAuthsSchema
|
identityAwsAuth: IdentityAwsAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -201,7 +197,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
|||||||
.describe(AWS_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(AWS_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAwsAuth: IdentityAwsAuthsSchema
|
identityAwsAuth: IdentityAwsAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -257,7 +252,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(AWS_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(AWS_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAwsAuth: IdentityAwsAuthsSchema
|
identityAwsAuth: IdentityAwsAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -304,7 +298,6 @@ export const registerIdentityAwsAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(AWS_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(AWS_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAwsAuth: IdentityAwsAuthsSchema
|
identityAwsAuth: IdentityAwsAuthsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||||
import { validateAzureAuthField } from "@app/services/identity-azure-auth/identity-azure-auth-validators";
|
import { validateAzureAuthField } from "@app/services/identity-azure-auth/identity-azure-auth-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
import {} from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -25,7 +25,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
|||||||
jwt: z.string()
|
jwt: z.string()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -111,7 +110,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
|||||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AZURE_AUTH.ATTACH.accessTokenNumUsesLimit)
|
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(AZURE_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAzureAuth: IdentityAzureAuthsSchema
|
identityAzureAuth: IdentityAzureAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -192,7 +190,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
|||||||
.describe(AZURE_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(AZURE_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAzureAuth: IdentityAzureAuthsSchema
|
identityAzureAuth: IdentityAzureAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -247,7 +244,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
|||||||
identityId: z.string().describe(AZURE_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(AZURE_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAzureAuth: IdentityAzureAuthsSchema
|
identityAzureAuth: IdentityAzureAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -295,7 +291,6 @@ export const registerIdentityAzureAuthRouter = async (server: FastifyZodProvider
|
|||||||
identityId: z.string().describe(AZURE_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(AZURE_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityAzureAuth: IdentityAzureAuthsSchema
|
identityAzureAuth: IdentityAzureAuthsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||||
import { validateGcpAuthField } from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";
|
import { validateGcpAuthField } from "@app/services/identity-gcp-auth/identity-gcp-auth-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -25,7 +23,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
|||||||
jwt: z.string()
|
jwt: z.string()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -112,7 +109,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
|||||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(GCP_AUTH.ATTACH.accessTokenNumUsesLimit)
|
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(GCP_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityGcpAuth: IdentityGcpAuthsSchema
|
identityGcpAuth: IdentityGcpAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -194,7 +190,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
|||||||
.describe(GCP_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(GCP_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityGcpAuth: IdentityGcpAuthsSchema
|
identityGcpAuth: IdentityGcpAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -251,7 +246,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(GCP_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(GCP_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityGcpAuth: IdentityGcpAuthsSchema
|
identityGcpAuth: IdentityGcpAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -299,7 +293,6 @@ export const registerIdentityGcpAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(GCP_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(GCP_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityGcpAuth: IdentityGcpAuthsSchema
|
identityGcpAuth: IdentityGcpAuthsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
const IdentityKubernetesAuthResponseSchema = IdentityKubernetesAuthsSchema.omit({
|
const IdentityKubernetesAuthResponseSchema = IdentityKubernetesAuthsSchema.omit({
|
||||||
encryptedCaCert: true,
|
encryptedCaCert: true,
|
||||||
caCertIV: true,
|
caCertIV: true,
|
||||||
@@ -36,7 +34,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
jwt: z.string().trim()
|
jwt: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -132,7 +129,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
.describe(KUBERNETES_AUTH.ATTACH.accessTokenNumUsesLimit)
|
.describe(KUBERNETES_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -226,7 +222,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
.describe(KUBERNETES_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(KUBERNETES_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -282,7 +277,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
identityId: z.string().describe(KUBERNETES_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(KUBERNETES_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -330,7 +324,6 @@ export const registerIdentityKubernetesRouter = async (server: FastifyZodProvide
|
|||||||
identityId: z.string().describe(KUBERNETES_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(KUBERNETES_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.omit({
|
identityKubernetesAuth: IdentityKubernetesAuthResponseSchema.omit({
|
||||||
caCert: true,
|
caCert: true,
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import {
|
|||||||
validateOidcBoundClaimsField
|
validateOidcBoundClaimsField
|
||||||
} from "@app/services/identity-oidc-auth/identity-oidc-auth-validators";
|
} from "@app/services/identity-oidc-auth/identity-oidc-auth-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
const IdentityOidcAuthResponseSchema = IdentityOidcAuthsSchema.omit({
|
const IdentityOidcAuthResponseSchema = IdentityOidcAuthsSchema.omit({
|
||||||
encryptedCaCert: true,
|
encryptedCaCert: true,
|
||||||
caCertIV: true,
|
caCertIV: true,
|
||||||
@@ -36,7 +34,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
jwt: z.string().trim()
|
jwt: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -127,7 +124,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(OIDC_AUTH.ATTACH.accessTokenNumUsesLimit)
|
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(OIDC_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -227,7 +223,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
})
|
})
|
||||||
.partial(),
|
.partial(),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -286,7 +281,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(OIDC_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(OIDC_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityOidcAuth: IdentityOidcAuthResponseSchema
|
identityOidcAuth: IdentityOidcAuthResponseSchema
|
||||||
})
|
})
|
||||||
@@ -334,7 +328,6 @@ export const registerIdentityOidcAuthRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().describe(OIDC_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(OIDC_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityOidcAuth: IdentityOidcAuthResponseSchema.omit({
|
identityOidcAuth: IdentityOidcAuthResponseSchema.omit({
|
||||||
caCert: true
|
caCert: true
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -32,7 +32,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(IDENTITIES.CREATE.role)
|
role: z.string().trim().min(1).default(OrgMembershipRole.NoAccess).describe(IDENTITIES.CREATE.role)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identity: IdentitiesSchema
|
identity: IdentitiesSchema
|
||||||
})
|
})
|
||||||
@@ -97,7 +96,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
role: z.string().trim().min(1).optional().describe(IDENTITIES.UPDATE.role)
|
role: z.string().trim().min(1).optional().describe(IDENTITIES.UPDATE.role)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identity: IdentitiesSchema
|
identity: IdentitiesSchema
|
||||||
})
|
})
|
||||||
@@ -147,7 +145,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
identityId: z.string().describe(IDENTITIES.DELETE.identityId)
|
identityId: z.string().describe(IDENTITIES.DELETE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identity: IdentitiesSchema
|
identity: IdentitiesSchema
|
||||||
})
|
})
|
||||||
@@ -194,7 +191,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
identityId: z.string().describe(IDENTITIES.GET_BY_ID.identityId)
|
identityId: z.string().describe(IDENTITIES.GET_BY_ID.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identity: IdentityOrgMembershipsSchema.extend({
|
identity: IdentityOrgMembershipsSchema.extend({
|
||||||
customRole: OrgRolesSchema.pick({
|
customRole: OrgRolesSchema.pick({
|
||||||
@@ -240,7 +236,6 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
orgId: z.string().describe(IDENTITIES.LIST.orgId)
|
orgId: z.string().describe(IDENTITIES.LIST.orgId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identities: IdentityOrgMembershipsSchema.extend({
|
identities: IdentityOrgMembershipsSchema.extend({
|
||||||
customRole: OrgRolesSchema.pick({
|
customRole: OrgRolesSchema.pick({
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -59,7 +57,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(TOKEN_AUTH.ATTACH.accessTokenNumUsesLimit)
|
accessTokenNumUsesLimit: z.number().int().min(0).default(0).describe(TOKEN_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityTokenAuth: IdentityTokenAuthsSchema
|
identityTokenAuth: IdentityTokenAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -135,7 +132,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
.describe(TOKEN_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(TOKEN_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityTokenAuth: IdentityTokenAuthsSchema
|
identityTokenAuth: IdentityTokenAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -190,7 +186,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
identityId: z.string().describe(TOKEN_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(TOKEN_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityTokenAuth: IdentityTokenAuthsSchema
|
identityTokenAuth: IdentityTokenAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -238,7 +233,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
identityId: z.string().describe(TOKEN_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(TOKEN_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityTokenAuth: IdentityTokenAuthsSchema
|
identityTokenAuth: IdentityTokenAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -289,7 +283,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
name: z.string().optional().describe(TOKEN_AUTH.CREATE_TOKEN.name)
|
name: z.string().optional().describe(TOKEN_AUTH.CREATE_TOKEN.name)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -352,7 +345,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
limit: z.coerce.number().min(1).max(100).default(20).describe(TOKEN_AUTH.GET_TOKENS.limit)
|
limit: z.coerce.number().min(1).max(100).default(20).describe(TOKEN_AUTH.GET_TOKENS.limit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
tokens: IdentityAccessTokensSchema.array()
|
tokens: IdentityAccessTokensSchema.array()
|
||||||
})
|
})
|
||||||
@@ -404,7 +396,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
name: z.string().optional().describe(TOKEN_AUTH.UPDATE_TOKEN.name)
|
name: z.string().optional().describe(TOKEN_AUTH.UPDATE_TOKEN.name)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
token: IdentityAccessTokensSchema
|
token: IdentityAccessTokensSchema
|
||||||
})
|
})
|
||||||
@@ -455,7 +446,6 @@ export const registerIdentityTokenAuthRouter = async (server: FastifyZodProvider
|
|||||||
tokenId: z.string().describe(TOKEN_AUTH.REVOKE_TOKEN.tokenId)
|
tokenId: z.string().describe(TOKEN_AUTH.REVOKE_TOKEN.tokenId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string()
|
message: z.string()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const sanitizedClientSecretSchema = IdentityUaClientSecretsSchema.pick({
|
export const sanitizedClientSecretSchema = IdentityUaClientSecretsSchema.pick({
|
||||||
id: true,
|
id: true,
|
||||||
createdAt: true,
|
createdAt: true,
|
||||||
@@ -37,7 +35,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
clientSecret: z.string().trim().describe(UNIVERSAL_AUTH.LOGIN.clientSecret)
|
clientSecret: z.string().trim().describe(UNIVERSAL_AUTH.LOGIN.clientSecret)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
accessToken: z.string(),
|
accessToken: z.string(),
|
||||||
expiresIn: z.coerce.number(),
|
expiresIn: z.coerce.number(),
|
||||||
@@ -133,7 +130,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(UNIVERSAL_AUTH.ATTACH.accessTokenNumUsesLimit)
|
.describe(UNIVERSAL_AUTH.ATTACH.accessTokenNumUsesLimit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -226,7 +222,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(UNIVERSAL_AUTH.UPDATE.accessTokenMaxTTL)
|
.describe(UNIVERSAL_AUTH.UPDATE.accessTokenMaxTTL)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -280,7 +275,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
identityId: z.string().describe(UNIVERSAL_AUTH.RETRIEVE.identityId)
|
identityId: z.string().describe(UNIVERSAL_AUTH.RETRIEVE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -328,7 +322,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
identityId: z.string().describe(UNIVERSAL_AUTH.REVOKE.identityId)
|
identityId: z.string().describe(UNIVERSAL_AUTH.REVOKE.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityUniversalAuth: IdentityUniversalAuthsSchema
|
identityUniversalAuth: IdentityUniversalAuthsSchema
|
||||||
})
|
})
|
||||||
@@ -381,7 +374,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
ttl: z.number().min(0).max(315360000).default(0).describe(UNIVERSAL_AUTH.CREATE_CLIENT_SECRET.ttl)
|
ttl: z.number().min(0).max(315360000).default(0).describe(UNIVERSAL_AUTH.CREATE_CLIENT_SECRET.ttl)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
clientSecret: z.string(),
|
clientSecret: z.string(),
|
||||||
clientSecretData: sanitizedClientSecretSchema
|
clientSecretData: sanitizedClientSecretSchema
|
||||||
@@ -433,7 +425,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
identityId: z.string().describe(UNIVERSAL_AUTH.LIST_CLIENT_SECRETS.identityId)
|
identityId: z.string().describe(UNIVERSAL_AUTH.LIST_CLIENT_SECRETS.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
clientSecretData: sanitizedClientSecretSchema.array()
|
clientSecretData: sanitizedClientSecretSchema.array()
|
||||||
})
|
})
|
||||||
@@ -483,7 +474,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
clientSecretId: z.string().describe(UNIVERSAL_AUTH.GET_CLIENT_SECRET.clientSecretId)
|
clientSecretId: z.string().describe(UNIVERSAL_AUTH.GET_CLIENT_SECRET.clientSecretId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
clientSecretData: sanitizedClientSecretSchema
|
clientSecretData: sanitizedClientSecretSchema
|
||||||
})
|
})
|
||||||
@@ -534,7 +524,6 @@ export const registerIdentityUaRouter = async (server: FastifyZodProvider) => {
|
|||||||
clientSecretId: z.string().describe(UNIVERSAL_AUTH.REVOKE_CLIENT_SECRET.clientSecretId)
|
clientSecretId: z.string().describe(UNIVERSAL_AUTH.REVOKE_CLIENT_SECRET.clientSecretId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
clientSecretData: sanitizedClientSecretSchema
|
clientSecretData: sanitizedClientSecretSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, integrationAuthPubSchema } from "../sanitizedSchemas";
|
import { integrationAuthPubSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerIntegrationAuthRouter = async (server: FastifyZodProvider) => {
|
export const registerIntegrationAuthRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -64,7 +64,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
|||||||
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.GET.integrationAuthId)
|
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.GET.integrationAuthId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integrationAuth: integrationAuthPubSchema
|
integrationAuth: integrationAuthPubSchema
|
||||||
})
|
})
|
||||||
@@ -101,7 +100,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
|||||||
projectId: z.string().trim().describe(INTEGRATION_AUTH.DELETE.projectId)
|
projectId: z.string().trim().describe(INTEGRATION_AUTH.DELETE.projectId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integrationAuth: integrationAuthPubSchema.array()
|
integrationAuth: integrationAuthPubSchema.array()
|
||||||
})
|
})
|
||||||
@@ -150,7 +148,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
|||||||
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.DELETE_BY_ID.integrationAuthId)
|
integrationAuthId: z.string().trim().describe(INTEGRATION_AUTH.DELETE_BY_ID.integrationAuthId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integrationAuth: integrationAuthPubSchema
|
integrationAuth: integrationAuthPubSchema
|
||||||
})
|
})
|
||||||
@@ -254,7 +251,6 @@ export const registerIntegrationAuthRouter = async (server: FastifyZodProvider)
|
|||||||
refreshToken: z.string().trim().optional().describe(INTEGRATION_AUTH.CREATE_ACCESS_TOKEN.refreshToken)
|
refreshToken: z.string().trim().optional().describe(INTEGRATION_AUTH.CREATE_ACCESS_TOKEN.refreshToken)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integrationAuth: integrationAuthPubSchema
|
integrationAuth: integrationAuthPubSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
import { IntegrationMetadataSchema } from "@app/services/integration/integration-schema";
|
import { IntegrationMetadataSchema } from "@app/services/integration/integration-schema";
|
||||||
import { PostHogEventTypes, TIntegrationCreatedEvent } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes, TIntegrationCreatedEvent } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
import {} from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -51,7 +51,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
|||||||
metadata: IntegrationMetadataSchema.default({})
|
metadata: IntegrationMetadataSchema.default({})
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integration: IntegrationsSchema
|
integration: IntegrationsSchema
|
||||||
})
|
})
|
||||||
@@ -138,7 +137,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
|||||||
metadata: IntegrationMetadataSchema.optional()
|
metadata: IntegrationMetadataSchema.optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integration: IntegrationsSchema
|
integration: IntegrationsSchema
|
||||||
})
|
})
|
||||||
@@ -223,7 +221,6 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
|||||||
.transform((val) => val === "true")
|
.transform((val) => val === "true")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integration: IntegrationsSchema
|
integration: IntegrationsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,8 +18,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -116,7 +114,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
auditLogs: AuditLogsSchema.omit({
|
auditLogs: AuditLogsSchema.omit({
|
||||||
eventMetadata: true,
|
eventMetadata: true,
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -31,7 +29,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(ALERTS.CREATE.emails)
|
.describe(ALERTS.CREATE.emails)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiAlertsSchema
|
200: PkiAlertsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -76,7 +73,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
|||||||
alertId: z.string().trim().describe(ALERTS.GET.alertId)
|
alertId: z.string().trim().describe(ALERTS.GET.alertId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiAlertsSchema
|
200: PkiAlertsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -128,7 +124,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(ALERTS.UPDATE.emails)
|
.describe(ALERTS.UPDATE.emails)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiAlertsSchema
|
200: PkiAlertsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -174,7 +169,6 @@ export const registerPkiAlertRouter = async (server: FastifyZodProvider) => {
|
|||||||
alertId: z.string().trim().describe(ALERTS.DELETE.alertId)
|
alertId: z.string().trim().describe(ALERTS.DELETE.alertId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiAlertsSchema
|
200: PkiAlertsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { PkiItemType } from "@app/services/pki-collection/pki-collection-types";
|
import { PkiItemType } from "@app/services/pki-collection/pki-collection-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerPkiCollectionRouter = async (server: FastifyZodProvider) => {
|
export const registerPkiCollectionRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -26,7 +24,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
description: z.string().trim().default("").describe(PKI_COLLECTIONS.CREATE.description)
|
description: z.string().trim().default("").describe(PKI_COLLECTIONS.CREATE.description)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionsSchema
|
200: PkiCollectionsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -68,7 +65,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
collectionId: z.string().trim().describe(PKI_COLLECTIONS.GET.collectionId)
|
collectionId: z.string().trim().describe(PKI_COLLECTIONS.GET.collectionId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionsSchema
|
200: PkiCollectionsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -113,7 +109,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
description: z.string().trim().optional().describe(PKI_COLLECTIONS.UPDATE.description)
|
description: z.string().trim().optional().describe(PKI_COLLECTIONS.UPDATE.description)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionsSchema
|
200: PkiCollectionsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -156,7 +151,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
collectionId: z.string().trim().describe(PKI_COLLECTIONS.DELETE.collectionId)
|
collectionId: z.string().trim().describe(PKI_COLLECTIONS.DELETE.collectionId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionsSchema
|
200: PkiCollectionsSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -202,7 +196,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
limit: z.coerce.number().min(1).max(100).default(25).describe(PKI_COLLECTIONS.LIST_ITEMS.limit)
|
limit: z.coerce.number().min(1).max(100).default(25).describe(PKI_COLLECTIONS.LIST_ITEMS.limit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
collectionItems: z.array(
|
collectionItems: z.array(
|
||||||
PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||||
@@ -263,7 +256,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||||
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.ADD_ITEM.type),
|
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.ADD_ITEM.type),
|
||||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
itemId: z.string().trim().describe(PKI_COLLECTIONS.ADD_ITEM.itemId)
|
||||||
@@ -312,7 +304,6 @@ export const registerPkiCollectionRouter = async (server: FastifyZodProvider) =>
|
|||||||
collectionItemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.collectionItemId)
|
collectionItemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.collectionItemId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
200: PkiCollectionItemsSchema.omit({ caId: true, certId: true }).extend({
|
||||||
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.DELETE_ITEM.type),
|
type: z.nativeEnum(PkiItemType).describe(PKI_COLLECTIONS.DELETE_ITEM.type),
|
||||||
itemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.itemId)
|
itemId: z.string().trim().describe(PKI_COLLECTIONS.DELETE_ITEM.itemId)
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -87,7 +85,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(ENVIRONMENTS.CREATE.slug)
|
.describe(ENVIRONMENTS.CREATE.slug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
workspace: z.string(),
|
workspace: z.string(),
|
||||||
@@ -155,7 +152,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
|||||||
position: z.number().optional().describe(ENVIRONMENTS.UPDATE.position)
|
position: z.number().optional().describe(ENVIRONMENTS.UPDATE.position)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
workspace: z.string(),
|
workspace: z.string(),
|
||||||
@@ -217,7 +213,6 @@ export const registerProjectEnvRouter = async (server: FastifyZodProvider) => {
|
|||||||
id: z.string().trim().describe(ENVIRONMENTS.DELETE.id)
|
id: z.string().trim().describe(ENVIRONMENTS.DELETE.id)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
workspace: z.string(),
|
workspace: z.string(),
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -35,7 +33,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
workspaceId: z.string().trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIPS.workspaceId)
|
workspaceId: z.string().trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIPS.workspaceId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
memberships: ProjectMembershipsSchema.extend({
|
memberships: ProjectMembershipsSchema.extend({
|
||||||
user: UsersSchema.pick({
|
user: UsersSchema.pick({
|
||||||
@@ -97,7 +94,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
username: z.string().min(1).trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIP.username)
|
username: z.string().min(1).trim().describe(PROJECT_USERS.GET_USER_MEMBERSHIP.username)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
membership: ProjectMembershipsSchema.extend({
|
membership: ProjectMembershipsSchema.extend({
|
||||||
user: UsersSchema.pick({
|
user: UsersSchema.pick({
|
||||||
@@ -231,7 +227,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
.describe(PROJECT_USERS.UPDATE_USER_MEMBERSHIP.roles)
|
.describe(PROJECT_USERS.UPDATE_USER_MEMBERSHIP.roles)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
roles: ProjectUserMembershipRolesSchema.array()
|
roles: ProjectUserMembershipRolesSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
import { ProjectFilterType } from "@app/services/project/project-types";
|
import { ProjectFilterType } from "@app/services/project/project-types";
|
||||||
import { validateSlackChannelsField } from "@app/services/slack/slack-auth-validators";
|
import { validateSlackChannelsField } from "@app/services/slack/slack-auth-validators";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, integrationAuthPubSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
import { integrationAuthPubSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||||
import { sanitizedServiceTokenSchema } from "../v2/service-token-router";
|
import { sanitizedServiceTokenSchema } from "../v2/service-token-router";
|
||||||
|
|
||||||
const projectWithEnv = SanitizedProjectSchema.merge(
|
const projectWithEnv = SanitizedProjectSchema.merge(
|
||||||
@@ -177,7 +177,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
workspaceId: z.string().trim().describe(PROJECTS.GET.workspaceId)
|
workspaceId: z.string().trim().describe(PROJECTS.GET.workspaceId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspace: projectWithEnv.optional()
|
workspace: projectWithEnv.optional()
|
||||||
})
|
})
|
||||||
@@ -300,7 +299,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
autoCapitalization: z.boolean().optional().describe(PROJECTS.UPDATE.autoCapitalization)
|
autoCapitalization: z.boolean().optional().describe(PROJECTS.UPDATE.autoCapitalization)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspace: SanitizedProjectSchema
|
workspace: SanitizedProjectSchema
|
||||||
})
|
})
|
||||||
@@ -458,7 +456,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION.workspaceId)
|
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION.workspaceId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
integrations: IntegrationsSchema.merge(
|
integrations: IntegrationsSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
@@ -502,7 +499,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION_AUTHORIZATION.workspaceId)
|
workspaceId: z.string().trim().describe(PROJECTS.LIST_INTEGRATION_AUTHORIZATION.workspaceId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
authorizations: integrationAuthPubSchema.array()
|
authorizations: integrationAuthPubSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerSecretFolderRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretFolderRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
url: "/",
|
url: "/",
|
||||||
@@ -45,7 +43,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
.describe(FOLDERS.CREATE.directory)
|
.describe(FOLDERS.CREATE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: SecretFoldersSchema
|
folder: SecretFoldersSchema
|
||||||
})
|
})
|
||||||
@@ -118,7 +115,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
.describe(FOLDERS.UPDATE.directory)
|
.describe(FOLDERS.UPDATE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: SecretFoldersSchema
|
folder: SecretFoldersSchema
|
||||||
})
|
})
|
||||||
@@ -262,7 +258,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
.describe(FOLDERS.DELETE.directory)
|
.describe(FOLDERS.DELETE.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: SecretFoldersSchema
|
folder: SecretFoldersSchema
|
||||||
})
|
})
|
||||||
@@ -331,7 +326,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
.describe(FOLDERS.LIST.directory)
|
.describe(FOLDERS.LIST.directory)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folders: SecretFoldersSchema.array()
|
folders: SecretFoldersSchema.array()
|
||||||
})
|
})
|
||||||
@@ -370,7 +364,6 @@ export const registerSecretFolderRouter = async (server: FastifyZodProvider) =>
|
|||||||
id: z.string().trim().describe(FOLDERS.GET_BY_ID.folderId)
|
id: z.string().trim().describe(FOLDERS.GET_BY_ID.folderId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
folder: SecretFoldersSchema
|
folder: SecretFoldersSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "../sanitizedSchemas";
|
import { secretRawSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerSecretImportRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretImportRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -35,7 +35,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
|||||||
isReplication: z.boolean().default(false).describe(SECRET_IMPORTS.CREATE.isReplication)
|
isReplication: z.boolean().default(false).describe(SECRET_IMPORTS.CREATE.isReplication)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||||
@@ -109,7 +108,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
|||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||||
@@ -174,7 +172,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
|||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.DELETE.path)
|
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.DELETE.path)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
secretImport: SecretImportsSchema.omit({ importEnv: true }).merge(
|
||||||
@@ -278,7 +275,6 @@ export const registerSecretImportRouter = async (server: FastifyZodProvider) =>
|
|||||||
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.LIST.path)
|
path: z.string().trim().default("/").transform(removeTrailingSlash).describe(SECRET_IMPORTS.LIST.path)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string(),
|
message: z.string(),
|
||||||
secretImports: SecretImportsSchema.omit({ importEnv: true })
|
secretImports: SecretImportsSchema.omit({ importEnv: true })
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -21,7 +19,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
projectId: z.string().trim().describe(SECRET_TAGS.LIST.projectId)
|
projectId: z.string().trim().describe(SECRET_TAGS.LIST.projectId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspaceTags: SecretTagsSchema.array()
|
workspaceTags: SecretTagsSchema.array()
|
||||||
})
|
})
|
||||||
@@ -52,7 +49,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
tagId: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_ID.tagId)
|
tagId: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_ID.tagId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
// akhilmhdh: for terraform backward compatiability
|
// akhilmhdh: for terraform backward compatiability
|
||||||
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
||||||
@@ -84,7 +80,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
tagSlug: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_SLUG.tagSlug)
|
tagSlug: z.string().trim().describe(SECRET_TAGS.GET_TAG_BY_SLUG.tagSlug)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
// akhilmhdh: for terraform backward compatiability
|
// akhilmhdh: for terraform backward compatiability
|
||||||
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
workspaceTag: SecretTagsSchema.extend({ name: z.string() })
|
||||||
@@ -127,7 +122,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
color: z.string().trim().describe(SECRET_TAGS.CREATE.color)
|
color: z.string().trim().describe(SECRET_TAGS.CREATE.color)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspaceTag: SecretTagsSchema
|
workspaceTag: SecretTagsSchema
|
||||||
})
|
})
|
||||||
@@ -170,7 +164,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
color: z.string().trim().describe(SECRET_TAGS.UPDATE.color)
|
color: z.string().trim().describe(SECRET_TAGS.UPDATE.color)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspaceTag: SecretTagsSchema
|
workspaceTag: SecretTagsSchema
|
||||||
})
|
})
|
||||||
@@ -202,7 +195,6 @@ export const registerSecretTagRouter = async (server: FastifyZodProvider) => {
|
|||||||
tagId: z.string().trim().describe(SECRET_TAGS.DELETE.tagId)
|
tagId: z.string().trim().describe(SECRET_TAGS.DELETE.tagId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspaceTag: SecretTagsSchema
|
workspaceTag: SecretTagsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerGroupProjectRouter = async (server: FastifyZodProvider) => {
|
export const registerGroupProjectRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -65,7 +63,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
|||||||
path: ["role", "roles"]
|
path: ["role", "roles"]
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
groupMembership: GroupProjectMembershipsSchema
|
groupMembership: GroupProjectMembershipsSchema
|
||||||
})
|
})
|
||||||
@@ -122,7 +119,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
|||||||
.describe(PROJECTS.UPDATE_GROUP_IN_PROJECT.roles)
|
.describe(PROJECTS.UPDATE_GROUP_IN_PROJECT.roles)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
roles: ProjectUserMembershipRolesSchema.array()
|
roles: ProjectUserMembershipRolesSchema.array()
|
||||||
})
|
})
|
||||||
@@ -162,7 +158,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
|||||||
groupId: z.string().trim().describe(PROJECTS.REMOVE_GROUP_FROM_PROJECT.groupId)
|
groupId: z.string().trim().describe(PROJECTS.REMOVE_GROUP_FROM_PROJECT.groupId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
groupMembership: GroupProjectMembershipsSchema
|
groupMembership: GroupProjectMembershipsSchema
|
||||||
})
|
})
|
||||||
@@ -200,7 +195,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
|||||||
projectId: z.string().trim().describe(PROJECTS.LIST_GROUPS_IN_PROJECT.projectId)
|
projectId: z.string().trim().describe(PROJECTS.LIST_GROUPS_IN_PROJECT.projectId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
groupMemberships: z
|
groupMemberships: z
|
||||||
.object({
|
.object({
|
||||||
@@ -260,7 +254,6 @@ export const registerGroupProjectRouter = async (server: FastifyZodProvider) =>
|
|||||||
groupId: z.string().trim()
|
groupId: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
groupMembership: z.object({
|
groupMembership: z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
import { OrgIdentityOrderBy } from "@app/services/identity/identity-types";
|
import { OrgIdentityOrderBy } from "@app/services/identity/identity-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerIdentityOrgRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityOrgRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -50,7 +48,6 @@ export const registerIdentityOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
search: z.string().trim().describe(ORGANIZATIONS.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
search: z.string().trim().describe(ORGANIZATIONS.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityMemberships: IdentityOrgMembershipsSchema.merge(
|
identityMemberships: IdentityOrgMembershipsSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { AuthMode } from "@app/services/auth/auth-type";
|
|||||||
import { ProjectIdentityOrderBy } from "@app/services/identity-project/identity-project-types";
|
import { ProjectIdentityOrderBy } from "@app/services/identity-project/identity-project-types";
|
||||||
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
import { ProjectUserMembershipTemporaryMode } from "@app/services/project-membership/project-membership-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerIdentityProjectRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityProjectRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -71,7 +71,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
.optional()
|
.optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityMembership: IdentityProjectMembershipsSchema
|
identityMembership: IdentityProjectMembershipsSchema
|
||||||
})
|
})
|
||||||
@@ -144,7 +143,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
.describe(PROJECT_IDENTITIES.UPDATE_IDENTITY_MEMBERSHIP.roles.description)
|
.describe(PROJECT_IDENTITIES.UPDATE_IDENTITY_MEMBERSHIP.roles.description)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
roles: ProjectUserMembershipRolesSchema.array()
|
roles: ProjectUserMembershipRolesSchema.array()
|
||||||
})
|
})
|
||||||
@@ -183,7 +181,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().trim().describe(PROJECT_IDENTITIES.DELETE_IDENTITY_MEMBERSHIP.identityId)
|
identityId: z.string().trim().describe(PROJECT_IDENTITIES.DELETE_IDENTITY_MEMBERSHIP.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityMembership: IdentityProjectMembershipsSchema
|
identityMembership: IdentityProjectMembershipsSchema
|
||||||
})
|
})
|
||||||
@@ -246,7 +243,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
search: z.string().trim().describe(PROJECT_IDENTITIES.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
search: z.string().trim().describe(PROJECT_IDENTITIES.LIST_IDENTITY_MEMBERSHIPS.search).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityMemberships: z
|
identityMemberships: z
|
||||||
.object({
|
.object({
|
||||||
@@ -312,7 +308,6 @@ export const registerIdentityProjectRouter = async (server: FastifyZodProvider)
|
|||||||
identityId: z.string().trim().describe(PROJECT_IDENTITIES.GET_IDENTITY_MEMBERSHIP_BY_ID.identityId)
|
identityId: z.string().trim().describe(PROJECT_IDENTITIES.GET_IDENTITY_MEMBERSHIP_BY_ID.identityId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
identityMembership: z.object({
|
identityMembership: z.object({
|
||||||
id: z.string(),
|
id: z.string(),
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -33,7 +31,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
organizationId: z.string().trim().describe(ORGANIZATIONS.LIST_USER_MEMBERSHIPS.organizationId)
|
organizationId: z.string().trim().describe(ORGANIZATIONS.LIST_USER_MEMBERSHIPS.organizationId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
users: OrgMembershipsSchema.merge(
|
users: OrgMembershipsSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
@@ -82,7 +79,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
organizationId: z.string().trim().describe(ORGANIZATIONS.GET_PROJECTS.organizationId)
|
organizationId: z.string().trim().describe(ORGANIZATIONS.GET_PROJECTS.organizationId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
workspaces: z
|
workspaces: z
|
||||||
.object({
|
.object({
|
||||||
@@ -185,7 +181,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
isActive: z.boolean().optional().describe(ORGANIZATIONS.UPDATE_USER_MEMBERSHIP.isActive)
|
isActive: z.boolean().optional().describe(ORGANIZATIONS.UPDATE_USER_MEMBERSHIP.isActive)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
membership: OrgMembershipsSchema
|
membership: OrgMembershipsSchema
|
||||||
})
|
})
|
||||||
@@ -225,7 +220,6 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
membershipId: z.string().trim().describe(ORGANIZATIONS.DELETE_USER_MEMBERSHIP.membershipId)
|
membershipId: z.string().trim().describe(ORGANIZATIONS.DELETE_USER_MEMBERSHIP.membershipId)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
membership: OrgMembershipsSchema
|
membership: OrgMembershipsSchema
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import { writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema } from "../sanitizedSchemas";
|
|
||||||
|
|
||||||
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
export const registerProjectMembershipRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -32,7 +30,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
roleSlugs: z.string().array().optional().describe(PROJECT_USERS.INVITE_MEMBER.roleSlugs)
|
roleSlugs: z.string().array().optional().describe(PROJECT_USERS.INVITE_MEMBER.roleSlugs)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
memberships: ProjectMembershipsSchema.array()
|
memberships: ProjectMembershipsSchema.array()
|
||||||
})
|
})
|
||||||
@@ -95,7 +92,6 @@ export const registerProjectMembershipRouter = async (server: FastifyZodProvider
|
|||||||
usernames: z.string().array().default([]).describe(PROJECT_USERS.REMOVE_MEMBER.usernames)
|
usernames: z.string().array().default([]).describe(PROJECT_USERS.REMOVE_MEMBER.usernames)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
memberships: ProjectMembershipsSchema.array()
|
memberships: ProjectMembershipsSchema.array()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { sanitizedCertificateTemplate } from "@app/services/certificate-template
|
|||||||
import { ProjectFilterType } from "@app/services/project/project-types";
|
import { ProjectFilterType } from "@app/services/project/project-types";
|
||||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, SanitizedProjectSchema } from "../sanitizedSchemas";
|
import { SanitizedProjectSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
const projectWithEnv = SanitizedProjectSchema.extend({
|
const projectWithEnv = SanitizedProjectSchema.extend({
|
||||||
_id: z.string(),
|
_id: z.string(),
|
||||||
@@ -172,7 +172,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
kmsKeyId: z.string().optional()
|
kmsKeyId: z.string().optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
project: projectWithEnv
|
project: projectWithEnv
|
||||||
})
|
})
|
||||||
@@ -222,7 +221,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
slug: slugSchema.describe("The slug of the project to delete.")
|
slug: slugSchema.describe("The slug of the project to delete.")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: SanitizedProjectSchema
|
200: SanitizedProjectSchema
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -378,7 +376,6 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
limit: z.coerce.number().min(1).max(100).default(25).describe(PROJECTS.LIST_CERTIFICATES.limit)
|
limit: z.coerce.number().min(1).max(100).default(25).describe(PROJECTS.LIST_CERTIFICATES.limit)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
certificates: z.array(CertificatesSchema),
|
certificates: z.array(CertificatesSchema),
|
||||||
totalCount: z.number()
|
totalCount: z.number()
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { readLimit, writeLimit } from "@app/server/config/rateLimiter";
|
|||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, sanitizedServiceTokenUserSchema } from "../sanitizedSchemas";
|
import { sanitizedServiceTokenUserSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const sanitizedServiceTokenSchema = ServiceTokensSchema.omit({
|
export const sanitizedServiceTokenSchema = ServiceTokensSchema.omit({
|
||||||
secretHash: true,
|
secretHash: true,
|
||||||
@@ -32,7 +32,6 @@ export const registerServiceTokenRouter = async (server: FastifyZodProvider) =>
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: ServiceTokensSchema.merge(
|
200: ServiceTokensSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
workspace: z.string(),
|
workspace: z.string(),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { ProjectFilterType } from "@app/services/project/project-types";
|
|||||||
import { SecretOperations, SecretProtectionType } from "@app/services/secret/secret-types";
|
import { SecretOperations, SecretProtectionType } from "@app/services/secret/secret-types";
|
||||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
import { DefaultResponseErrorsSchema, secretRawSchema } from "../sanitizedSchemas";
|
import { secretRawSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -53,7 +53,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
tagSlugs: z.string().array().min(1).describe(SECRETS.ATTACH_TAGS.tagSlugs)
|
tagSlugs: z.string().array().min(1).describe(SECRETS.ATTACH_TAGS.tagSlugs)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||||
z.object({
|
z.object({
|
||||||
@@ -117,7 +116,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
tagSlugs: z.string().array().min(1).describe(SECRETS.DETACH_TAGS.tagSlugs)
|
tagSlugs: z.string().array().min(1).describe(SECRETS.DETACH_TAGS.tagSlugs)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).extend({
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).extend({
|
||||||
tags: SecretTagsSchema.pick({
|
tags: SecretTagsSchema.pick({
|
||||||
@@ -191,7 +189,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.transform((el) => (el ? el.split(",").map((i) => i.trim()) : []))
|
.transform((el) => (el ? el.split(",").map((i) => i.trim()) : []))
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secrets: secretRawSchema
|
secrets: secretRawSchema
|
||||||
.extend({
|
.extend({
|
||||||
@@ -215,8 +212,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
})
|
})
|
||||||
.array()
|
.array()
|
||||||
.optional()
|
.optional()
|
||||||
}),
|
})
|
||||||
...DefaultResponseErrorsSchema
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onRequest: verifyAuth([AuthMode.JWT, AuthMode.API_KEY, AuthMode.SERVICE_TOKEN, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
onRequest: verifyAuth([AuthMode.JWT, AuthMode.API_KEY, AuthMode.SERVICE_TOKEN, AuthMode.IDENTITY_ACCESS_TOKEN]),
|
||||||
@@ -331,7 +327,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.describe(RAW_SECRETS.GET.includeImports)
|
.describe(RAW_SECRETS.GET.includeImports)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secret: secretRawSchema.extend({
|
secret: secretRawSchema.extend({
|
||||||
tags: SecretTagsSchema.pick({
|
tags: SecretTagsSchema.pick({
|
||||||
@@ -454,7 +449,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
secretReminderNote: z.string().optional().nullable().describe(RAW_SECRETS.CREATE.secretReminderNote)
|
secretReminderNote: z.string().optional().nullable().describe(RAW_SECRETS.CREATE.secretReminderNote)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: secretRawSchema
|
secret: secretRawSchema
|
||||||
@@ -562,7 +556,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
secretComment: z.string().optional().describe(RAW_SECRETS.UPDATE.secretComment)
|
secretComment: z.string().optional().describe(RAW_SECRETS.UPDATE.secretComment)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: secretRawSchema
|
secret: secretRawSchema
|
||||||
@@ -656,7 +649,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
type: z.nativeEnum(SecretType).default(SecretType.Shared).describe(RAW_SECRETS.DELETE.type)
|
type: z.nativeEnum(SecretType).default(SecretType.Shared).describe(RAW_SECRETS.DELETE.type)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: secretRawSchema
|
secret: secretRawSchema
|
||||||
@@ -736,7 +728,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.transform((value) => value === "true")
|
.transform((value) => value === "true")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secrets: SecretsSchema.omit({ secretBlindIndex: true })
|
secrets: SecretsSchema.omit({ secretBlindIndex: true })
|
||||||
.extend({
|
.extend({
|
||||||
@@ -852,7 +843,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.transform((value) => value === "true")
|
.transform((value) => value === "true")
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||||
z.object({
|
z.object({
|
||||||
@@ -940,7 +930,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
secretName: z.string().trim()
|
secretName: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||||
@@ -1118,7 +1107,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
metadata: z.record(z.string()).optional()
|
metadata: z.record(z.string()).optional()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||||
@@ -1290,7 +1278,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
environment: z.string().trim()
|
environment: z.string().trim()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
secret: SecretsSchema.omit({ secretBlindIndex: true }).merge(
|
||||||
@@ -1414,7 +1401,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
shouldOverwrite: z.boolean().default(false)
|
shouldOverwrite: z.boolean().default(false)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
isSourceUpdated: z.boolean(),
|
isSourceUpdated: z.boolean(),
|
||||||
isDestinationUpdated: z.boolean()
|
isDestinationUpdated: z.boolean()
|
||||||
@@ -1483,7 +1469,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||||
@@ -1611,7 +1596,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||||
@@ -1727,7 +1711,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
secrets: SecretsSchema.omit({ secretBlindIndex: true }).array()
|
||||||
@@ -1861,7 +1844,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: secretRawSchema.array()
|
secrets: secretRawSchema.array()
|
||||||
@@ -1968,7 +1950,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: secretRawSchema.array()
|
secrets: secretRawSchema.array()
|
||||||
@@ -2061,7 +2042,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
.min(1)
|
.min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.union([
|
200: z.union([
|
||||||
z.object({
|
z.object({
|
||||||
secrets: secretRawSchema.array()
|
secrets: secretRawSchema.array()
|
||||||
@@ -2139,7 +2119,6 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
projectId: z.string().trim().min(1)
|
projectId: z.string().trim().min(1)
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
...DefaultResponseErrorsSchema,
|
|
||||||
200: z.object({
|
200: z.object({
|
||||||
message: z.string()
|
message: z.string()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Infisical",
|
"name": "Infisical",
|
||||||
"openapi": "http://localhost:8080/api/docs/json",
|
"openapi": "https://app.infisical.com/api/docs/json",
|
||||||
"logo": {
|
"logo": {
|
||||||
"dark": "/logo/dark.svg",
|
"dark": "/logo/dark.svg",
|
||||||
"light": "/logo/light.svg",
|
"light": "/logo/light.svg",
|
||||||
|
|||||||
Reference in New Issue
Block a user