Skip to content

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

fix(pam): hide rotation UI for resources without rotation support

bernie-g353a8a912966
diff --git a/docs/documentation/platform/pam/product-reference/credential-rotation.mdx b/docs/documentation/platform/pam/product-reference/credential-rotation.mdx
index c3204ff565..b32cf0d435 100644
--- a/docs/documentation/platform/pam/product-reference/credential-rotation.mdx
+++ b/docs/documentation/platform/pam/product-reference/credential-rotation.mdx
@@ -40,7 +40,8 @@ Setting up automated rotation requires a two-step configuration: first at the Re
Automated rotation is currently supported for the following resource types:
-- **PostgreSQL**: Requires a user with `ALTER ROLE` permissions.
+- **PostgreSQL**: Requires a rotation account with `ALTER ROLE` permissions.
+- **Windows Server**: Requires a rotation account in the local Administrators group. Rotation applies to local machine accounts only.
<Note>
We are constantly adding support for more resource types.
diff --git a/frontend/src/hooks/api/pam/maps.ts b/frontend/src/hooks/api/pam/maps.ts
index 1f1148164b..e8e5e4f5ed 100644
--- a/frontend/src/hooks/api/pam/maps.ts
+++ b/frontend/src/hooks/api/pam/maps.ts
@@ -23,3 +23,11 @@ export const PAM_RESOURCE_TYPE_MAP: Record<
[PamResourceType.AwsIam]: { name: "AWS IAM", image: "Amazon Web Services.png" },
[PamResourceType.Windows]: { name: "Windows Server", image: "Windows.png" }
};
+
+const PAM_ROTATION_SUPPORTED_RESOURCE_TYPES = new Set([
+ PamResourceType.Postgres,
+ PamResourceType.Windows
+]);
+
+export const isPamRotationSupported = (resourceType: PamResourceType) =>
+ PAM_ROTATION_SUPPORTED_RESOURCE_TYPES.has(resourceType);
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
index 515511c31f..9bddda2627 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
@@ -12,7 +12,12 @@ import {
} from "@app/components/v3";
import { ProjectPermissionSub } from "@app/context";
import { ProjectPermissionPamAccountActions } from "@app/context/ProjectPermissionContext/types";
-import { PAM_RESOURCE_TYPE_MAP, PamAccountRotationStatus, TPamAccount } from "@app/hooks/api/pam";
+import {
+ isPamRotationSupported,
+ PAM_RESOURCE_TYPE_MAP,
+ PamAccountRotationStatus,
+ TPamAccount
+} from "@app/hooks/api/pam";
import { useGetPamAccountById } from "@app/hooks/api/pam/queries";
type Props = {
@@ -55,6 +60,9 @@ export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
? PAM_RESOURCE_TYPE_MAP[account.resource.resourceType]
: null;
const isRotating = account.rotationStatus === PamAccountRotationStatus.Rotating;
+ const rotationSupported = account.resource
+ ? isPamRotationSupported(account.resource.resourceType)
+ : false;
// Poll for status updates while rotation is in progress
useGetPamAccountById(account.id, {
@@ -112,40 +120,44 @@ export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
<DetailLabel>Created</DetailLabel>
<DetailValue>{format(new Date(account.createdAt), "MM/dd/yyyy, hh:mm a")}</DetailValue>
</Detail>
- <Detail>
- <DetailLabel>Rotation Status</DetailLabel>
- <DetailValue>
- <Badge
- variant={rotationStatusVariant(account.rotationStatus)}
- className={isRotating ? "animate-pulse" : undefined}
- >
- {rotationStatusLabel(account.rotationStatus)}
- </Badge>
- </DetailValue>
- </Detail>
- {(account.rotationStatus === PamAccountRotationStatus.Failed ||
- account.rotationStatus === PamAccountRotationStatus.PartialSuccess) &&
- account.lastRotationMessage && (
+ {rotationSupported && (
+ <>
<Detail>
- <DetailLabel>Last Rotation Message</DetailLabel>
- <DetailValue
- className={`text-xs break-words ${
- account.rotationStatus === PamAccountRotationStatus.Failed
- ? "text-danger"
- : "text-warning"
- }`}
- >
- {account.lastRotationMessage}
+ <DetailLabel>Rotation Status</DetailLabel>
+ <DetailValue>
+ <Badge
+ variant={rotationStatusVariant(account.rotationStatus)}
+ className={isRotating ? "animate-pulse" : undefined}
+ >
+ {rotationStatusLabel(account.rotationStatus)}
+ </Badge>
</DetailValue>
</Detail>
- )}
- {"lastRotatedAt" in account && account.lastRotatedAt && (
- <Detail>
- <DetailLabel>Last Rotated</DetailLabel>
- <DetailValue>
- {format(new Date(account.lastRotatedAt as string), "MM/dd/yyyy, hh:mm a")}
- </DetailValue>
- </Detail>
+ {(account.rotationStatus === PamAccountRotationStatus.Failed ||
+ account.rotationStatus === PamAccountRotationStatus.PartialSuccess) &&
+ account.lastRotationMessage && (
+ <Detail>
+ <DetailLabel>Last Rotation Message</DetailLabel>
+ <DetailValue
+ className={`text-xs break-words ${
+ account.rotationStatus === PamAccountRotationStatus.Failed
+ ? "text-danger"
+ : "text-warning"
+ }`}
+ >
+ {account.lastRotationMessage}
+ </DetailValue>
+ </Detail>
+ )}
+ {"lastRotatedAt" in account && account.lastRotatedAt && (
+ <Detail>
+ <DetailLabel>Last Rotated</DetailLabel>
+ <DetailValue>
+ {format(new Date(account.lastRotatedAt as string), "MM/dd/yyyy, hh:mm a")}
+ </DetailValue>
+ </Detail>
+ )}
+ </>
)}
</DetailGroup>
</div>
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
index 44d8a43b59..247e881bde 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/PamResourceByIDPage.tsx
@@ -21,6 +21,7 @@ import {
} from "@app/components/v3";
import { ProjectPermissionActions, ProjectPermissionSub, useOrganization } from "@app/context";
import {
+ isPamRotationSupported,
PAM_RESOURCE_TYPE_MAP,
PamResourceType,
useDeletePamResource,
@@ -207,10 +208,12 @@ const PageContent = () => {
resource={resource}
onEdit={() => setIsEditModalOpen(true)}
/>
- <PamResourceRotationPolicySection
- resource={resource}
- onEdit={() => setIsRotationPolicyModalOpen(true)}
- />
+ {isPamRotationSupported(resource.resourceType) && (
+ <PamResourceRotationPolicySection
+ resource={resource}
+ onEdit={() => setIsRotationPolicyModalOpen(true)}
+ />
+ )}
{[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (
<PamResourceSessionRecordingSection
config={resource.sessionSummaryConfig ?? null}
@@ -255,11 +258,13 @@ const PageContent = () => {
onDeleteApproved={handleDeleteConfirm}
/>
- <PamRotationPolicyModal
- isOpen={isRotationPolicyModalOpen}
- onOpenChange={setIsRotationPolicyModalOpen}
- resource={resource}
- />
+ {isPamRotationSupported(resource.resourceType) && (
+ <PamRotationPolicyModal
+ isOpen={isRotationPolicyModalOpen}
+ onOpenChange={setIsRotationPolicyModalOpen}
+ resource={resource}
+ />
+ )}
{[PamResourceType.Postgres, PamResourceType.SSH].includes(resource.resourceType) && (
<PamSessionRecordingModal