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
misc: addressed comments
Sheen Capadnganbe7490f8f775
diff --git a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-account-router.tsindex 45951f910a..96503b4753 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-account-router.ts@@ -55,6 +55,7 @@ const PamAccountListItemSchema = SanitizedAccountListItemSchema.extend({accessibilityIssues: z.array(z.nativeEnum(PamAccountAccessibilityIssue)).describe("Reasons the account cannot launch a session, if any"),+ isStale: z.boolean().describe("Whether the discovery source's latest scan no longer found this account."),requiresApproval: z.boolean().describe("Whether this account requires approval before launching a session"),requireReason: z.boolean().describe("Whether the account's template requires a reason for access"),accessStatus: z.nativeEnum(PamAccessStatus).describe("Current approval status for the caller"),@@ -72,7 +73,8 @@ const accountDetailVariants = Object.entries(ACCOUNT_TYPE_CONFIGS).map(([accountisAccessible: z.boolean().describe("Whether the account is fully provisioned to launch a session"),accessibilityIssues: z.array(z.nativeEnum(PamAccountAccessibilityIssue))- .describe("Reasons the account cannot launch a session, if any")+ .describe("Reasons the account cannot launch a session, if any"),+ isStale: z.boolean().describe("Whether the discovery source's latest scan no longer found this account.")}));diff --git a/backend/src/ee/routes/v1/pam-routers/pam-discovery-router.ts b/backend/src/ee/routes/v1/pam-routers/pam-discovery-router.tsindex a79c496912..18258d58ab 100644--- a/backend/src/ee/routes/v1/pam-routers/pam-discovery-router.ts+++ b/backend/src/ee/routes/v1/pam-routers/pam-discovery-router.ts@@ -400,10 +400,10 @@ export const registerPamDiscoveryRouter = async (server: FastifyZodProvider) =>server.route({method: "GET",- url: "/:sourceId/unavailable-accounts",+ url: "/:sourceId/stale-accounts",schema: {- operationId: "listPamUnavailableAccounts",- description: "List imported accounts a PAM discovery source no longer finds in the environment",+ operationId: "listPamStaleAccounts",+ description: "List imported accounts the discovery source's latest scan no longer found in the environment",tags: [ApiDocsTags.PamDiscovery],params: z.object({ sourceId: z.string().uuid() }),querystring: z.object({diff --git a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.tsindex be129bcb6c..62ee28ac28 100644--- a/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts+++ b/backend/src/ee/services/pam-account-rotation/pam-account-rotation-service.ts@@ -931,9 +931,6 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServicResourcePermissionPamResourceActions.ManageRotation,ctx);- if (account.isStale) {- throw new BadRequestError({ message: "This account is no longer available in the environment" });- }const readiness = getRotationReadiness({accountId: account.id,accountType: account.accountType,@@ -1018,7 +1015,6 @@ export const pamAccountRotationServiceFactory = (deps: TPamAccountRotationServic} | null> => {const account = await pamAccountDAL.findByIdWithDetails(accountId);if (!account) return null;- if (account.isStale) return null;const rotation = getRotationConfig(account.templateSettings);if (!rotation?.enabled) return null;const result = await runRotation(account);diff --git a/backend/src/ee/services/pam-account/pam-account-dal.ts b/backend/src/ee/services/pam-account/pam-account-dal.tsindex e78d223136..6c5a3e0f5b 100644--- a/backend/src/ee/services/pam-account/pam-account-dal.ts+++ b/backend/src/ee/services/pam-account/pam-account-dal.ts@@ -61,7 +61,6 @@ export const accountAccessibilitySql = (accountTable: string, templateTable: str"${templateTable}"."settings"->'recordingS3Config') is not null))- and not ${staleAccountExistsSql(accountTable)})`;type TPamAccountTemplateInheritedFields = {@@ -247,9 +246,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {.whereNotNull(`${TableName.PamAccount}.nextRotationAt`).where(`${TableName.PamAccount}.nextRotationAt`, "<=", now).whereIn(`${TableName.PamAccountTemplate}.type`, ROTATABLE_TYPE_VALUES)- .whereRaw(`"${TableName.PamAccountTemplate}"."settings"->'rotation'->>'enabled' = 'true'`)- // a stale account (deleted/disabled in the environment) must not keep getting rotated- .whereRaw(`not ${staleAccountExistsSql(TableName.PamAccount)}`);+ .whereRaw(`"${TableName.PamAccountTemplate}"."settings"->'rotation'->>'enabled' = 'true'`);// Only ready accounts get a nextRotationAt, so every due row here is already rotation-ready.const findAccountsToRotate = async (now: Date, limit: number, tx?: Knex): Promise<TPamAccountDetail[]> => {diff --git a/backend/src/ee/services/pam-account/pam-account-schemas.ts b/backend/src/ee/services/pam-account/pam-account-schemas.tsindex 13f18bfd27..9bd6c6f338 100644--- a/backend/src/ee/services/pam-account/pam-account-schemas.ts+++ b/backend/src/ee/services/pam-account/pam-account-schemas.ts@@ -839,8 +839,7 @@ export enum PamAccountAccessibilityIssue {NoGateway = "no-gateway",NoRecordingConfig = "no-recording-config",NoCredential = "no-credential",- NoApprovalConfig = "no-approval-config",- Stale = "stale"+ NoApprovalConfig = "no-approval-config"}export const accountTypeRequiresRecording = (accountType: PamAccountType): boolean =>@@ -864,12 +863,9 @@ export const getAccountAccessibilityIssues = (account: {settingsOverrides?: unknown;templateSettings: unknown;credentialConfigured: boolean;- isStale?: boolean;}): PamAccountAccessibilityIssue[] => {const issues: PamAccountAccessibilityIssue[] = [];- if (account.isStale) issues.push(PamAccountAccessibilityIssue.Stale);-if (accountTypeRequiresGateway(account.accountType as PamAccountType) &&!account.gatewayId &&diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.tsindex db8989f696..e810dcfeb8 100644--- a/backend/src/ee/services/pam-account/pam-account-service.ts+++ b/backend/src/ee/services/pam-account/pam-account-service.ts@@ -171,7 +171,6 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>settingsOverrides?: unknown;templateSettings: unknown;credentialConfigured: boolean;- isStale?: boolean;}) => {const accessibilityIssues = getAccountAccessibilityIssues(a);return { isAccessible: accessibilityIssues.length === 0, accessibilityIssues };@@ -252,6 +251,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>recordingConnectionId: a.recordingConnectionId,isAccessible: isAccessible && accessibilityIssues.length === 0,accessibilityIssues,+ isStale: a.isStale,requiresApproval,requireReason,accessStatus: requiresApproval ? (statusEntry?.accessStatus ?? PamAccessStatus.None) : PamAccessStatus.None,@@ -304,6 +304,7 @@ export const pamAccountServiceFactory = (deps: TPamAccountServiceFactoryDep) =>connectionDetails,credentials,...computeAccessibility(account),+ isStale: account.isStale,createdAt: account.createdAt,updatedAt: account.updatedAt};diff --git a/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts b/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.tsindex ef4a9c67eb..af0bff4f99 100644--- a/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts+++ b/backend/src/ee/services/pam-discovery/pam-discovered-account-dal.ts@@ -50,7 +50,8 @@ export const pamDiscoveredAccountDALFactory = (db: TDbClient) => {};// Imported accounts this source no longer finds in the environment, joined to the managed account for its- // current name/folder (the review surface for blocked accounts). Staged rows are never stale (they're deleted).+ // current name/folder. Informational: nothing about these accounts is blocked, this is just the review surface+ // for cleaning them up. Never-imported rows are deleted rather than flagged, so staged rows aren't stale.const listStale = async (discoverySourceId: string,{ search, offset, limit }: { search?: string; offset?: number; limit?: number } = {}diff --git a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.tsindex 8dbf175e32..fb53ef5c69 100644--- a/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts+++ b/backend/src/ee/services/pam-discovery/pam-discovery-source-service.ts@@ -722,9 +722,6 @@ export const pamDiscoverySourceServiceFactory = (deps: TPamDiscoverySourceServicif (!discovered || discovered.discoverySourceId !== sourceId) {throw new NotFoundError({ message: "Discovered account not found" });}- if (discovered.isStale) {- throw new BadRequestError({ message: "This account is no longer available in the environment" });- }if (discovered.importedAccountId) {// Already imported. Re-run the idempotent backfill so a retry heals a prior import whose backfill// didn't complete (the three writes aren't one transaction), rather than stranding still-staged deps.diff --git a/backend/src/ee/services/pam-session/pam-session-service.ts b/backend/src/ee/services/pam-session/pam-session-service.tsindex 1247cbfbf7..8cd1a95766 100644--- a/backend/src/ee/services/pam-session/pam-session-service.ts+++ b/backend/src/ee/services/pam-session/pam-session-service.ts@@ -436,10 +436,6 @@ export const pamSessionServiceFactory = ({actor);- if (account.isStale) {- throw new ForbiddenRequestError({ message: "This account is no longer available in the environment" });- }-const trimmedReason = reason?.trim() || null;if (policy.requireMfa) {diff --git a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts b/backend/src/ee/services/pam-web-access/pam-web-access-service.tsindex f6ab1cdf57..677d03492b 100644--- a/backend/src/ee/services/pam-web-access/pam-web-access-service.ts+++ b/backend/src/ee/services/pam-web-access/pam-web-access-service.ts@@ -190,10 +190,6 @@ export const pamWebAccessServiceFactory = ({});- if (account.isStale) {- throw new ForbiddenRequestError({ message: "This account is no longer available in the environment" });- }-let grantRemainingMs: number | null = null;if (requiresApproval) {const grant = await pamAccessRequestService.checkGrant({diff --git a/backend/src/ee/services/pam/CLAUDE.md b/backend/src/ee/services/pam/CLAUDE.mdindex 56c753769b..7606b26f73 100644--- a/backend/src/ee/services/pam/CLAUDE.md+++ b/backend/src/ee/services/pam/CLAUDE.md@@ -98,8 +98,12 @@ Current types: Active Directory and Unix.**Staleness (Windows).** After a completed scan, discovered accounts it no longer finds are reconciled:never-imported ones are deleted, imported ones are flagged stale (reappearing self-heals). Only accounts in are-checked scope are touched, so an unreachable host can't mass-flag (same guardrail as dependency pruning). A-managed account's staleness is derived from its discovered row (not stored on the account); a stale one becomes-an accessibility issue — blocked from rotation and session launch — and is listed on the source's Unavailable tab.+managed account's staleness is derived from its discovered row (not stored on the account) and is **purely+informational** — it is deliberately *not* an accessibility issue and gates nothing: rotation (scheduled and+on-demand), session launch, web access, and import all behave exactly as they do for a non-stale account. The+only surfaces are `isStale` on the account and the source's Stale Accounts tab (`GET+/pam/discovery-sources/:sourceId/stale-accounts`), so an admin can decide whether to delete it. Don't add a+staleness check to a code path; if the target is really gone, the operation's own failure is the signal.## Credential Rotationdiff --git a/frontend/src/hooks/api/pam/queries.tsx b/frontend/src/hooks/api/pam/queries.tsxindex 997e7f725f..29e94a483d 100644--- a/frontend/src/hooks/api/pam/queries.tsx+++ b/frontend/src/hooks/api/pam/queries.tsx@@ -40,7 +40,7 @@ import {TPamResourceRole,TPamRotationCandidateGroup,TPamSession,- TPamUnavailableAccount+ TPamStaleAccount} from "./types";// Resolves the org's PAM project, creating it on first access (lazy bootstrap on the backend).@@ -96,10 +96,10 @@ export const pamKeys = {sourceId: string,params?: { search?: string; offset?: number; limit?: number }) => [...pamKeys.discovery(), "discovered", sourceId, params] as const,- listUnavailableAccounts: (+ listStaleAccounts: (sourceId: string,params?: { search?: string; offset?: number; limit?: number }- ) => [...pamKeys.discovery(), "unavailable", sourceId, params] as const,+ ) => [...pamKeys.discovery(), "stale", sourceId, params] as const,accountRotation: (accountId: string) => [...pamKeys.account(), "rotation", accountId] as const,accountDependencies: (accountId: string) =>[...pamKeys.account(), "dependencies", accountId] as const,@@ -206,6 +206,8 @@ export type TPamAccountListItem = {recordingConnectionId: string | null;isAccessible: boolean;accessibilityIssues: PamAccountAccessibilityIssue[];+ // the latest discovery scan didn't find it. Informational only, nothing about the account is blocked.+ isStale: boolean;requiresApproval: boolean;requireReason: boolean;accessStatus: PamAccessStatus;@@ -567,17 +569,17 @@ export const useListPamDiscoveredAccounts = (});};-export const useListPamUnavailableAccounts = (+export const useListPamStaleAccounts = (sourceId: string,params?: { search?: string; offset?: number; limit?: number }) => {return useQuery({- queryKey: pamKeys.listUnavailableAccounts(sourceId, params),+ queryKey: pamKeys.listStaleAccounts(sourceId, params),queryFn: async () => {const { data } = await apiRequest.get<{- accounts: TPamUnavailableAccount[];+ accounts: TPamStaleAccount[];totalCount: number;- }>(`/api/v1/pam/discovery-sources/${sourceId}/unavailable-accounts`, { params });+ }>(`/api/v1/pam/discovery-sources/${sourceId}/stale-accounts`, { params });return data;},enabled: Boolean(sourceId),diff --git a/frontend/src/hooks/api/pam/types/index.ts b/frontend/src/hooks/api/pam/types/index.tsindex 81cd347066..ae17d576da 100644--- a/frontend/src/hooks/api/pam/types/index.ts+++ b/frontend/src/hooks/api/pam/types/index.ts@@ -74,8 +74,9 @@ export type TPamDiscoveredAccount = {dependencies: TPamDependency[];};-// an imported account a source no longer finds in the environment (rotation + access blocked)-export type TPamUnavailableAccount = {+// an imported account the source's latest scan no longer found. Informational only: nothing about the+// managed account is blocked, it's listed so an admin can decide whether to delete it.+export type TPamStaleAccount = {id: string;accountId: string;name: string;@@ -184,8 +185,7 @@ export enum PamAccountAccessibilityIssue {NoGateway = "no-gateway",NoRecordingConfig = "no-recording-config",NoCredential = "no-credential",- NoApprovalConfig = "no-approval-config",- Stale = "stale"+ NoApprovalConfig = "no-approval-config"}export const accountTypeRequiresRecording = (type: PamAccountType): boolean =>@@ -215,6 +215,8 @@ export type TPamAccount = {credentials: Record<string, unknown>;isAccessible: boolean;accessibilityIssues: PamAccountAccessibilityIssue[];+ // the latest discovery scan didn't find it. Informational only, nothing about the account is blocked.+ isStale: boolean;createdAt: string;updatedAt: string;};diff --git a/frontend/src/hooks/usePamSheetState.ts b/frontend/src/hooks/usePamSheetState.tsindex 50afd2104d..3071e9dcb3 100644--- a/frontend/src/hooks/usePamSheetState.ts+++ b/frontend/src/hooks/usePamSheetState.ts@@ -11,7 +11,7 @@ export enum PamSheetTab {Rotation = "rotation",Dependencies = "dependencies",Approvals = "approvals",- Unavailable = "unavailable"+ Stale = "stale"}export const pamSheetSearchParams = z.object({diff --git a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsxindex bb97d7b485..41c00a06a9 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/AccountDetailSheet.tsx@@ -76,6 +76,7 @@ import { useGetOrgUsers } from "@app/hooks/api/users/queries";import { PamSheetTab, usePamSheetState } from "@app/hooks/usePamSheetState";import { AccountPlatformIcon } from "../../components/AccountPlatformIcon";+import { AccountStaleBadge } from "../../components/AccountStaleBadge";import { PamMemberKind, PamMembershipScope, PamMemberSource } from "../../components/memberEnums";import {formatDetailDate,@@ -108,7 +109,7 @@ type ResolvedMember = {};// Maps each accessibility issue to the tab where it can be resolved-const ISSUE_TO_TAB: Partial<Record<PamAccountAccessibilityIssue, PamSheetTab>> = {+const ISSUE_TO_TAB: Record<PamAccountAccessibilityIssue, PamSheetTab> = {[PamAccountAccessibilityIssue.NoCredential]: PamSheetTab.Configuration,[PamAccountAccessibilityIssue.NoGateway]: PamSheetTab.Advanced,[PamAccountAccessibilityIssue.NoRecordingConfig]: PamSheetTab.Advanced,@@ -862,9 +863,7 @@ export const AccountDetailSheet = ({ isOpen, accountId, onOpenChange }: Props) =);const tabsWithIssues = new Set(- (account?.accessibilityIssues ?? [])- .map((issue) => ISSUE_TO_TAB[issue])- .filter((t): t is PamSheetTab => Boolean(t))+ (account?.accessibilityIssues ?? []).map((issue) => ISSUE_TO_TAB[issue]));const conn = (account?.connectionDetails ?? {}) as Record<string, unknown>;@@ -943,6 +942,7 @@ export const AccountDetailSheet = ({ isOpen, accountId, onOpenChange }: Props) =title={account?.name}subtitle={folderSubtitle}typeBadge={typeInfo?.name}+ badges={<AccountStaleBadge isStale={Boolean(account?.isStale)} />}icon={accountType ? (<div className="mb-4 flex size-16 items-center justify-center rounded-lg border border-border bg-container">diff --git a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsxindex a5f64fc95d..c39a7a0edd 100644--- a/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx+++ b/frontend/src/pages/pam/PamAccountsPage/components/FolderAccountRow.tsx@@ -8,6 +8,7 @@ import {} from "@app/hooks/api/pam";import { PamSheetTab } from "@app/hooks/usePamSheetState";+import { AccountStaleBadge } from "../../components/AccountStaleBadge";import { PamAccountRow } from "../../components/PamAccountRow";import { AccountAccessibilityBadgeWithPermission } from "./AccountAccessibilityBadgeWithPermission";import { AccountActionsMenu } from "./AccountActionsMenu";@@ -75,10 +76,13 @@ export const FolderAccountRow = ({onRequestAccess={() => onRequestAccess(launchableAccount)}indentedaccessibilityBadge={- <AccountAccessibilityBadgeWithPermission- canEdit={can(PamResourcePermissionActions.EditAccounts)}- issues={account.accessibilityIssues}- />+ <>+ <AccountAccessibilityBadgeWithPermission+ canEdit={can(PamResourcePermissionActions.EditAccounts)}+ issues={account.accessibilityIssues}+ />+ <AccountStaleBadge isStale={account.isStale} />+ </>}actions={<AccountActionsMenudiff --git a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoverySourceDetailSheet.tsx b/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoverySourceDetailSheet.tsxindex d7350de420..1dab3526f5 100644--- a/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoverySourceDetailSheet.tsx+++ b/frontend/src/pages/pam/PamDiscoveryPage/components/DiscoverySourceDetailSheet.tsx@@ -56,7 +56,7 @@ import {useListPamDiscoveryRuns,useListPamDiscoverySources,useListPamDiscoveryTypes,- useListPamUnavailableAccounts,+ useListPamStaleAccounts,usePamAccountTypeMap,useTriggerPamDiscoveryScan,useUpdatePamDiscoverySource@@ -380,11 +380,11 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: Pconst [debouncedStaleSearch] = useDebounce(staleSearch);const [stalePage, setStalePage] = useState(1);const [stalePerPage, setStalePerPage] = useState(() =>- getUserTablePreference("pamUnavailableAccountsTable", PreferenceKey.PerPage, 20)+ getUserTablePreference("pamStaleAccountsTable", PreferenceKey.PerPage, 20));const staleOffset = (stalePage - 1) * stalePerPage;- const { data: { accounts: unavailable = [], totalCount: unavailableTotal = 0 } = {} } =- useListPamUnavailableAccounts(sourceId ?? "", {+ const { data: { accounts: stale = [], totalCount: staleTotal = 0 } = {} } =+ useListPamStaleAccounts(sourceId ?? "", {search: debouncedStaleSearch,offset: staleOffset,limit: stalePerPage@@ -407,7 +407,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: PqueryKey: [...pamKeys.discovery(), "discovered", sourceId ?? ""]});queryClient.invalidateQueries({- queryKey: [...pamKeys.discovery(), "unavailable", sourceId ?? ""]+ queryKey: [...pamKeys.discovery(), "stale", sourceId ?? ""]});// A scan reconciles dependencies onto managed accounts, so refresh account views (their dependency// lists are keyed under pamKeys.account()) which the discovery scan otherwise never invalidates.@@ -585,18 +585,17 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: P);const sq = staleSearch.trim().toLowerCase();- const visibleUnavailable = sq- ? unavailable.filter((a) => a.name.toLowerCase().includes(sq))- : unavailable;+ const visibleStale = sq ? stale.filter((a) => a.name.toLowerCase().includes(sq)) : stale;- const unavailableTab: ReactNode = (+ const staleTab: ReactNode = (<div className="flex flex-1 flex-col gap-4 p-4"><Card><CardHeader className="border-b">- <CardTitle className="text-base">Unavailable Accounts</CardTitle>+ <CardTitle className="text-base">Stale Accounts</CardTitle><CardDescription>- Imported accounts the latest scan no longer finds in the environment. Rotation and- access are blocked until they are rediscovered.+ Imported accounts the latest scan no longer found in the environment. They keep working+ as normal, including rotation and access, so review them and delete the ones that are+ really gone.</CardDescription></CardHeader><CardContent className="flex flex-col gap-4">@@ -611,13 +610,13 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: P/></InputGroup>- {unavailableTotal === 0 ? (+ {staleTotal === 0 ? (<Empty className="border"><EmptyHeader><EmptyTitle>{debouncedStaleSearch? "No accounts match your search."- : "No unavailable accounts. Everything imported is still present in the environment."}+ : "No stale accounts. The latest scan found everything imported from this source."}</EmptyTitle></EmptyHeader></Empty>@@ -633,7 +632,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: P</TableRow></TableHeader><TableBody>- {visibleUnavailable.map((account) => {+ {visibleStale.map((account) => {const typeDetails = accountTypeMap[account.accountType as PamAccountType];return (<TableRow key={account.id}>@@ -641,10 +640,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: P<Linkto="/organizations/$orgId/pam/accounts"params={{ orgId: currentOrg.id }}- search={{- accountId: account.accountId,- folderId: account.folderId ?? undefined- }}+ search={{ accountId: account.accountId }}className="hover:underline"><HighlightText text={account.name} highlight={staleSearch} />@@ -677,7 +673,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: P</Table><Pagination- count={unavailableTotal}+ count={staleTotal}page={stalePage}perPage={stalePerPage}onChangePage={setStalePage}@@ -685,7 +681,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: PsetStalePerPage(newPerPage);setStalePage(1);setUserTablePreference(- "pamUnavailableAccountsTable",+ "pamStaleAccountsTable",PreferenceKey.PerPage,newPerPage);@@ -797,7 +793,7 @@ export const DiscoverySourceDetailSheet = ({ isOpen, sourceId, onOpenChange }: Pconst tabContent: Partial<Record<PamSheetTab, ReactNode>> = {[PamSheetTab.General]: stagedTab,- [PamSheetTab.Unavailable]: unavailableTab,+ [PamSheetTab.Stale]: staleTab,[PamSheetTab.Runs]: runsTab,[PamSheetTab.Configuration]: source ? (<ConfigurationTab source={source} onDirtyChange={setIsFormDirty} />diff --git a/frontend/src/pages/pam/components/AccountAccessibilityBadge.tsx b/frontend/src/pages/pam/components/AccountAccessibilityBadge.tsxindex 7dd8177151..f67387bd5b 100644--- a/frontend/src/pages/pam/components/AccountAccessibilityBadge.tsx+++ b/frontend/src/pages/pam/components/AccountAccessibilityBadge.tsx@@ -8,9 +8,7 @@ const ISSUE_LABELS: Record<PamAccountAccessibilityIssue, string> = {[PamAccountAccessibilityIssue.NoRecordingConfig]: "No recording bucket is configured",[PamAccountAccessibilityIssue.NoCredential]: "No password is set",[PamAccountAccessibilityIssue.NoApprovalConfig]:- "No approvers are configured for its folder. Ask a folder admin to add approvers under the folder's Approvals tab.",- [PamAccountAccessibilityIssue.Stale]:- "It is no longer present in the environment. Rotation and access are blocked until it is rediscovered."+ "No approvers are configured for its folder. Ask a folder admin to add approvers under the folder's Approvals tab."};type Props = {@@ -36,10 +34,10 @@ export const AccountAccessibilityBadge = ({ issues }: Props) => {</TooltipTrigger><TooltipContent className="max-w-xs">{issues.length === 1 ? (- <p>This account can't be used: {formatSingleIssue(ISSUE_LABELS[issues[0]])}</p>+ <p>This account can't be used yet: {formatSingleIssue(ISSUE_LABELS[issues[0]])}</p>) : (<>- <p className="mb-1 font-medium">This account can't be used</p>+ <p className="mb-1 font-medium">This account can't be used yet</p><ul className="list-inside list-disc">{issues.map((issue) => (<li key={issue}>{ISSUE_LABELS[issue]}</li>diff --git a/frontend/src/pages/pam/components/AccountStaleBadge.tsx b/frontend/src/pages/pam/components/AccountStaleBadge.tsxnew file mode 100644index 0000000000..702598fb2e--- /dev/null+++ b/frontend/src/pages/pam/components/AccountStaleBadge.tsx@@ -0,0 +1,26 @@+import { AlertTriangle } from "lucide-react";++import { Badge, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";++// Purely informational: staleness means the discovery source's latest scan didn't find the account. It is+// deliberately not an accessibility issue, so rotation, session launch, and everything else are unaffected.+export const AccountStaleBadge = ({ isStale }: { isStale: boolean }) => {+ if (!isStale) return null;++ return (+ <Tooltip>+ <TooltipTrigger asChild>+ <Badge variant="neutral">+ <AlertTriangle className="size-3" />+ Stale+ </Badge>+ </TooltipTrigger>+ <TooltipContent className="max-w-xs">+ <p>+ The latest discovery scan didn't find this account in the environment. It still works+ normally, including rotation and access, so delete it if it's really gone.+ </p>+ </TooltipContent>+ </Tooltip>+ );+};diff --git a/frontend/src/pages/pam/components/pamResourceTabs.ts b/frontend/src/pages/pam/components/pamResourceTabs.tsindex b626212ba9..95f0c29ac6 100644--- a/frontend/src/pages/pam/components/pamResourceTabs.ts+++ b/frontend/src/pages/pam/components/pamResourceTabs.ts@@ -75,7 +75,7 @@ export const PAM_TEMPLATE_TABS: PamResourceTab[] = [export const PAM_DISCOVERY_TABS: PamResourceTab[] = [{ value: PamSheetTab.General, label: "Staged Accounts", icon: FolderOpen },- { value: PamSheetTab.Unavailable, label: "Unavailable", icon: TriangleAlert },+ { value: PamSheetTab.Stale, label: "Stale Accounts", icon: TriangleAlert },{ value: PamSheetTab.Runs, label: "Runs", icon: History },{ value: PamSheetTab.Configuration, label: "Configuration", icon: Settings }];