Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix: remove undefined return type from get saml endpoint
Daniel Hougaard65b1354ef156
diff --git a/backend/src/ee/routes/v1/saml-router.ts b/backend/src/ee/routes/v1/saml-router.tsindex 6f220c9cb7..461e6a489a 100644--- a/backend/src/ee/routes/v1/saml-router.ts+++ b/backend/src/ee/routes/v1/saml-router.ts@@ -277,19 +277,17 @@ export const registerSamlRouter = async (server: FastifyZodProvider) => {organizationId: z.string().trim().describe(SamlSso.GET_CONFIG.organizationId)}),response: {- 200: z- .object({- id: z.string(),- organization: z.string(),- orgId: z.string(),- authProvider: z.string(),- isActive: z.boolean(),- entryPoint: z.string(),- issuer: z.string(),- cert: z.string(),- lastUsed: z.date().nullable().optional()- })- .optional()+ 200: z.object({+ id: z.string(),+ organization: z.string(),+ orgId: z.string(),+ authProvider: z.string(),+ isActive: z.boolean(),+ entryPoint: z.string(),+ issuer: z.string(),+ cert: z.string(),+ lastUsed: z.date().nullable().optional()+ })}},handler: async (req) => {diff --git a/backend/src/ee/services/saml-config/saml-config-service.ts b/backend/src/ee/services/saml-config/saml-config-service.tsindex c81fd518bc..2dee8afcac 100644--- a/backend/src/ee/services/saml-config/saml-config-service.ts+++ b/backend/src/ee/services/saml-config/saml-config-service.ts@@ -148,10 +148,18 @@ export const samlConfigServiceFactory = ({let samlConfig: TSamlConfigs | undefined;if (dto.type === "org") {samlConfig = await samlConfigDAL.findOne({ orgId: dto.orgId });- if (!samlConfig) return;+ if (!samlConfig) {+ throw new NotFoundError({+ message: `Organization with ID '${dto.orgId}' not found`+ });+ }} else if (dto.type === "orgSlug") {const org = await orgDAL.findOne({ slug: dto.orgSlug });- if (!org) return;+ if (!org) {+ throw new NotFoundError({+ message: `Organization with slug '${dto.orgSlug}' not found`+ });+ }samlConfig = await samlConfigDAL.findOne({ orgId: org.id });} else if (dto.type === "ssoId") {// TODO:diff --git a/backend/src/ee/services/saml-config/saml-config-types.ts b/backend/src/ee/services/saml-config/saml-config-types.tsindex a9bd8f4858..f4ede04fab 100644--- a/backend/src/ee/services/saml-config/saml-config-types.ts+++ b/backend/src/ee/services/saml-config/saml-config-types.ts@@ -61,20 +61,17 @@ export type TSamlLoginDTO = {export type TSamlConfigServiceFactory = {createSamlCfg: (arg: TCreateSamlCfgDTO) => Promise<TSamlConfigs>;updateSamlCfg: (arg: TUpdateSamlCfgDTO) => Promise<TSamlConfigs>;- getSaml: (arg: TGetSamlCfgDTO) => Promise<- | {- id: string;- organization: string;- orgId: string;- authProvider: string;- isActive: boolean;- entryPoint: string;- issuer: string;- cert: string;- lastUsed: Date | null | undefined;- }- | undefined- >;+ getSaml: (arg: TGetSamlCfgDTO) => Promise<{+ id: string;+ organization: string;+ orgId: string;+ authProvider: string;+ isActive: boolean;+ entryPoint: string;+ issuer: string;+ cert: string;+ lastUsed: Date | null | undefined;+ }>;samlLogin: (arg: TSamlLoginDTO) => Promise<{isUserCompleted: boolean;providerAuthToken: string;diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 848b0d0952..d22f266248 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2706,7 +2706,7 @@ export const SamlSso = {},UPDATE_CONFIG: {organizationId: "The ID of the organization to update the SAML config for.",- authProvider: "The authentication provider to use for SAML authentication.",+ authProvider: "Authentication provider to use for SAML authentication.",isActive: "Whether to enable or disable this SAML configuration.",entryPoint:"The entry point for the SAML authentication. This is the URL that the user will be redirected to after they have authenticated with the SAML provider.",@@ -2715,7 +2715,7 @@ export const SamlSso = {},CREATE_CONFIG: {organizationId: "The ID of the organization to create the SAML config for.",- authProvider: "The authentication provider to use for SAML authentication.",+ authProvider: "Authentication provider to use for SAML authentication.",isActive: "Whether to enable or disable this SAML configuration.",entryPoint:"The entry point for the SAML authentication. This is the URL that the user will be redirected to after they have authenticated with the SAML provider.",