mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 18:15:53 +00:00
misc: implemented secret approval request and project audit logs
This commit is contained in:
@@ -173,7 +173,9 @@ export enum EventType {
|
||||
ATTEMPT_CREATE_SLACK_INTEGRATION = "attempt-create-slack-integration",
|
||||
GET_SLACK_INTEGRATION = "get-slack-integration",
|
||||
UPDATE_SLACK_INTEGRATION = "update-slack-integration",
|
||||
DELETE_SLACK_INTEGRATION = "delete-slack-integration"
|
||||
DELETE_SLACK_INTEGRATION = "delete-slack-integration",
|
||||
GET_PROJECT_SLACK_CONFIG = "get-project-slack-config",
|
||||
UPDATE_PROJECT_SLACK_CONFIG = "update-project-slack-config"
|
||||
}
|
||||
|
||||
interface UserActorMetadata {
|
||||
@@ -1481,6 +1483,25 @@ interface GetSlackIntegration {
|
||||
};
|
||||
}
|
||||
|
||||
interface UpdateProjectSlackConfig {
|
||||
type: EventType.UPDATE_PROJECT_SLACK_CONFIG;
|
||||
metadata: {
|
||||
id: string;
|
||||
slackIntegrationId: string;
|
||||
isAccessRequestNotificationEnabled: boolean;
|
||||
accessRequestChannels: string;
|
||||
isSecretRequestNotificationEnabled: boolean;
|
||||
secretRequestChannels: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface GetProjectSlackConfig {
|
||||
type: EventType.GET_PROJECT_SLACK_CONFIG;
|
||||
metadata: {
|
||||
id: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type Event =
|
||||
| GetSecretsEvent
|
||||
| GetSecretEvent
|
||||
@@ -1615,4 +1636,6 @@ export type Event =
|
||||
| AttemptCreateSlackIntegration
|
||||
| UpdateSlackIntegration
|
||||
| DeleteSlackIntegration
|
||||
| GetSlackIntegration;
|
||||
| GetSlackIntegration
|
||||
| UpdateProjectSlackConfig
|
||||
| GetProjectSlackConfig;
|
||||
|
||||
@@ -2,8 +2,8 @@ import { TSecretApprovalRequests } from "@app/db/schemas";
|
||||
import { getConfig } from "@app/lib/config/env";
|
||||
import { TKmsServiceFactory } from "@app/services/kms/kms-service";
|
||||
import { TProjectDALFactory } from "@app/services/project/project-dal";
|
||||
import { TProjectSlackConfigDALFactory } from "@app/services/slack/project-slack-config-dal";
|
||||
import { triggerSlackNotification } from "@app/services/slack/slack-fns";
|
||||
import { TSlackIntegrationDALFactory } from "@app/services/slack/slack-integration-dal";
|
||||
import { SlackTriggerFeature } from "@app/services/slack/slack-types";
|
||||
import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
|
||||
import { TUserDALFactory } from "@app/services/user/user-dal";
|
||||
@@ -23,9 +23,9 @@ type TTriggerSecretApprovalSlackNotif = {
|
||||
projectId: string;
|
||||
projectDAL: Pick<TProjectDALFactory, "findById" | "findProjectWithOrg">;
|
||||
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
|
||||
projectSlackConfigDAL: Pick<TProjectSlackConfigDALFactory, "getIntegrationDetailsByProject">;
|
||||
secretApprovalRequest: TSecretApprovalRequests;
|
||||
secretPath: string;
|
||||
slackIntegrationDAL: Pick<TSlackIntegrationDALFactory, "findOne">;
|
||||
userDAL: Pick<TUserDALFactory, "findById">;
|
||||
};
|
||||
|
||||
@@ -34,7 +34,7 @@ export const triggerSecretApprovalSlackNotif = async ({
|
||||
projectDAL,
|
||||
kmsService,
|
||||
secretApprovalRequest,
|
||||
slackIntegrationDAL,
|
||||
projectSlackConfigDAL,
|
||||
userDAL,
|
||||
environment,
|
||||
secretPath
|
||||
@@ -74,8 +74,8 @@ export const triggerSecretApprovalSlackNotif = async ({
|
||||
projectId,
|
||||
projectDAL,
|
||||
kmsService,
|
||||
slackIntegrationDAL,
|
||||
payloadMessage: messageBody,
|
||||
projectSlackConfigDAL,
|
||||
payloadBlocks,
|
||||
feature: SlackTriggerFeature.SECRET_APPROVAL
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ import {
|
||||
} from "@app/services/secret-v2-bridge/secret-v2-bridge-fns";
|
||||
import { TSecretVersionV2DALFactory } from "@app/services/secret-v2-bridge/secret-version-dal";
|
||||
import { TSecretVersionV2TagDALFactory } from "@app/services/secret-v2-bridge/secret-version-tag-dal";
|
||||
import { TSlackIntegrationDALFactory } from "@app/services/slack/slack-integration-dal";
|
||||
import { TProjectSlackConfigDALFactory } from "@app/services/slack/project-slack-config-dal";
|
||||
import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
|
||||
import { TUserDALFactory } from "@app/services/user/user-dal";
|
||||
|
||||
@@ -105,7 +105,7 @@ type TSecretApprovalRequestServiceFactoryDep = {
|
||||
secretVersionV2BridgeDAL: Pick<TSecretVersionV2DALFactory, "insertMany" | "findLatestVersionMany">;
|
||||
secretVersionTagV2BridgeDAL: Pick<TSecretVersionV2TagDALFactory, "insertMany">;
|
||||
secretApprovalPolicyDAL: Pick<TSecretApprovalPolicyDALFactory, "findById">;
|
||||
slackIntegrationDAL: Pick<TSlackIntegrationDALFactory, "findOne">;
|
||||
projectSlackConfigDAL: Pick<TProjectSlackConfigDALFactory, "getIntegrationDetailsByProject">;
|
||||
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
|
||||
};
|
||||
|
||||
@@ -134,8 +134,8 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
secretV2BridgeDAL,
|
||||
secretVersionV2BridgeDAL,
|
||||
secretVersionTagV2BridgeDAL,
|
||||
slackIntegrationDAL,
|
||||
licenseService
|
||||
licenseService,
|
||||
projectSlackConfigDAL
|
||||
}: TSecretApprovalRequestServiceFactoryDep) => {
|
||||
const requestCount = async ({ projectId, actor, actorId, actorOrgId, actorAuthMethod }: TApprovalRequestCountDTO) => {
|
||||
if (actor === ActorType.SERVICE) throw new BadRequestError({ message: "Cannot use service token" });
|
||||
@@ -1080,8 +1080,8 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectDAL,
|
||||
kmsService,
|
||||
secretApprovalRequest,
|
||||
slackIntegrationDAL,
|
||||
userDAL
|
||||
userDAL,
|
||||
projectSlackConfigDAL
|
||||
});
|
||||
|
||||
await sendApprovalEmailsFn({
|
||||
@@ -1354,8 +1354,8 @@ export const secretApprovalRequestServiceFactory = ({
|
||||
projectDAL,
|
||||
kmsService,
|
||||
secretApprovalRequest,
|
||||
slackIntegrationDAL,
|
||||
userDAL
|
||||
userDAL,
|
||||
projectSlackConfigDAL
|
||||
});
|
||||
|
||||
await sendApprovalEmailsFn({
|
||||
|
||||
Reference in New Issue
Block a user