diff --git a/backend/src/db/schemas/certificates.ts b/backend/src/db/schemas/certificates.ts index 533f9b898..bde35002f 100644 --- a/backend/src/db/schemas/certificates.ts +++ b/backend/src/db/schemas/certificates.ts @@ -20,7 +20,7 @@ export const CertificatesSchema = z.object({ notAfter: z.date(), revokedAt: z.date().nullable().optional(), revocationReason: z.number().nullable().optional(), - altNames: z.string().nullable().optional(), + altNames: z.string().default("").nullable().optional(), caCertId: z.string().uuid(), certificateTemplateId: z.string().uuid().nullable().optional(), keyUsages: z.string().array().nullable().optional(), diff --git a/backend/src/db/schemas/kmip-org-server-certificates.ts b/backend/src/db/schemas/kmip-org-server-certificates.ts index c23da626b..66e5dcbd6 100644 --- a/backend/src/db/schemas/kmip-org-server-certificates.ts +++ b/backend/src/db/schemas/kmip-org-server-certificates.ts @@ -13,7 +13,7 @@ export const KmipOrgServerCertificatesSchema = z.object({ id: z.string().uuid(), orgId: z.string().uuid(), commonName: z.string(), - altNames: z.string().nullable().optional(), + altNames: z.string(), serialNumber: z.string(), keyAlgorithm: z.string(), issuedAt: z.date(), diff --git a/backend/src/db/schemas/oidc-configs.ts b/backend/src/db/schemas/oidc-configs.ts index 216b50847..633d7f8c7 100644 --- a/backend/src/db/schemas/oidc-configs.ts +++ b/backend/src/db/schemas/oidc-configs.ts @@ -30,7 +30,6 @@ export const OidcConfigsSchema = z.object({ updatedAt: z.date(), orgId: z.string().uuid(), lastUsed: z.date().nullable().optional(), - manageGroupMemberships: z.boolean().default(false), encryptedOidcClientId: zodBuffer, encryptedOidcClientSecret: zodBuffer, jwtSignatureAlgorithm: z.string().default("RS256") diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts index 0e65d48e5..fe3408e8a 100644 --- a/backend/src/ee/services/audit-log/audit-log-types.ts +++ b/backend/src/ee/services/audit-log/audit-log-types.ts @@ -245,6 +245,8 @@ export enum EventType { GET_CERTIFICATE_TEMPLATE_EST_CONFIG = "get-certificate-template-est-config", ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration", ATTEMPT_REINSTALL_SLACK_INTEGRATION = "attempt-reinstall-slack-integration", + GET_PROJECT_SLACK_CONFIG = "get-project-slack-config", + UPDATE_PROJECT_SLACK_CONFIG = "update-project-slack-config", GET_SLACK_INTEGRATION = "get-slack-integration", UPDATE_SLACK_INTEGRATION = "update-slack-integration", DELETE_SLACK_INTEGRATION = "delete-slack-integration", diff --git a/backend/src/server/routes/v1/microsoft-teams-router.ts b/backend/src/server/routes/v1/microsoft-teams-router.ts index ee8d1760e..f624c2cdf 100644 --- a/backend/src/server/routes/v1/microsoft-teams-router.ts +++ b/backend/src/server/routes/v1/microsoft-teams-router.ts @@ -59,7 +59,7 @@ export const registerMicrosoftTeamsRouter = async (server: FastifyZodProvider) = schema: { body: z.object({ redirectUri: z.string(), - tenantId: z.string(), + tenantId: z.string().uuid(), slug: z.string(), description: z.string().optional() }) diff --git a/backend/src/services/microsoft-teams/microsoft-teams-fns.ts b/backend/src/services/microsoft-teams/microsoft-teams-fns.ts index fbbc4dc7a..9de532e8c 100644 --- a/backend/src/services/microsoft-teams/microsoft-teams-fns.ts +++ b/backend/src/services/microsoft-teams/microsoft-teams-fns.ts @@ -105,6 +105,7 @@ export const getMicrosoftTeamsAccessToken = async ( } if (getBotFrameworkToken) { + // If the token expires within the next 5 minutes, we'll get a new token instead of using the stored one. const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000); if ( @@ -124,6 +125,7 @@ export const getMicrosoftTeamsAccessToken = async ( return botAccessToken.toString(); } } else { + // If the token expires within the next 5 minutes, we'll get a new token instead of using the stored one. const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000); if ( @@ -670,6 +672,6 @@ export const validateMicrosoftTeamsChannelsSchema = z channelIds: z.array(z.string()).min(1) }) .optional() - .refine((data) => data === undefined || data?.channelIds.length <= 5, { - message: "You can only select up to 5 microsoft teams channels" + .refine((data) => data === undefined || data?.channelIds.length <= 20, { + message: "You can only select up to 20 Microsoft Teams channels" }); diff --git a/backend/src/services/super-admin/super-admin-service.ts b/backend/src/services/super-admin/super-admin-service.ts index e413646d3..8c23a00c6 100644 --- a/backend/src/services/super-admin/super-admin-service.ts +++ b/backend/src/services/super-admin/super-admin-service.ts @@ -201,11 +201,13 @@ export const superAdminServiceFactory = ({ updatedData.slackClientSecret = undefined; } + let microsoftTeamsSettingsUpdated = false; if (data.microsoftTeamsAppId) { const encryptedClientId = encryptWithRoot(Buffer.from(data.microsoftTeamsAppId)); updatedData.encryptedMicrosoftTeamsAppId = encryptedClientId; updatedData.microsoftTeamsAppId = undefined; + microsoftTeamsSettingsUpdated = true; } if (data.microsoftTeamsClientSecret) { @@ -213,6 +215,7 @@ export const superAdminServiceFactory = ({ updatedData.encryptedMicrosoftTeamsClientSecret = encryptedClientSecret; updatedData.microsoftTeamsClientSecret = undefined; + microsoftTeamsSettingsUpdated = true; } if (data.microsoftTeamsBotId) { @@ -220,6 +223,7 @@ export const superAdminServiceFactory = ({ updatedData.encryptedMicrosoftTeamsBotId = encryptedBotId; updatedData.microsoftTeamsBotId = undefined; + microsoftTeamsSettingsUpdated = true; } const updatedServerCfg = await serverCfgDAL.updateById(ADMIN_CONFIG_DB_UUID, updatedData); @@ -228,7 +232,8 @@ export const superAdminServiceFactory = ({ if ( updatedServerCfg.encryptedMicrosoftTeamsAppId && updatedServerCfg.encryptedMicrosoftTeamsClientSecret && - updatedServerCfg.encryptedMicrosoftTeamsBotId + updatedServerCfg.encryptedMicrosoftTeamsBotId && + microsoftTeamsSettingsUpdated ) { const decryptWithRoot = kmsService.decryptWithRootKey(); decryptWithRoot(updatedServerCfg.encryptedMicrosoftTeamsBotId); // validate that we're able to decrypt the bot ID diff --git a/docs/documentation/platform/workflow-integrations/microsoft-teams-integration.mdx b/docs/documentation/platform/workflow-integrations/microsoft-teams-integration.mdx index 432197201..fd774deb2 100644 --- a/docs/documentation/platform/workflow-integrations/microsoft-teams-integration.mdx +++ b/docs/documentation/platform/workflow-integrations/microsoft-teams-integration.mdx @@ -77,7 +77,7 @@ This guide will provide step by step instructions on how to configure Microsoft ![azure-app-registration-api-permissions](/images/platform/workflow-integrations/microsoft-teams-integration/azure-app-registration-api-permissions.png) - + Navigate to the "Authentication" section of the App Registration, and press the "Add a platform" button. Select the "Web" platform and enter the following redirect URI: `https:///organization/settings/oauth/callback`. Replace `` with the URL of your Infisical instance. diff --git a/frontend/src/hooks/api/auditLogs/constants.tsx b/frontend/src/hooks/api/auditLogs/constants.tsx index 773f2acc6..9de5c4085 100644 --- a/frontend/src/hooks/api/auditLogs/constants.tsx +++ b/frontend/src/hooks/api/auditLogs/constants.tsx @@ -167,6 +167,9 @@ export const eventToNameMap: { [K in EventType]: string } = { [EventType.DELETE_SECRET_ROTATION]: "Delete Secret Rotation", [EventType.SECRET_ROTATION_ROTATE_SECRETS]: "Secret Rotation secrets rotated", + [EventType.GET_PROJECT_SLACK_CONFIG]: "Get Project Slack Config", + [EventType.UPDATE_PROJECT_SLACK_CONFIG]: "Update Project Slack Config", + [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_CREATE]: "Create Microsoft Teams Workflow Integration", [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE]: diff --git a/frontend/src/hooks/api/auditLogs/enums.tsx b/frontend/src/hooks/api/auditLogs/enums.tsx index a412eab84..08f2559f6 100644 --- a/frontend/src/hooks/api/auditLogs/enums.tsx +++ b/frontend/src/hooks/api/auditLogs/enums.tsx @@ -165,6 +165,9 @@ export enum EventType { DELETE_SECRET_ROTATION = "delete-secret-rotation", SECRET_ROTATION_ROTATE_SECRETS = "secret-rotation-rotate-secrets", + GET_PROJECT_SLACK_CONFIG = "get-project-slack-config", + UPDATE_PROJECT_SLACK_CONFIG = "update-project-slack-config", + MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_CREATE = "microsoft-teams-workflow-integration-create", MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE = "microsoft-teams-workflow-integration-delete", MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_UPDATE = "microsoft-teams-workflow-integration-update", diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsx index 4c05c68c9..90c0dfe97 100644 --- a/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/OrgWorkflowIntegrationTab/MicrosoftTeamsIntegrationForm.tsx @@ -22,7 +22,11 @@ type Props = { const microsoftTeamsFormSchema = z.object({ slug: slugSchema({ min: 1, field: "Alias" }), - tenantId: z.string().min(1, { message: "Tenant ID is required" }).trim(), + tenantId: z + .string() + .min(1, { message: "Tenant ID is required" }) + .trim() + .uuid("Tenant ID must be a valid UUID"), description: z.string().optional() });