Skip to content

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

Merge branch 'pam/windows/discovery-phase-2' into pam/windows/rotation

x032205977ae2caf5d8
diff --cc backend/src/@types/knex.d.ts
index 5b2d34f40b,c7fb887b69..6503cddcb8
--- a/backend/src/@types/knex.d.ts
+++ b/backend/src/@types/knex.d.ts
@@@ -686,11 -692,11 +692,16 @@@ import
TPamDiscoverySourcesUpdate
} from "@app/db/schemas/pam-discovery-sources";
import { TPamFolders, TPamFoldersInsert, TPamFoldersUpdate } from "@app/db/schemas/pam-folders";
+import {
+ TPamResourceRotationRules,
+ TPamResourceRotationRulesInsert,
+ TPamResourceRotationRulesUpdate
+} from "@app/db/schemas/pam-resource-rotation-rules";
+ import {
+ TPamResourceFavorites,
+ TPamResourceFavoritesInsert,
+ TPamResourceFavoritesUpdate
+ } from "@app/db/schemas/pam-resource-favorites";
import { TPamResources, TPamResourcesInsert, TPamResourcesUpdate } from "@app/db/schemas/pam-resources";
import { TPamSessions, TPamSessionsInsert, TPamSessionsUpdate } from "@app/db/schemas/pam-sessions";
import {
diff --cc backend/src/db/schemas/index.ts
index c91e3173ce,0a34a8972a..dc817321d3
--- a/backend/src/db/schemas/index.ts
+++ b/backend/src/db/schemas/index.ts
@@@ -115,7 -117,7 +117,8 @@@ export * from "./pam-discovery-source-r
export * from "./pam-discovery-source-runs";
export * from "./pam-discovery-sources";
export * from "./pam-folders";
+export * from "./pam-resource-rotation-rules";
+ export * from "./pam-resource-favorites";
export * from "./pam-resources";
export * from "./pam-sessions";
export * from "./pki-acme-accounts";
diff --cc backend/src/db/schemas/models.ts
index 9ae4a120fa,360598111b..958862422e
--- a/backend/src/db/schemas/models.ts
+++ b/backend/src/db/schemas/models.ts
@@@ -231,7 -231,7 +231,8 @@@ export enum TableName
PamDiscoverySourceAccount = "pam_discovery_source_accounts",
PamDiscoverySourceDependency = "pam_discovery_source_dependencies",
PamAccountDependency = "pam_account_dependencies",
+ PamResourceRotationRule = "pam_resource_rotation_rules",
+ PamResourceFavorite = "pam_resource_favorites",
VaultExternalMigrationConfig = "vault_external_migration_configs",
diff --cc backend/src/db/schemas/pam-account-dependencies.ts
index 75a5f30e4a,6266dca84a..53042da971
--- a/backend/src/db/schemas/pam-account-dependencies.ts
+++ b/backend/src/db/schemas/pam-account-dependencies.ts
@@@ -19,12 -17,9 +19,12 @@@ export const PamAccountDependenciesSche
state: z.string().nullable().optional(),
data: z.unknown(),
source: z.string(),
- isEnabled: z.boolean().default(false).nullable().optional(),
+ isRotationSyncEnabled: z.boolean().default(false).nullable().optional(),
createdAt: z.date(),
- updatedAt: z.date()
+ updatedAt: z.date(),
+ syncStatus: z.string().nullable().optional(),
+ lastSyncedAt: z.date().nullable().optional(),
+ encryptedLastSyncMessage: zodBuffer.nullable().optional()
});
export type TPamAccountDependencies = z.infer<typeof PamAccountDependenciesSchema>;
diff --cc backend/src/ee/services/pam-account/pam-account-service.ts
index ef629b3021,ae98952b66..4db13e91df
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@@ -95,7 -91,7 +95,10 @@@ type TPamAccountServiceFactoryDep =
approvalRequestGrantsDAL: TApprovalRequestGrantsDALFactory;
pamSessionExpirationService: Pick<TPamSessionExpirationServiceFactory, "scheduleSessionExpiration">;
resourceMetadataDAL: Pick<TResourceMetadataDALFactory, "insertMany" | "delete">;
- pamAccountDependenciesDAL: Pick<TPamAccountDependenciesDALFactory, "findByAccountId" | "updateById">;
- pamAccountDependenciesDAL: Pick<TPamAccountDependenciesDALFactory, "countByAccountIds">;
++ pamAccountDependenciesDAL: Pick<
++ TPamAccountDependenciesDALFactory,
++ "findByAccountId" | "updateById" | "countByAccountIds"
++ >;
};
export type TPamAccountServiceFactory = ReturnType<typeof pamAccountServiceFactory>;
diff --cc backend/src/ee/services/pam-resource/pam-resource-types.ts
index 2d89a2add2,c48dfdbb87..892489da6f
--- a/backend/src/ee/services/pam-resource/pam-resource-types.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-types.ts
@@@ -1,7 -1,7 +1,8 @@@
import { z } from "zod";
+ import { TPamResources } from "@app/db/schemas";
import { OrderByDirection, TProjectPermission } from "@app/lib/types";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
import { ResourceMetadataNonEncryptionSchema } from "@app/services/resource-metadata/resource-metadata-schema";
import { TGatewayV2ServiceFactory } from "../gateway-v2/gateway-v2-service";
diff --cc backend/src/server/routes/index.ts
index 931d0e0b54,1042ee2ec0..4184e82244
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@@ -94,8 -94,7 +94,9 @@@ import { pamDiscoverySourceServiceFacto
import { pamFolderDALFactory } from "@app/ee/services/pam-folder/pam-folder-dal";
import { pamFolderServiceFactory } from "@app/ee/services/pam-folder/pam-folder-service";
import { pamResourceDALFactory } from "@app/ee/services/pam-resource/pam-resource-dal";
+import { pamResourceRotationRulesDALFactory } from "@app/ee/services/pam-resource/pam-resource-rotation-rules-dal";
+import { pamResourceRotationRulesServiceFactory } from "@app/ee/services/pam-resource/pam-resource-rotation-rules-service";
+ import { pamResourceFavoriteDALFactory } from "@app/ee/services/pam-resource/pam-resource-favorite-dal";
import { pamResourceServiceFactory } from "@app/ee/services/pam-resource/pam-resource-service";
import { pamSessionDALFactory } from "@app/ee/services/pam-session/pam-session-dal";
import { pamSessionServiceFactory } from "@app/ee/services/pam-session/pam-session-service";
diff --cc frontend/src/hooks/api/pam/queries.tsx
index e0e5da8259,5a40509ef5..c4c3f6c0de
--- a/frontend/src/hooks/api/pam/queries.tsx
+++ b/frontend/src/hooks/api/pam/queries.tsx
@@@ -10,7 -10,7 +10,8 @@@ import
TPamAccount,
TPamAccountDependency,
TPamResource,
+ TPamRotationRule,
+ TPamResourceDependency,
TPamSession
} from "./types";
diff --cc frontend/src/hooks/api/pam/types/index.ts
index a8d116bffb,4171de9f52..3a7404b97a
--- a/frontend/src/hooks/api/pam/types/index.ts
+++ b/frontend/src/hooks/api/pam/types/index.ts
@@@ -207,49 -206,12 +207,53 @@@ export type TPamAccountDependency =
state?: string | null;
data: Record<string, unknown>;
source: string;
- isEnabled?: boolean | null;
+ isRotationSyncEnabled: boolean;
+ syncStatus?: string | null;
+ lastSyncedAt?: string | null;
resourceName?: string | null;
createdAt: string;
updatedAt: string;
};
+export type TPamRotationRule = {
+ id: string;
+ resourceId: string;
+ name?: string | null;
+ namePattern: string;
+ enabled: boolean;
+ intervalSeconds?: number | null;
+ priority: number;
+ createdAt: string;
+ updatedAt: string;
+};
+
+export type TCreatePamRotationRuleDTO = {
+ resourceId: string;
+ name?: string;
+ namePattern: string;
+ enabled: boolean;
+ intervalSeconds?: number | null;
+};
+
+export type TUpdatePamRotationRuleDTO = {
+ resourceId: string;
+ ruleId: string;
+ name?: string | null;
+ namePattern?: string;
+ enabled?: boolean;
+ intervalSeconds?: number | null;
+};
+
+export type TDeletePamRotationRuleDTO = {
+ resourceId: string;
+ ruleId: string;
+};
+
+export type TReorderPamRotationRulesDTO = {
+ resourceId: string;
+ ruleIds: string[];
+};
++
+ export type TPamResourceDependency = TPamAccountDependency & {
+ accountName: string | null;
+ };
diff --cc frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
index a253d4f841,303f9721c6..8a0cf8fa77
--- a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
@@@ -31,11 -31,10 +31,12 @@@ import { PamUpdateResourceModal } from
import {
PamResourceAccountsSection,
PamResourceConnectionSection,
+ PamResourceDependenciesSection,
PamResourceDetailsSection,
PamResourceMetadataSection,
- PamResourceRelatedResourcesSection
+ PamResourceRelatedResourcesSection,
+ PamResourceRotationPolicySection,
+ PamRotationPolicyModal
} from "./components";
const PageContent = () => {
diff --cc frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index bc05756df1,63d23a53c7..e1cedfc3de
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@@ -337,8 -291,10 +340,11 @@@ export const PamResourceAccountsSectio
<UnstableTableHeader>
<UnstableTableRow>
<UnstableTableHead>Account Name</UnstableTableHead>
+ {hasAccountsWithDependencies(resource.resourceType) && (
+ <UnstableTableHead>Dependencies</UnstableTableHead>
+ )}
{hasAccountType(resource.resourceType) && <UnstableTableHead>Type</UnstableTableHead>}
+ <UnstableTableHead>Last Rotated</UnstableTableHead>
<UnstableTableHead className="w-5" />
</UnstableTableRow>
</UnstableTableHeader>
@@@ -346,7 -302,11 +352,11 @@@
{isPending && (
<UnstableTableRow>
<UnstableTableCell
- colSpan={hasAccountType(resource.resourceType) ? 4 : 3}
+ colSpan={
- 2 +
++ 3 +
+ (hasAccountType(resource.resourceType) ? 1 : 0) +
+ (hasAccountsWithDependencies(resource.resourceType) ? 1 : 0)
+ }
className="text-center text-muted"
>
Loading accounts...
@@@ -355,7 -315,13 +365,13 @@@
)}
{!isPending && accounts.length === 0 && (
<UnstableTableRow>
- <UnstableTableCell colSpan={hasAccountType(resource.resourceType) ? 4 : 3}>
+ <UnstableTableCell
+ colSpan={
- 2 +
++ 3 +
+ (hasAccountType(resource.resourceType) ? 1 : 0) +
+ (hasAccountsWithDependencies(resource.resourceType) ? 1 : 0)
+ }
+ >
<UnstableEmpty className="border-0 bg-transparent py-8 shadow-none">
<UnstableEmptyHeader>
<UnstableEmptyTitle>
@@@ -405,8 -368,33 +421,13 @@@
<span>No password</span>
</Badge>
)}
- {lastRotatedAt && (
- <Tooltip>
- <TooltipTrigger asChild>
- <Badge
- variant={rotationStatus === "failed" ? "danger" : "success"}
- className="text-xs"
- >
- <RefreshCwIcon className="size-3" />
- <span>
- Rotated {formatDistance(new Date(), new Date(lastRotatedAt))} ago
- </span>
- </Badge>
- </TooltipTrigger>
- {lastRotationMessage && (
- <TooltipContent className="max-w-sm text-center">
- {lastRotationMessage}
- </TooltipContent>
- )}
- </Tooltip>
- )}
</div>
</UnstableTableCell>
+ {hasAccountsWithDependencies(resource.resourceType) && (
+ <UnstableTableCell>
+ <span className="text-muted">{account.dependencyCount ?? 0}</span>
+ </UnstableTableCell>
+ )}
{hasAccountType(resource.resourceType) && (
<UnstableTableCell>
<span className="capitalize">{getAccountType(account) ?? "-"}</span>