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
address carlos reviews
Andreyeccfb79defb7
diff --git a/backend/src/services/alert/providers/pam-folder-alert-dal.ts b/backend/src/services/alert/providers/pam-folder-alert-dal.tsindex 63782c0cc2..aae1ab8543 100644--- a/backend/src/services/alert/providers/pam-folder-alert-dal.ts+++ b/backend/src/services/alert/providers/pam-folder-alert-dal.ts@@ -40,9 +40,10 @@ export const pamFolderAlertDALFactory = (db: TDbClient) => {const requests = (await (tx || db)(TableName.ApprovalRequests).whereIn("id", requestIds).where({ organizationId: orgId, projectId, type: ApprovalPolicyType.PamAccess })- .select("id", "requesterName", "requesterEmail", "machineIdentityId", "requestData")+ .select("id", "requesterId", "requesterName", "requesterEmail", "machineIdentityId", "requestData").orderBy("createdAt", "asc")) as {id: string;+ requesterId: string | null;requesterName: string;requesterEmail: string;machineIdentityId: string | null;diff --git a/backend/src/services/alert/providers/pam-folder-alert-provider.ts b/backend/src/services/alert/providers/pam-folder-alert-provider.tsindex 30c8ba9b6e..f5d043c03a 100644--- a/backend/src/services/alert/providers/pam-folder-alert-provider.ts+++ b/backend/src/services/alert/providers/pam-folder-alert-provider.ts@@ -15,7 +15,7 @@ import {} from "@app/ee/services/permission/resource-permission";import { getConfig } from "@app/lib/config/env";import { BadRequestError, NotFoundError } from "@app/lib/errors";-import { formatDuration } from "@app/lib/ms";+import { formatDuration, ms } from "@app/lib/ms";import { ApprovalRequestApprovalDecision } from "@app/services/approval-policy/approval-policy-enums";import { AlertChannelType, TAlertPayload, TAlertSeverity } from "../alert-channel-types";@@ -62,9 +62,14 @@ const DECISION_BY_EVENT: Partial<Record<PamAccessRequestEvent, ApprovalRequestAptype TPamAccessRequestTarget = {requestId: string;+ folderId: string;folderName: string;+ accountId: string | null;accountName: string | null;requesterName: string;+ requesterEmail: string | null;+ requesterUserId: string | null;+ requesterMachineIdentityId: string | null;requesterLabel: string;accessType: PamAccessType;duration?: string;@@ -92,6 +97,11 @@ const toRequesterLabel = ({return requesterEmail ? `${requesterName} (${requesterEmail})` : requesterName;};+const toDurationSeconds = (duration?: string) => {+ const durationMs = duration ? ms(duration) : NaN;+ return Number.isFinite(durationMs) ? Math.round(durationMs / 1000) : null;+};+const describeTarget = (eventType: PamAccessRequestEvent, target: TPamAccessRequestTarget) => {const account = target.accountName ? `account '${target.accountName}'` : "a deleted account";const access = `${target.accessType === PamAccessType.Credential ? "credential access" : "access"} to ${account} in folder '${target.folderName}'`;@@ -158,9 +168,14 @@ export const pamFolderAlertProviderFactory = ({return requests.map((request) => ({requestId: request.id,+ folderId,folderName: folder.name,+ accountId: request.inputs.accountId ?? null,accountName: accountNameById.get(request.inputs.accountId ?? "") ?? null,requesterName: request.requesterName,+ requesterEmail: request.requesterEmail || null,+ requesterUserId: request.requesterId,+ requesterMachineIdentityId: request.machineIdentityId,requesterLabel: toRequesterLabel(request),accessType: request.inputs.accessType ?? PamAccessType.Session,duration: request.inputs.duration,@@ -204,7 +219,23 @@ export const pamFolderAlertProviderFactory = ({...(target.bypassReason && target.bypassReason !== target.reason? [{ label: "Break-Glass Reason", value: target.bypassReason }]: [])- ]+ ],+ resource: {+ id: target.requestId,+ folderId: target.folderId,+ folderName: target.folderName,+ accountId: target.accountId,+ accountName: target.accountName,+ requesterName: target.requesterName,+ requesterEmail: target.requesterEmail,+ requesterUserId: target.requesterUserId,+ requesterMachineIdentityId: target.requesterMachineIdentityId,+ accessType: target.accessType,+ durationSeconds: toDurationSeconds(target.duration),+ reason: target.reason ?? null,+ reviewerComment: target.comment,+ breakGlassReason: target.bypassReason+ }}))};};@@ -279,6 +310,7 @@ export const pamFolderAlertProviderFactory = ({targetId: (target) => target.requestId,assertPermission,assertResourceInScope,- assertChannelTypesAllowed+ assertChannelTypesAllowed,+ recipientPolicy: { allowEmailAddresses: true }};};diff --git a/docs/documentation/platform/pam/access-requests/overview.mdx b/docs/documentation/platform/pam/access-requests/overview.mdxindex c975f1030e..e4ee0a427d 100644--- a/docs/documentation/platform/pam/access-requests/overview.mdx+++ b/docs/documentation/platform/pam/access-requests/overview.mdx@@ -181,10 +181,6 @@ An alert notifies your team about access requests in a folder through email, SlaA Folder Admin adds and manages alerts by selecting **Alerts** on the folder's **Approvals** tab. A folder can have one alert per event, and Slack, webhook, and PagerDuty channels need an Enterprise plan.-<Note>- Slack notifications set up on a folder before alerts were available keep posting. You can remove them on the **Approvals** tab, but you can't add or edit them.-</Note>-## Requests from AI agentsAn agent requests access on the same terms as a person, but from the [CLI](/cli/reference#pam-agentic-access) instead of the dashboard. A request from an agent running as a machine identity shows the identity's name in place of a requester's email; one from an agent you started yourself is filed under your own name.diff --git a/frontend/src/hooks/api/alerts/types.ts b/frontend/src/hooks/api/alerts/types.tsindex 4be68df5af..a9fc0eb277 100644--- a/frontend/src/hooks/api/alerts/types.ts+++ b/frontend/src/hooks/api/alerts/types.ts@@ -33,6 +33,9 @@ export const ALERT_RESOURCE_EVENT_TYPES: Record<AlertResourceType, AlertEventTyp[AlertResourceType.SecretReminder]: []};+// Resource types whose provider accepts plain email addresses as email channel recipients+export const ALERT_RESOURCE_TYPES_WITH_EMAIL_ADDRESSES: string[] = [AlertResourceType.PamFolder];+export enum AlertChannelType {Email = "email",Slack = "slack",diff --git a/frontend/src/views/Alerts/ChannelCard.tsx b/frontend/src/views/Alerts/ChannelCard.tsxindex 9af850e102..8dd1c13480 100644--- a/frontend/src/views/Alerts/ChannelCard.tsx+++ b/frontend/src/views/Alerts/ChannelCard.tsx@@ -21,6 +21,7 @@ import {import { useScopeVariant } from "@app/hooks";import {ALERT_CHANNEL_TYPE_LABELS,+ ALERT_RESOURCE_TYPES_WITH_EMAIL_ADDRESSES,AlertChannelType,TAlertChannelRecipient,TChannelsForm,@@ -215,6 +216,9 @@ export const ChannelCard = ({) : (<ChannelRecipientsFieldprojectId={projectId}+ allowEmailAddresses={ALERT_RESOURCE_TYPES_WITH_EMAIL_ADDRESSES.includes(+ resourceType+ )}value={field.value ?? []}onChange={field.onChange}isError={Boolean(channelErrors?.recipients)}diff --git a/frontend/src/views/Alerts/ChannelRecipientsField.tsx b/frontend/src/views/Alerts/ChannelRecipientsField.tsxindex a1adceea9d..2cbeba24bf 100644--- a/frontend/src/views/Alerts/ChannelRecipientsField.tsx+++ b/frontend/src/views/Alerts/ChannelRecipientsField.tsx@@ -1,8 +1,9 @@import { useEffect, useRef, useState } from "react";-import { UserIcon, UsersIcon } from "lucide-react";+import { LucideIcon, MailIcon, UserIcon, UsersIcon } from "lucide-react";import { FilterableSelect } from "@app/components/v3";import { useOrganization } from "@app/context";+import { isValidEmail } from "@app/helpers/email";import {useGetOrganizationGroups,useGetOrgUsers,@@ -15,7 +16,7 @@ type RecipientOption = {principalType: AlertPrincipalType;principalId: string;label: string;- groupLabel: "Project" | "Users" | "Groups";+ groupLabel: "Project" | "Users" | "Groups" | "Emails";};const projectMembersOption = (projectId: string): RecipientOption => ({@@ -46,21 +47,26 @@ const buildOptions = (}))];-const formatOptionLabel = (option: RecipientOption) => (- <span className="flex items-center gap-2">- {option.principalType !== AlertPrincipalType.User ? (- <UsersIcon className="size-3.5 text-muted" />- ) : (- <UserIcon className="size-3.5 text-muted" />- )}- {option.label}- </span>-);+const RECIPIENT_ICONS: Partial<Record<AlertPrincipalType, LucideIcon>> = {+ [AlertPrincipalType.User]: UserIcon,+ [AlertPrincipalType.Email]: MailIcon+};++const formatOptionLabel = (option: RecipientOption) => {+ const Icon = RECIPIENT_ICONS[option.principalType] ?? UsersIcon;+ return (+ <span className="flex items-center gap-2">+ <Icon className="size-3.5 text-muted" />+ {option.label}+ </span>+ );+};type SelectProps = {value: TAlertChannelRecipient[];onChange: (recipients: TAlertChannelRecipient[]) => void;isError?: boolean;+ allowEmailAddresses?: boolean;};const RecipientSelect = ({@@ -68,10 +74,12 @@ const RecipientSelect = ({labelledOptions,value,onChange,- isError+ isError,+ allowEmailAddresses}: SelectProps & { options: RecipientOption[]; labelledOptions?: RecipientOption[] }) => {const containerRef = useRef<HTMLDivElement>(null);const [menuPortalTarget, setMenuPortalTarget] = useState<HTMLElement | null>(null);+ const [inputValue, setInputValue] = useState("");useEffect(() => {setMenuPortalTarget(containerRef.current?.closest<HTMLElement>('[role="dialog"]') ?? null);@@ -80,6 +88,19 @@ const RecipientSelect = ({const byKey = new Map((labelledOptions ?? options).map((o) => [`${o.principalType}-${o.principalId}`, o]));+ const email = inputValue.trim().toLowerCase();+ const canAddEmail =+ allowEmailAddresses &&+ isValidEmail(email) &&+ !options.some((option) => option.label.toLowerCase() === email) &&+ !value.some((recipient) => recipient.principalId === email);+ const emailOption: RecipientOption = {+ principalType: AlertPrincipalType.Email,+ principalId: email,+ label: email,+ groupLabel: "Emails"+ };+const selected = value.map((recipient): RecipientOption =>byKey.get(`${recipient.principalType}-${recipient.principalId}`) ?? {@@ -94,8 +115,11 @@ const RecipientSelect = ({<div ref={containerRef}><FilterableSelect<RecipientOption>isMulti- placeholder="Add users or groups..."- options={options}+ placeholder={+ allowEmailAddresses ? "Add users, groups, or emails..." : "Add users or groups..."+ }+ options={canAddEmail ? [...options, emailOption] : options}+ onInputChange={setInputValue}value={selected}isError={isError}groupBy="groupLabel"