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
show internal metadata
x032205ddd5df807f09
diff --git a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.tsindex 0b8344d334..7bcc8a0af3 100644--- a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts+++ b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts@@ -15,7 +15,7 @@ import { TPamAccountDALFactory } from "../../pam-account/pam-account-dal";import { encryptAccountCredentials } from "../../pam-account/pam-account-fns";import {TActiveDirectoryAccountCredentials,- TActiveDirectoryAccountMetadata,+ TActiveDirectoryAccountInternalMetadata,TActiveDirectoryResourceConnectionDetails} from "../../pam-resource/active-directory/active-directory-resource-types";import { TPamResourceDALFactory } from "../../pam-resource/pam-resource-dal";@@ -457,7 +457,7 @@ const upsertDomainAccount = async (userAccountControl: user.userAccountControl ? parseInt(user.userAccountControl, 10) : undefined,pwdLastSet: user.pwdLastSet || undefined,lastLogonTimestamp: user.lastLogonTimestamp || undefined- } as TActiveDirectoryAccountMetadata;+ } as TActiveDirectoryAccountInternalMetadata;const account = await pamAccountDAL.create({diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.tsindex ae2ad650f7..df6e1033d2 100644--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts+++ b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-types.ts@@ -15,4 +15,4 @@ export type TActiveDirectoryResourceConnectionDetails = z.infer<typeof ActiveDir// Accountsexport type TActiveDirectoryAccount = z.infer<typeof ActiveDirectoryAccountSchema>;export type TActiveDirectoryAccountCredentials = z.infer<typeof ActiveDirectoryAccountCredentialsSchema>;-export type TActiveDirectoryAccountMetadata = z.infer<typeof ActiveDirectoryAccountMetadataSchema>;+export type TActiveDirectoryAccountInternalMetadata = z.infer<typeof ActiveDirectoryAccountMetadataSchema>;diff --git a/frontend/src/hooks/api/pam/types/active-directory-resource.ts b/frontend/src/hooks/api/pam/types/active-directory-resource.tsindex 7dbdff112c..1f090a0040 100644--- a/frontend/src/hooks/api/pam/types/active-directory-resource.ts+++ b/frontend/src/hooks/api/pam/types/active-directory-resource.ts@@ -18,8 +18,12 @@ export type TActiveDirectoryCredentials = {password: string;};-export type TActiveDirectoryAccountMetadata = {+export type TActiveDirectoryAccountInternalMetadata = {accountType: ActiveDirectoryAccountType;+ adGuid?: string;+ userPrincipalName?: string;+ pwdLastSet?: string;+ lastLogonTimestamp?: string;};// Resources@@ -33,5 +37,5 @@ export type TActiveDirectoryResource = TBasePamResource & {// Accountsexport type TActiveDirectoryAccount = TBasePamAccount & {credentials: TActiveDirectoryCredentials;- internalMetadata: TActiveDirectoryAccountMetadata;+ internalMetadata: TActiveDirectoryAccountInternalMetadata;};diff --git a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsxindex ddcfca3050..b08168513d 100644--- a/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx+++ b/frontend/src/pages/pam/PamAccountByIDPage/PamAccountByIDPage.tsx@@ -33,6 +33,7 @@ import {PamAccountCredentialsSection,PamAccountDetailsSection,PamAccountMetadataSection,+ PamAccountPropertiesSection,PamAccountResourcesSection} from "./components";@@ -209,6 +210,7 @@ const PageContent = () => {<div className="flex w-80 flex-col gap-4"><PamAccountDetailsSection account={account} onEdit={() => setIsEditModalOpen(true)} /><PamAccountCredentialsSection account={account} onEdit={() => setIsEditModalOpen(true)} />+ <PamAccountPropertiesSection account={account} /><PamAccountMetadataSection account={account} /></div>diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsxnew file mode 100644index 0000000000..865d08dc46--- /dev/null+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountPropertiesSection.tsx@@ -0,0 +1,114 @@+import { format } from "date-fns";+import { CopyIcon } from "lucide-react";++import { createNotification } from "@app/components/notifications";+import {+ Detail,+ DetailLabel,+ DetailValue,+ UnstableIconButton,+ UnstableInput+} from "@app/components/v3";+import { PamResourceType, TActiveDirectoryAccount, TPamAccount } from "@app/hooks/api/pam";++// Converts a Windows FILETIME (100-nanosecond intervals since 1601-01-01) to a JS Date.+const windowsFileTimeToDate = (filetime: string): Date | null => {+ const value = BigInt(filetime);+ if (value === 0n) return null;++ const epochDiffMs = 11644473600000n;+ const ms = value / 10000n - epochDiffMs;+ return new Date(Number(ms));+};++const CopyableField = ({ label, value }: { label: string; value: string }) => {+ const handleCopy = () => {+ navigator.clipboard.writeText(value);+ createNotification({+ text: `${label} copied to clipboard`,+ type: "info"+ });+ };++ return (+ <Detail>+ <DetailLabel>{label}</DetailLabel>+ <DetailValue>+ <div className="flex items-center gap-2">+ <UnstableInput value={value} readOnly className="flex-1 font-mono text-sm" />+ <UnstableIconButton variant="ghost" onClick={handleCopy} size="sm">+ <CopyIcon />+ </UnstableIconButton>+ </div>+ </DetailValue>+ </Detail>+ );+};++type TPropertyField = {+ label: string;+ value: string;+ type?: "text" | "date";+};++const getAccountProperties = (account: TPamAccount): TPropertyField[] => {+ switch (account.resource.resourceType) {+ case PamResourceType.ActiveDirectory: {+ const { internalMetadata } = account as TActiveDirectoryAccount;+ const fields: TPropertyField[] = [];++ if (internalMetadata.userPrincipalName) {+ fields.push({ label: "User Principal Name", value: internalMetadata.userPrincipalName });+ }+ if (internalMetadata.adGuid) {+ fields.push({ label: "AD GUID", value: internalMetadata.adGuid });+ }+ if (internalMetadata.pwdLastSet) {+ const date = windowsFileTimeToDate(internalMetadata.pwdLastSet);+ if (date) {+ fields.push({ label: "Password Last Set", value: date.toISOString(), type: "date" });+ }+ }+ if (internalMetadata.lastLogonTimestamp) {+ const date = windowsFileTimeToDate(internalMetadata.lastLogonTimestamp);+ if (date) {+ fields.push({ label: "Last Logon", value: date.toISOString(), type: "date" });+ }+ }++ return fields;+ }+ default:+ return [];+ }+};++type Props = {+ account: TPamAccount;+};++export const PamAccountPropertiesSection = ({ account }: Props) => {+ const properties = getAccountProperties(account);++ if (properties.length === 0) return null;++ return (+ <div className="flex w-full flex-col gap-3 rounded-lg border border-border bg-container px-4 py-3">+ <div className="border-b border-border pb-2">+ <h3 className="text-lg font-medium">Properties</h3>+ </div>+ {properties.map((property) =>+ property.type === "date" ? (+ <Detail key={property.label}>+ <DetailLabel>{property.label}</DetailLabel>+ <DetailValue>+ {format(new Date(property.value), "MM/dd/yyyy, hh:mm a")}+ </DetailValue>+ </Detail>+ ) : (+ <CopyableField key={property.label} label={property.label} value={property.value} />+ )+ )}+ </div>+ );+};diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts b/frontend/src/pages/pam/PamAccountByIDPage/components/index.tsindex 6a28625fcf..a8647e687f 100644--- a/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/index.ts@@ -1,4 +1,5 @@export { PamAccountCredentialsSection } from "./PamAccountCredentialsSection";+export { PamAccountPropertiesSection } from "./PamAccountPropertiesSection";export { PamAccountDetailsSection } from "./PamAccountDetailsSection";export { PamAccountMetadataSection } from "./PamAccountMetadataSection";export { PamAccountResourcesSection } from "./PamAccountResourcesSection";