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
improvement(pam): show full account details in request access sidebar
bernie-gc4e89216715d
diff --git a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsxindex 9f2ee09427..0860192c5e 100644--- a/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx+++ b/frontend/src/pages/pam/PamAccessPage/components/LaunchSessionSheet.tsx@@ -1,6 +1,6 @@-import { ReactNode, useState } from "react";+import { useState } from "react";import { Link } from "@tanstack/react-router";-import { Copy, FolderOpen, Globe, Rocket, Terminal } from "lucide-react";+import { Copy, Globe, Rocket, Terminal } from "lucide-react";import { createNotification } from "@app/components/notifications";import {@@ -24,16 +24,11 @@ import {SelectValue} from "@app/components/v3/generic/Select";import { useOrganization } from "@app/context";-import {- PamAccountType,- TAccessiblePamAccount,- TPamFieldDescriptor,- useGetPamAccountById,- usePamAccountTypeMap-} from "@app/hooks/api/pam";+import { TAccessiblePamAccount } from "@app/hooks/api/pam";import { PamSheetTab } from "@app/hooks/usePamSheetState";import { PamDetailSheet } from "../../components/PamDetailSheet";+import { useAccountSheetDetails } from "./accountSheetDetails";type Props = {account: TAccessiblePamAccount | null;@@ -43,13 +38,6 @@ type Props = {type LaunchMethod = "browser" | "cli";-const formatFieldValue = (value: unknown): ReactNode => {- if (typeof value === "boolean") return value ? "Enabled" : "Disabled";- const str = String(value);- if (str.length > 48) return "Provided";- return <span className="font-mono">{str}</span>;-};-const LaunchTab = ({account,supportsWebAccess,@@ -190,42 +178,12 @@ const LaunchTab = ({};export const LaunchSessionSheet = ({ account, isOpen, onOpenChange }: Props) => {- const { map } = usePamAccountTypeMap();- const { data: fullAccount } = useGetPamAccountById(isOpen ? account?.id : undefined);+ const { typeMeta, typeName, subtitle, metadata, hosts } = useAccountSheetDetails(account, isOpen);if (!account) return null;- const typeMeta = map[account.accountType as PamAccountType];- const typeName = typeMeta?.name ?? account.accountType;const supportsWebAccess = Boolean(typeMeta?.supportsWebAccess);- const subtitle = account.folderName ? (- <span className="flex items-center gap-1.5">- <FolderOpen className="size-3.5" />- {account.folderName}- </span>- ) : undefined;-- const conn = (fullAccount?.connectionDetails ?? {}) as Record<string, unknown>;- const credentials = (fullAccount?.credentials ?? {}) as Record<string, unknown>;-- const hosts =- account.accountType === PamAccountType.WindowsAd && Array.isArray(conn.hosts)- ? (conn.hosts as unknown[]).filter((host): host is string => typeof host === "string")- : [];-- const fieldRows = (fields: TPamFieldDescriptor[] | undefined, source: Record<string, unknown>) =>- (fields ?? [])- .filter((f) => !f.secret)- .filter((f) => source[f.key] !== undefined && source[f.key] !== null && source[f.key] !== "")- .map((f) => ({ label: f.label, value: formatFieldValue(source[f.key]) }));-- const metadata = [- ...(account.description ? [{ label: "Description", value: account.description }] : []),- ...fieldRows(typeMeta?.connectionFields, conn),- ...fieldRows(typeMeta?.credentialFields, credentials)- ];-return (<PamDetailSheetisOpen={isOpen}diff --git a/frontend/src/pages/pam/PamAccessPage/components/RequestAccessSheet.tsx b/frontend/src/pages/pam/PamAccessPage/components/RequestAccessSheet.tsxindex a8e8d0ec68..b086c4153a 100644--- a/frontend/src/pages/pam/PamAccessPage/components/RequestAccessSheet.tsx+++ b/frontend/src/pages/pam/PamAccessPage/components/RequestAccessSheet.tsx@@ -37,11 +37,11 @@ import {TAccessiblePamAccount,TPamApprovalWorkflowStep,useCreatePamAccessRequest,- useGetPamAccountApprovers,- usePamAccountTypeMap+ useGetPamAccountApprovers} from "@app/hooks/api/pam";import { PamDetailSheet } from "../../components/PamDetailSheet";+import { useAccountSheetDetails } from "./accountSheetDetails";// Mirrors the membership expiry picker options, capped at the default 7d policy maximum and// without "No expiry" since every approved access must be time-boxed.@@ -137,12 +137,9 @@ const ApprovalWorkflow = ({ accountId, isPending }: { accountId?: string; isPend};export const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) => {- const { map } = usePamAccountTypeMap();+ const { typeName, subtitle, metadata } = useAccountSheetDetails(account, isOpen);const createRequest = useCreatePamAccessRequest();const isPending = account?.accessStatus === PamAccessStatus.Pending;- const typeName = account- ? (map[account.accountType as PamAccountType]?.name ?? account.accountType)- : undefined;const {control,@@ -184,9 +181,9 @@ export const RequestAccessSheet = ({ account, isOpen, onOpenChange }: Props) =>isLoading={!account}accountType={account?.accountType as PamAccountType}title={account?.name}- subtitle={account?.folderName}+ subtitle={subtitle}typeBadge={typeName}- metadata={[{ label: "Description", value: account?.description || "—" }]}+ metadata={metadata}isDirty={isDirty && !isPending}><Tabs defaultValue="request" className="flex h-full flex-col">diff --git a/frontend/src/pages/pam/PamAccessPage/components/accountSheetDetails.tsx b/frontend/src/pages/pam/PamAccessPage/components/accountSheetDetails.tsxnew file mode 100644index 0000000000..d8a8523817--- /dev/null+++ b/frontend/src/pages/pam/PamAccessPage/components/accountSheetDetails.tsx@@ -0,0 +1,66 @@+import { ReactNode } from "react";+import { FolderOpen } from "lucide-react";++import {+ PamAccountType,+ TAccessiblePamAccount,+ TPamFieldDescriptor,+ useGetPamAccountById,+ usePamAccountTypeMap+} from "@app/hooks/api/pam";++const formatFieldValue = (value: unknown): ReactNode => {+ if (typeof value === "boolean") return value ? "Enabled" : "Disabled";+ const str = String(value);+ if (str.length > 48) return "Provided";+ return <span className="font-mono">{str}</span>;+};++const fieldRows = (fields: TPamFieldDescriptor[] | undefined, source: Record<string, unknown>) =>+ (fields ?? [])+ .filter((f) => !f.secret)+ .filter((f) => source[f.key] !== undefined && source[f.key] !== null && source[f.key] !== "")+ .map((f) => ({ label: f.label, value: formatFieldValue(source[f.key]) }));++// Shared sidebar content for the account sheets on the access page: the same non-secret+// connection/credential details show whether the user is launching or requesting access.+export const useAccountSheetDetails = (account: TAccessiblePamAccount | null, isOpen: boolean) => {+ const { map } = usePamAccountTypeMap();+ const { data: fullAccount } = useGetPamAccountById(isOpen ? account?.id : undefined);++ if (!account) {+ return {+ typeMeta: undefined,+ typeName: undefined,+ subtitle: undefined,+ metadata: [],+ hosts: []+ };+ }++ const typeMeta = map[account.accountType as PamAccountType];+ const typeName = typeMeta?.name ?? account.accountType;++ const subtitle = account.folderName ? (+ <span className="flex items-center gap-1.5">+ <FolderOpen className="size-3.5" />+ {account.folderName}+ </span>+ ) : undefined;++ const conn = (fullAccount?.connectionDetails ?? {}) as Record<string, unknown>;+ const credentials = (fullAccount?.credentials ?? {}) as Record<string, unknown>;++ const hosts =+ account.accountType === PamAccountType.WindowsAd && Array.isArray(conn.hosts)+ ? (conn.hosts as unknown[]).filter((host): host is string => typeof host === "string")+ : [];++ const metadata = [+ ...(account.description ? [{ label: "Description", value: account.description }] : []),+ ...fieldRows(typeMeta?.connectionFields, conn),+ ...fieldRows(typeMeta?.credentialFields, credentials)+ ];++ return { typeMeta, typeName, subtitle, metadata, hosts };+};