mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-02 22:25:44 +00:00
requested changes
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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()
|
||||
})
|
||||
|
||||
@@ -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"
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user