Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Merge origin/main into PAM-517

Andreyf0644bc070e9
diff --cc backend/src/ee/services/pam-folder/pam-folder-service.ts
index 3c486007b9,ca098b469e..0b5d4bf5f2
--- a/backend/src/ee/services/pam-folder/pam-folder-service.ts
+++ b/backend/src/ee/services/pam-folder/pam-folder-service.ts
@@@ -8,15 -18,18 +18,20 @@@ import
ResourcePermissionSub
} from "@app/ee/services/permission/resource-permission";
import { DatabaseErrorCode } from "@app/lib/error-codes";
- import { BadRequestError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
+ import { BadRequestError, ConflictError, DatabaseError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
+ import { logger } from "@app/lib/logger";
+import { TAlertServiceFactory } from "@app/services/alert/alert-service";
import { ActorType } from "@app/services/auth/auth-type";
import { TMembershipDALFactory } from "@app/services/membership/membership-dal";
import { TMembershipRoleDALFactory } from "@app/services/membership/membership-role-dal";
+ import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
+ import { NotificationType } from "@app/services/notification/notification-types";
+ import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
+ import { TUserDALFactory } from "@app/services/user/user-dal";
- import { PamProductRole, PamResourceRole } from "../pam/pam-enums";
+ import { PamFolderCallerAccess, PamProductRole, PamResourceRole } from "../pam/pam-enums";
import { getResourceIdsWithActions, TActorContext, verifyProductMembership } from "../pam/pam-permission";
+import { PAM_FOLDER_RESOURCE_TYPE } from "../pam-access-request/pam-access-request-events";
import { TPamAccessRequestServiceFactory } from "../pam-access-request/pam-access-request-service";
import { TPamFolderDALFactory } from "./pam-folder-dal";
import {
@@@ -31,12 -45,24 +47,25 @@@ type TPamFolderServiceFactoryDep =
pamFolderDAL: TPamFolderDALFactory;
membershipDAL: Pick<
TMembershipDALFactory,
- "create" | "find" | "delete" | "findResourceMembershipsForActor" | "transaction"
+ | "create"
+ | "find"
+ | "delete"
+ | "updateById"
+ | "findResourceMembershipsForActor"
+ | "lockResourceMembershipForActor"
+ | "transaction"
>;
membershipRoleDAL: Pick<TMembershipRoleDALFactory, "create" | "delete" | "find">;
- permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getResourcePermission">;
+ permissionService: Pick<
+ TPermissionServiceFactory,
+ "getOrgPermission" | "getProjectPermission" | "getResourcePermission"
+ >;
pamAccessRequestService: Pick<TPamAccessRequestServiceFactory, "cleanupFolderResources">;
+ userDAL: Pick<TUserDALFactory, "find" | "findById">;
+ userGroupMembershipDAL: Pick<TUserGroupMembershipDALFactory, "find">;
+ notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;
+ smtpService: Pick<TSmtpService, "sendMail">;
+ alertService: Pick<TAlertServiceFactory, "deleteAlertsForDeletedResource">;
};
export type TPamFolderServiceFactory = ReturnType<typeof pamFolderServiceFactory>;
@@@ -47,7 -73,10 +76,11 @@@ export const pamFolderServiceFactory =
membershipRoleDAL,
permissionService,
pamAccessRequestService,
+ userDAL,
+ userGroupMembershipDAL,
+ notificationService,
- smtpService
++ smtpService,
+ alertService
}: TPamFolderServiceFactoryDep) => {
const verifyMembership = (projectId: string, ctx: TActorContext) =>
verifyProductMembership(permissionService, projectId, ctx);
diff --cc backend/src/server/routes/index.ts
index 3fd772c69b,dc6ca82338..c3c4780c5e
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@@ -258,8 -258,8 +258,10 @@@ import { certManagerSignerAlertDALFacto
import { certManagerSignerAlertProviderFactory } from "@app/services/alert/providers/cert-manager-signer-alert-provider";
import { identityCredentialAlertDALFactory } from "@app/services/alert/providers/identity-credential-alert-dal";
import { identityCredentialAlertProviderFactory } from "@app/services/alert/providers/identity-credential-alert-provider";
+import { pamFolderAlertDALFactory } from "@app/services/alert/providers/pam-folder-alert-dal";
+import { pamFolderAlertProviderFactory } from "@app/services/alert/providers/pam-folder-alert-provider";
+ import { secretReminderAlertDALFactory } from "@app/services/alert/providers/secret-reminder-alert-dal";
+ import { secretReminderAlertProviderFactory } from "@app/services/alert/providers/secret-reminder-alert-provider";
import { announcementServiceFactory } from "@app/services/announcement/announcement-service";
import { appConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
import { appConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";
@@@ -3895,7 -3902,10 +3910,11 @@@ export const registerRoutes = async
membershipRoleDAL,
permissionService,
pamAccessRequestService,
+ userDAL,
+ userGroupMembershipDAL,
+ notificationService,
- smtpService
++ smtpService,
+ alertService
});
const pamDiscoverySourceDAL = pamDiscoverySourceDALFactory(db);
diff --cc frontend/src/hooks/api/alerts/types.ts
index f2ad2a4396,67fbbcde5c..4be68df5af
--- a/frontend/src/hooks/api/alerts/types.ts
+++ b/frontend/src/hooks/api/alerts/types.ts
@@@ -5,31 -4,14 +5,34 @@@ import { CertSource } from "@app/hooks/
export enum AlertResourceType {
IdentityAuthentication = "identity.authentication",
- PamFolder = "pam.folder"
++ PamFolder = "pam.folder",
+ SecretReminder = "secret.reminder"
}
export enum AlertEventType {
IdentityAuthenticationExpiry = "identity.authentication.expiry",
- IdentityAuthMethodChanged = "identity.authentication.auth-method-changed"
+ IdentityAuthMethodChanged = "identity.authentication.auth-method-changed",
+ PamAccessRequested = "pam.folder.access-requested",
+ PamAccessRequestApproved = "pam.folder.access-request-approved",
+ PamAccessRequestDenied = "pam.folder.access-request-denied",
+ PamAccessRequestBypassed = "pam.folder.access-request-bypassed"
}
+export const ALERT_RESOURCE_EVENT_TYPES: Record<AlertResourceType, AlertEventType[]> = {
+ [AlertResourceType.IdentityAuthentication]: [
+ AlertEventType.IdentityAuthenticationExpiry,
+ AlertEventType.IdentityAuthMethodChanged
+ ],
+ [AlertResourceType.PamFolder]: [
+ AlertEventType.PamAccessRequested,
+ AlertEventType.PamAccessRequestApproved,
+ AlertEventType.PamAccessRequestDenied,
+ AlertEventType.PamAccessRequestBypassed
- ]
++ ],
++ // Reminder alerts are edited from the secret's reminder form, not the generic alert form.
++ [AlertResourceType.SecretReminder]: []
+};
+
export enum AlertChannelType {
Email = "email",
Slack = "slack",
@@@ -84,7 -67,7 +88,8 @@@ export const MAX_CERTIFICATE_ALERT_FILT
export const ALERT_RESOURCE_TYPE_LABELS: Record<AlertResourceType, string> = {
[AlertResourceType.IdentityAuthentication]: "Machine Identity Authentication",
- [AlertResourceType.PamFolder]: "PAM Folder"
++ [AlertResourceType.PamFolder]: "PAM Folder",
+ [AlertResourceType.SecretReminder]: "Secret Reminder"
};
export const ALERT_EVENT_TYPE_LABELS: Record<AlertEventType, string> = {
diff --cc frontend/src/views/Alerts/AlertForm.tsx
index ba6085da99,b27386e787..e78ce910ea
--- a/frontend/src/views/Alerts/AlertForm.tsx
+++ b/frontend/src/views/Alerts/AlertForm.tsx
@@@ -35,10 -34,9 +35,10 @@@ import
MIN_ALERT_BEFORE_DAYS,
parseAlertBeforeDays,
TAlert,
+ TAlertChannelPaywall,
TAlertForm,
- TChannelForm,
toAlertBefore,
+ toChannelForm,
toChannelInput,
useCreateAlert,
useUpdateAlert
@@@ -72,24 -64,8 +72,9 @@@ const AGENT_VAULT_ALERT_NAME_PLACEHOLDE
};
const DEFAULT_EVENT_TYPE = AlertEventType.IdentityAuthenticationExpiry;
- const toChannelForm = (channel: TAlert["channels"][number]): TChannelForm => ({
- id: channel.id,
- channelType: channel.channelType,
- name: channel.name,
- enabled: channel.enabled,
- recipients: channel.recipients,
- webhookUrl: "",
- url: (channel.config.url as string) ?? "",
- signingSecret: "",
- integrationKey: "",
- hasWebhookUrl: Boolean(channel.config.hasWebhookUrl),
- hasSigningSecret: Boolean(channel.config.hasSigningSecret),
- hasIntegrationKey: Boolean(channel.config.hasIntegrationKey)
- });
-
const buildFormDefaults = (
alert: TAlert | undefined,
+ resourceType: AlertResourceType,
defaultEventType: AlertEventType,
defaultName: string
): TAlertForm => {
diff --cc frontend/src/views/Alerts/ChannelsField.tsx
index 888efec88f,48cf4bb639..9717e87594
--- a/frontend/src/views/Alerts/ChannelsField.tsx
+++ b/frontend/src/views/Alerts/ChannelsField.tsx
@@@ -6,9 -5,8 +6,9 @@@ import
ALERT_CHANNEL_TYPE_LABELS,
AlertChannelType,
AlertPrincipalType,
+ TAlertChannelPaywall,
- TAlertForm,
- TChannelForm
+ TChannelForm,
+ TChannelsForm
} from "@app/hooks/api/alerts";
import { AddChannelMenu } from "./AddChannelMenu";