Skip to content

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

misc: addressed feedback

Sheen Capadngana353a4f86ea1
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.ts
index 32a205b77e..7a5d8909ea 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
@@ -277,7 +277,7 @@ export const pamAccessRequestServiceFactory = ({
type: approved ? TriggerFeature.PAM_ACCESS_REQUEST_APPROVED : TriggerFeature.PAM_ACCESS_REQUEST_DENIED,
payload: {
requesterFullName: params.requesterName || "Unknown",
- requesterEmail: params.requesterEmail || "",
+ requesterEmail: params.requesterEmail || "Machine Identity",
accountName: params.accountName ?? "a PAM account",
folderName: folder?.name ?? "",
comment: params.comment,
@@ -1276,7 +1276,11 @@ export const pamAccessRequestServiceFactory = ({
);
const attrs = grant.attributes as { accountId?: string } | null;
- if (attrs?.accountId) {
+ // granteeUserId is SET NULL when the grantee user is deleted, so an orphaned grant has neither
+ // actor column. Sweeping on a null userId would match every machine identity session on the
+ // account (they carry userId null), so skip the sweep when there is no actor to scope it to.
+ const hasGrantee = Boolean(grant.granteeMachineIdentityId || grant.granteeUserId);
+ if (attrs?.accountId && hasGrantee) {
// Cover both active and starting sessions; a session mid-handshake would otherwise slip past
// revocation and go live. terminateSessionById flips the row, and the ALPN signal cuts the live
// tunnel, since neither the gateway nor the web-access loop watches the status column.
@@ -1287,7 +1291,7 @@ export const pamAccessRequestServiceFactory = ({
// with a null userId, so filter on whichever the grant was issued to.
...(grant.granteeMachineIdentityId
? { identityId: grant.granteeMachineIdentityId }
- : { userId: grant.granteeUserId ?? null }),
+ : { userId: grant.granteeUserId }),
$in: { status: [PamSessionStatus.Active, PamSessionStatus.Starting] }
},
{ tx }
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
index 9597949de1..af72a52a06 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderApprovalsTab.tsx
@@ -57,6 +57,7 @@ import { useGetOrgUsers } from "@app/hooks/api/users/queries";
import { AccountPlatformIcon } from "../../components/AccountPlatformIcon";
import { getRequestStatusInfo, isGrantActive } from "../../components/approvalRequestStatus";
+import { getRequesterSubtitle } from "../../components/requesterDisplay";
import { FolderNotificationsSection } from "./FolderNotificationsSection";
type ApproverEntry = { type: PamApproverType; id: string };
@@ -462,7 +463,9 @@ export const FolderApprovalsTab = ({ folderId, onDirtyChange }: Props) => {
<TableCell className="h-[50px]">
<div className="flex flex-col">
<span className="text-sm font-medium">{request.requesterName}</span>
- <span className="text-xs text-muted">{request.requesterEmail}</span>
+ <span className="text-xs text-muted">
+ {getRequesterSubtitle(request)}
+ </span>
</div>
</TableCell>
<TableCell className="text-sm">
diff --git a/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx b/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx
index 7dd0df69e4..d6552f660e 100644
--- a/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx
+++ b/frontend/src/pages/pam/PamApprovalRequestsPage/PamApprovalRequestsPage.tsx
@@ -43,6 +43,7 @@ import { ProjectType } from "@app/hooks/api/projects/types";
import { AccountPlatformIcon } from "../components/AccountPlatformIcon";
import { getRequestStatusInfo } from "../components/approvalRequestStatus";
import { formatDuration } from "../components/formatDuration";
+import { getRequesterSubtitle } from "../components/requesterDisplay";
import { ApprovalRequestDetailSheet } from "./components/ApprovalRequestDetailSheet";
const RequestRow = ({
@@ -60,9 +61,7 @@ const RequestRow = ({
<TableCell className="h-[50px]">
<div className="flex flex-col">
<span className="text-sm">{request.requesterName}</span>
- <span className="text-xs text-muted">
- {request.machineIdentityId ? "Machine Identity" : request.requesterEmail}
- </span>
+ <span className="text-xs text-muted">{getRequesterSubtitle(request)}</span>
</div>
</TableCell>
<TableCell className="text-sm">
diff --git a/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx b/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
index 6df8970ca4..e3e4333ef2 100644
--- a/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
+++ b/frontend/src/pages/pam/PamApprovalRequestsPage/components/ApprovalRequestDetailSheet.tsx
@@ -28,6 +28,7 @@ import { AccountPlatformIcon } from "../../components/AccountPlatformIcon";
import { getRequestStatusInfo, isGrantActive } from "../../components/approvalRequestStatus";
import { formatDuration } from "../../components/formatDuration";
import { PamDetailSheet } from "../../components/PamDetailSheet";
+import { isMachineIdentityRequest } from "../../components/requesterDisplay";
type Props = {
request: TPamAccessRequest | null;
@@ -117,8 +118,7 @@ export const ApprovalRequestDetailSheet = ({ request, isOpen, onOpenChange }: Pr
typeBadge={status.label}
metadata={[
{ label: "Requester", value: request?.requesterName ?? "-" },
- // Machine identities have no email; label the actor kind instead
- request?.machineIdentityId
+ request && isMachineIdentityRequest(request)
? { label: "Actor", value: "Machine Identity" }
: { label: "Email", value: request?.requesterEmail ?? "-" },
{ label: "Folder", value: request?.folderName ?? "-" },
diff --git a/frontend/src/pages/pam/components/requesterDisplay.ts b/frontend/src/pages/pam/components/requesterDisplay.ts
new file mode 100644
index 0000000000..e4d24a91ca
--- /dev/null
+++ b/frontend/src/pages/pam/components/requesterDisplay.ts
@@ -0,0 +1,15 @@
+import { TPamAccessRequest } from "@app/hooks/api/pam/types";
+
+type RequesterFields = Pick<
+ TPamAccessRequest,
+ "machineIdentityId" | "requesterId" | "requesterEmail"
+>;
+
+// `machineIdentityId` is SET NULL when the identity is deleted, so a machine-raised request ends up
+// with neither actor link and an empty email. Treat that shape as a machine too, rather than
+// rendering a blank line where a human's email would be.
+export const isMachineIdentityRequest = (request: RequesterFields) =>
+ Boolean(request.machineIdentityId) || (!request.requesterId && !request.requesterEmail);
+
+export const getRequesterSubtitle = (request: RequesterFields) =>
+ isMachineIdentityRequest(request) ? "Machine Identity" : request.requesterEmail;