Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat(pam): gate slack approval notifications behind plan flag
bernie-g77bcf47e40a4
diff --git a/backend/src/ee/services/license/license-fns.ts b/backend/src/ee/services/license/license-fns.tsindex 2082c05baf..57a2d4d3ff 100644--- a/backend/src/ee/services/license/license-fns.ts+++ b/backend/src/ee/services/license/license-fns.ts@@ -118,6 +118,7 @@ export const getDefaultOnPremFeatures = (): TFeatureSet => ({kmip: false,gateway: false,gatewayPool: false,+ pamSlackNotifications: false,sshHostGroups: false,secretScanning: false,enterpriseSecretSyncs: false,diff --git a/backend/src/ee/services/license/license-types.ts b/backend/src/ee/services/license/license-types.tsindex ebc5c30c97..e119af2d3c 100644--- a/backend/src/ee/services/license/license-types.ts+++ b/backend/src/ee/services/license/license-types.ts@@ -90,6 +90,7 @@ export type TFeatureSet = {kmip: false;gateway: false;gatewayPool: false;+ pamSlackNotifications: boolean;sshHostGroups: false;secretScanning: false;enterpriseSecretSyncs: false;diff --git a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts b/backend/src/ee/services/pam-access-request/pam-access-request-service.tsindex 764d9af466..c51cbcdde7 100644--- a/backend/src/ee/services/pam-access-request/pam-access-request-service.ts+++ b/backend/src/ee/services/pam-access-request/pam-access-request-service.ts@@ -5,6 +5,7 @@ import { RESOURCE_SCOPE, ResourceType, TApprovalRequestGrants } from "@app/db/scimport { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";import { TGroupDALFactory } from "@app/ee/services/group/group-dal";import { TUserGroupMembershipDALFactory } from "@app/ee/services/group/user-group-membership-dal";+import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";import {ResourcePermissionPamResourceActions,@@ -135,6 +136,7 @@ type TPamAccessRequestServiceFactoryDep = {workflowIntegrationDAL: Pick<TWorkflowIntegrationDALFactory, "find">;slackIntegrationDAL: Pick<TSlackIntegrationDALFactory, "findByIdWithWorkflowIntegrationDetails">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;+ licenseService: Pick<TLicenseServiceFactory, "getPlan">;};export type TPamAccessRequestServiceFactory = ReturnType<typeof pamAccessRequestServiceFactory>;@@ -164,7 +166,8 @@ export const pamAccessRequestServiceFactory = ({pamFolderNotificationConfigDAL,workflowIntegrationDAL,slackIntegrationDAL,- kmsService+ kmsService,+ licenseService}: TPamAccessRequestServiceFactoryDep) => {const findFolderPolicy = async (folderId: string) => {const policy = await approvalPolicyDAL.findOne({@@ -200,6 +203,9 @@ export const pamAccessRequestServiceFactory = ({notification: TNotification;}) => {try {+ const plan = await licenseService.getPlan(orgId);+ if (!plan.pamSlackNotifications) return;+const configs = await pamFolderNotificationConfigDAL.findByFolderIdWithIntegration(folderId);const targets = getSlackSendTargets(configs, event);@@ -451,6 +457,14 @@ export const pamAccessRequestServiceFactory = ({// policy branches below; several of those branches return early.if (notificationConfigs !== undefined) {if (notificationConfigs.length > 0) {+ const plan = await licenseService.getPlan(ctx.actorOrgId);+ if (!plan.pamSlackNotifications) {+ throw new BadRequestError({+ message:+ "Failed to save notification configuration due to plan restriction. Upgrade plan to configure Slack notifications for PAM approvals."+ });+ }+const integrationIds = [...new Set(notificationConfigs.map((c) => c.workflowIntegrationId))];const integrations = await workflowIntegrationDAL.find({ $in: { id: integrationIds } });const integrationById = new Map(integrations.map((i) => [i.id, i]));diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex 417302ae80..d95b98228a 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -169,6 +169,8 @@ No migration, no router or response-schema change (beyond `policyRules` for gate## Approval Chat Notifications (Slack)+Gated by the `pamSlackNotifications` license plan flag (off by default, enabled per org from the license server): saves of `notificationConfigs` are rejected and sends are skipped when the plan lacks it, and the frontend hides the Notifications card via `subscription.pamSlackNotifications`.+Folder-level, not project-level: each folder's Approvals tab can attach org `workflow_integrations` (Slack only for now) with channels and subscribed events, stored in `pam_folder_notification_configs` (`channels` and `events` are jsonb; channel objects are `{ id, name }` so the UI renders names without needing the org-gated Slack channel-list API). This intentionally does NOT use `project_slack_configs` or `triggerWorkflowIntegrationNotification`, which resolve config by projectId (the single PAM project would make the config org-wide).Flow: `createRequest` and `reviewRequest` in `pam-access-request-service.ts` call `triggerFolderSlackNotifications`, which filters configs via the pure `getSlackSendTargets` (`pam-access-request-fns.ts`) and sends through the shared `sendSlackNotification` (`services/slack/slack-fns.ts`). Events are `PamNotificationEvent` in `pam/pam-enums.ts` (mirrored in the frontend enums file). New `TriggerFeature.PAM_*` variants carry the payloads; their Slack templates live in `buildSlackPayload`. All sends are fire-and-forget (never fail the request flow). Config writes ride the existing PUT approval-configuration endpoint (undefined `notificationConfigs` leaves configs unchanged; empty array deletes all). Additional chat platforms can be added later by branching on `integration` in the trigger helper, the table needs no change.diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex ba9bbdccba..8ff69b8d7e 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -1843,7 +1843,8 @@ export const registerRoutes = async (pamFolderNotificationConfigDAL,workflowIntegrationDAL,slackIntegrationDAL,- kmsService+ kmsService,+ licenseService});const pamFolderService = pamFolderServiceFactory({diff --git a/frontend/src/hooks/api/subscriptions/types.ts b/frontend/src/hooks/api/subscriptions/types.tsindex 2c75be35e6..bd3a1ed0f0 100644--- a/frontend/src/hooks/api/subscriptions/types.ts+++ b/frontend/src/hooks/api/subscriptions/types.ts@@ -59,6 +59,7 @@ export type SubscriptionPlan = {instanceUserManagement: boolean;gateway: boolean;gatewayPool: boolean;+ pamSlackNotifications: boolean;externalKms: boolean;pkiEst: boolean;pkiAcme: boolean;diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsxindex e17926df83..7fda2e5415 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx@@ -33,7 +33,7 @@ import {TooltipTrigger} from "@app/components/v3";import { Skeleton } from "@app/components/v3/generic/Skeleton";-import { useOrganization } from "@app/context";+import { useOrganization, useSubscription } from "@app/context";import {getUserTablePreference,PreferenceKey,@@ -97,6 +97,8 @@ type Props = {export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {const { currentOrg } = useOrganization();+ const { subscription } = useSubscription();+ const isPamSlackEnabled = Boolean(subscription?.pamSlackNotifications);const { data: config, isLoading } = useGetPamApprovalConfig(folderId);const { data: orgUsers } = useGetOrgUsers(currentOrg.id);const { data: orgGroups } = useGetOrganizationGroups(currentOrg.id);@@ -249,9 +251,11 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {};const handleSave = () => {- const hasIncompleteConfig = notificationConfigs.some(- (c) => !c.workflowIntegrationId || c.channels.length === 0 || c.events.length === 0- );+ const hasIncompleteConfig =+ isPamSlackEnabled &&+ notificationConfigs.some(+ (c) => !c.workflowIntegrationId || c.channels.length === 0 || c.events.length === 0+ );if (hasIncompleteConfig) {createNotification({type: "error",@@ -261,7 +265,12 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {}setConfig.mutate(- { folderId, steps: [{ approvers }], notificationConfigs },+ {+ folderId,+ steps: [{ approvers }],+ // undefined leaves server-side configs untouched when the plan doesn't include the feature+ notificationConfigs: isPamSlackEnabled ? notificationConfigs : undefined+ },{onSuccess: () => {createNotification({ type: "success", text: "Approval configuration saved" });@@ -377,11 +386,13 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {</CardContent></Card>- <FolderNotificationsSection- configs={notificationConfigs}- integrationSlugById={integrationSlugById}- onChange={setNotificationConfigs}- />+ {isPamSlackEnabled && (+ <FolderNotificationsSection+ configs={notificationConfigs}+ integrationSlugById={integrationSlugById}+ onChange={setNotificationConfigs}+ />+ )}<Card><CardHeader className="border-b">