requested changes

This commit is contained in:
Daniel Hougaard
2025-04-30 02:35:07 +04:00
parent 929434d17f
commit ff0ff622a6
11 changed files with 27 additions and 9 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ export const CertificatesSchema = z.object({
notAfter: z.date(), notAfter: z.date(),
revokedAt: z.date().nullable().optional(), revokedAt: z.date().nullable().optional(),
revocationReason: z.number().nullable().optional(), revocationReason: z.number().nullable().optional(),
altNames: z.string().nullable().optional(), altNames: z.string().default("").nullable().optional(),
caCertId: z.string().uuid(), caCertId: z.string().uuid(),
certificateTemplateId: z.string().uuid().nullable().optional(), certificateTemplateId: z.string().uuid().nullable().optional(),
keyUsages: z.string().array().nullable().optional(), keyUsages: z.string().array().nullable().optional(),
@@ -13,7 +13,7 @@ export const KmipOrgServerCertificatesSchema = z.object({
id: z.string().uuid(), id: z.string().uuid(),
orgId: z.string().uuid(), orgId: z.string().uuid(),
commonName: z.string(), commonName: z.string(),
altNames: z.string().nullable().optional(), altNames: z.string(),
serialNumber: z.string(), serialNumber: z.string(),
keyAlgorithm: z.string(), keyAlgorithm: z.string(),
issuedAt: z.date(), issuedAt: z.date(),
-1
View File
@@ -30,7 +30,6 @@ export const OidcConfigsSchema = z.object({
updatedAt: z.date(), updatedAt: z.date(),
orgId: z.string().uuid(), orgId: z.string().uuid(),
lastUsed: z.date().nullable().optional(), lastUsed: z.date().nullable().optional(),
manageGroupMemberships: z.boolean().default(false),
encryptedOidcClientId: zodBuffer, encryptedOidcClientId: zodBuffer,
encryptedOidcClientSecret: zodBuffer, encryptedOidcClientSecret: zodBuffer,
jwtSignatureAlgorithm: z.string().default("RS256") jwtSignatureAlgorithm: z.string().default("RS256")
@@ -245,6 +245,8 @@ export enum EventType {
GET_CERTIFICATE_TEMPLATE_EST_CONFIG = "get-certificate-template-est-config", GET_CERTIFICATE_TEMPLATE_EST_CONFIG = "get-certificate-template-est-config",
ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration", ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration",
ATTEMPT_REINSTALL_SLACK_INTEGRATION = "attempt-reinstall-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", GET_SLACK_INTEGRATION = "get-slack-integration",
UPDATE_SLACK_INTEGRATION = "update-slack-integration", UPDATE_SLACK_INTEGRATION = "update-slack-integration",
DELETE_SLACK_INTEGRATION = "delete-slack-integration", DELETE_SLACK_INTEGRATION = "delete-slack-integration",
@@ -59,7 +59,7 @@ export const registerMicrosoftTeamsRouter = async (server: FastifyZodProvider) =
schema: { schema: {
body: z.object({ body: z.object({
redirectUri: z.string(), redirectUri: z.string(),
tenantId: z.string(), tenantId: z.string().uuid(),
slug: z.string(), slug: z.string(),
description: z.string().optional() description: z.string().optional()
}) })
@@ -105,6 +105,7 @@ export const getMicrosoftTeamsAccessToken = async (
} }
if (getBotFrameworkToken) { 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); const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000);
if ( if (
@@ -124,6 +125,7 @@ export const getMicrosoftTeamsAccessToken = async (
return botAccessToken.toString(); return botAccessToken.toString();
} }
} else { } 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); const currentTime = new Date(new Date().getTime() + 5 * 60 * 1000);
if ( if (
@@ -670,6 +672,6 @@ export const validateMicrosoftTeamsChannelsSchema = z
channelIds: z.array(z.string()).min(1) channelIds: z.array(z.string()).min(1)
}) })
.optional() .optional()
.refine((data) => data === undefined || data?.channelIds.length <= 5, { .refine((data) => data === undefined || data?.channelIds.length <= 20, {
message: "You can only select up to 5 microsoft teams channels" message: "You can only select up to 20 Microsoft Teams channels"
}); });
@@ -201,11 +201,13 @@ export const superAdminServiceFactory = ({
updatedData.slackClientSecret = undefined; updatedData.slackClientSecret = undefined;
} }
let microsoftTeamsSettingsUpdated = false;
if (data.microsoftTeamsAppId) { if (data.microsoftTeamsAppId) {
const encryptedClientId = encryptWithRoot(Buffer.from(data.microsoftTeamsAppId)); const encryptedClientId = encryptWithRoot(Buffer.from(data.microsoftTeamsAppId));
updatedData.encryptedMicrosoftTeamsAppId = encryptedClientId; updatedData.encryptedMicrosoftTeamsAppId = encryptedClientId;
updatedData.microsoftTeamsAppId = undefined; updatedData.microsoftTeamsAppId = undefined;
microsoftTeamsSettingsUpdated = true;
} }
if (data.microsoftTeamsClientSecret) { if (data.microsoftTeamsClientSecret) {
@@ -213,6 +215,7 @@ export const superAdminServiceFactory = ({
updatedData.encryptedMicrosoftTeamsClientSecret = encryptedClientSecret; updatedData.encryptedMicrosoftTeamsClientSecret = encryptedClientSecret;
updatedData.microsoftTeamsClientSecret = undefined; updatedData.microsoftTeamsClientSecret = undefined;
microsoftTeamsSettingsUpdated = true;
} }
if (data.microsoftTeamsBotId) { if (data.microsoftTeamsBotId) {
@@ -220,6 +223,7 @@ export const superAdminServiceFactory = ({
updatedData.encryptedMicrosoftTeamsBotId = encryptedBotId; updatedData.encryptedMicrosoftTeamsBotId = encryptedBotId;
updatedData.microsoftTeamsBotId = undefined; updatedData.microsoftTeamsBotId = undefined;
microsoftTeamsSettingsUpdated = true;
} }
const updatedServerCfg = await serverCfgDAL.updateById(ADMIN_CONFIG_DB_UUID, updatedData); const updatedServerCfg = await serverCfgDAL.updateById(ADMIN_CONFIG_DB_UUID, updatedData);
@@ -228,7 +232,8 @@ export const superAdminServiceFactory = ({
if ( if (
updatedServerCfg.encryptedMicrosoftTeamsAppId && updatedServerCfg.encryptedMicrosoftTeamsAppId &&
updatedServerCfg.encryptedMicrosoftTeamsClientSecret && updatedServerCfg.encryptedMicrosoftTeamsClientSecret &&
updatedServerCfg.encryptedMicrosoftTeamsBotId updatedServerCfg.encryptedMicrosoftTeamsBotId &&
microsoftTeamsSettingsUpdated
) { ) {
const decryptWithRoot = kmsService.decryptWithRootKey(); const decryptWithRoot = kmsService.decryptWithRootKey();
decryptWithRoot(updatedServerCfg.encryptedMicrosoftTeamsBotId); // validate that we're able to decrypt the bot ID decryptWithRoot(updatedServerCfg.encryptedMicrosoftTeamsBotId); // validate that we're able to decrypt the bot ID
@@ -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) ![azure-app-registration-api-permissions](/images/platform/workflow-integrations/microsoft-teams-integration/azure-app-registration-api-permissions.png)
</Step> </Step>
<Step title="App new web application to the App Registration"> <Step title="Add a new web application to the App Registration">
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: 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://<your-infisical-instance-url>/organization/settings/oauth/callback`. Replace `<your-infisical-instance-url>` with the URL of your Infisical instance. `https://<your-infisical-instance-url>/organization/settings/oauth/callback`. Replace `<your-infisical-instance-url>` with the URL of your Infisical instance.
@@ -167,6 +167,9 @@ export const eventToNameMap: { [K in EventType]: string } = {
[EventType.DELETE_SECRET_ROTATION]: "Delete Secret Rotation", [EventType.DELETE_SECRET_ROTATION]: "Delete Secret Rotation",
[EventType.SECRET_ROTATION_ROTATE_SECRETS]: "Secret Rotation secrets rotated", [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]: [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_CREATE]:
"Create Microsoft Teams Workflow Integration", "Create Microsoft Teams Workflow Integration",
[EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE]: [EventType.MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE]:
@@ -165,6 +165,9 @@ export enum EventType {
DELETE_SECRET_ROTATION = "delete-secret-rotation", DELETE_SECRET_ROTATION = "delete-secret-rotation",
SECRET_ROTATION_ROTATE_SECRETS = "secret-rotation-rotate-secrets", 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_CREATE = "microsoft-teams-workflow-integration-create",
MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE = "microsoft-teams-workflow-integration-delete", MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_DELETE = "microsoft-teams-workflow-integration-delete",
MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_UPDATE = "microsoft-teams-workflow-integration-update", MICROSOFT_TEAMS_WORKFLOW_INTEGRATION_UPDATE = "microsoft-teams-workflow-integration-update",
@@ -22,7 +22,11 @@ type Props = {
const microsoftTeamsFormSchema = z.object({ const microsoftTeamsFormSchema = z.object({
slug: slugSchema({ min: 1, field: "Alias" }), 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() description: z.string().optional()
}); });