Skip to content

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

more greptile fixes

x03220563de643ae0be
diff --git a/backend/src/ee/services/pam-account/pam-account-enums.ts b/backend/src/ee/services/pam-account/pam-account-enums.ts
index 0def2bd5c4..0c39e81bb6 100644
--- a/backend/src/ee/services/pam-account/pam-account-enums.ts
+++ b/backend/src/ee/services/pam-account/pam-account-enums.ts
@@ -10,5 +10,6 @@ export enum PamAccountView {
export enum PamAccountRotationStatus {
Rotating = "rotating",
Success = "success",
+ PartialSuccess = "partial-success",
Failed = "failed"
}
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index 638ee48ffa..da1ac3df80 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -1219,7 +1219,7 @@ export const pamAccountServiceFactory = ({
}
});
- // Run post-rotate hook
+ // Run post-rotate hook (e.g. dependency sync)
if (factory.postRotate) {
try {
await factory.postRotate(
@@ -1230,7 +1230,27 @@ export const pamAccountServiceFactory = ({
rotationAccountCredentials
);
} catch (postRotateError) {
+ // Password was rotated but dependency sync failed, mark as partial success
+ const postRotateMsg = `Password rotated successfully, but dependency sync failed: ${postRotateError instanceof Error ? postRotateError.message : String(postRotateError)}`;
logger.error(postRotateError, `Post-rotation hook failed for account [accountId=${account.id}]`);
+ try {
+ const { encryptor: postRotateEncryptor } = await kmsService.createCipherPairWithDataKey({
+ type: KmsDataKey.SecretManager,
+ projectId: account.projectId
+ });
+ const { cipherTextBlob: encryptedPostRotateMsg } = postRotateEncryptor({
+ plainText: Buffer.from(postRotateMsg)
+ });
+ await pamAccountDAL.updateById(account.id, {
+ rotationStatus: PamAccountRotationStatus.PartialSuccess,
+ encryptedLastRotationMessage: encryptedPostRotateMsg
+ });
+ } catch (encryptErr) {
+ logger.error(encryptErr, `Failed to store post-rotation warning for account [accountId=${account.id}]`);
+ await pamAccountDAL.updateById(account.id, {
+ rotationStatus: PamAccountRotationStatus.PartialSuccess
+ });
+ }
}
}
} catch (error) {
diff --git a/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts b/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
index 7e3f3367ca..90b902fd24 100644
--- a/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
+++ b/backend/src/ee/services/pam-resource/shared/dependency-sync-fns.ts
@@ -48,6 +48,8 @@ export const buildDependencySyncScript = (
accountUsername: string,
newPassword: string
): string => {
+ validateWindowsName(dep.name, "Dependency name");
+
const escapedPassword = escapePowershellSingleQuote(newPassword);
const escapedName = escapePowershellSingleQuote(dep.name);
const escapedUsername = escapePowershellSingleQuote(accountUsername);
@@ -64,6 +66,7 @@ export const buildDependencySyncScript = (
case PamAccountDependencyType.ScheduledTask: {
const taskData = dep.data as { TaskPath?: string } | null;
const taskPath = taskData?.TaskPath ?? "\\";
+ validateWindowsPath(taskPath, "Task path");
const escapedPath = escapePowershellSingleQuote(taskPath);
validateWindowsPath(escapedPath, "Task path");
return `schtasks.exe /Change /TN '${escapedPath}${escapedName}' /RU '${escapedUsername}' /RP '${escapedPassword}'`;
diff --git a/frontend/src/hooks/api/pam/enums.ts b/frontend/src/hooks/api/pam/enums.ts
index c418014d44..f252f4c517 100644
--- a/frontend/src/hooks/api/pam/enums.ts
+++ b/frontend/src/hooks/api/pam/enums.ts
@@ -47,5 +47,6 @@ export enum PamAccountView {
export enum PamAccountRotationStatus {
Rotating = "rotating",
Success = "success",
+ PartialSuccess = "partial-success",
Failed = "failed"
}
diff --git a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
index ce978498d2..5bf3154130 100644
--- a/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
+++ b/frontend/src/pages/pam/PamAccountByIDPage/components/PamAccountDetailsSection.tsx
@@ -8,9 +8,6 @@ import {
DetailGroup,
DetailLabel,
DetailValue,
- Tooltip,
- TooltipContent,
- TooltipTrigger,
UnstableIconButton
} from "@app/components/v3";
import { ProjectPermissionSub } from "@app/context";
@@ -29,6 +26,8 @@ const rotationStatusVariant = (status?: string | null) => {
return "success" as const;
case PamAccountRotationStatus.Failed:
return "danger" as const;
+ case PamAccountRotationStatus.PartialSuccess:
+ return "warning" as const;
case PamAccountRotationStatus.Rotating:
return "info" as const;
default:
@@ -42,6 +41,8 @@ const rotationStatusLabel = (status?: string | null) => {
return "Success";
case PamAccountRotationStatus.Failed:
return "Failed";
+ case PamAccountRotationStatus.PartialSuccess:
+ return "Partial";
case PamAccountRotationStatus.Rotating:
return "Rotating";
default:
@@ -106,27 +107,30 @@ export const PamAccountDetailsSection = ({ account, onEdit }: Props) => {
<Detail>
<DetailLabel>Rotation Status</DetailLabel>
<DetailValue>
- <div className="flex items-center gap-2">
- <Badge
- variant={rotationStatusVariant(account.rotationStatus)}
- className={isRotating ? "animate-pulse" : undefined}
- >
- {rotationStatusLabel(account.rotationStatus)}
- </Badge>
- {account.rotationStatus === PamAccountRotationStatus.Failed &&
- account.lastRotationMessage && (
- <Tooltip>
- <TooltipTrigger asChild>
- <span className="cursor-help text-xs text-red-400">View error</span>
- </TooltipTrigger>
- <TooltipContent side="right" className="max-w-xs">
- {account.lastRotationMessage}
- </TooltipContent>
- </Tooltip>
- )}
- </div>
+ <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 && (
+ <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>
diff --git a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
index 4d1a15b6e2..59538d3108 100644
--- a/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
+++ b/frontend/src/pages/pam/PamResourceByIDPage/components/PamResourceAccountsSection.tsx
@@ -455,6 +455,20 @@ export const PamResourceAccountsSection = ({ resource }: Props) => {
)}
</Tooltip>
)}
+ {rotationStatus === PamAccountRotationStatus.PartialSuccess && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <Badge variant="warning" className="text-xs">
+ Partial
+ </Badge>
+ </TooltipTrigger>
+ {lastRotationMessage && (
+ <TooltipContent className="max-w-sm">
+ {lastRotationMessage}
+ </TooltipContent>
+ )}
+ </Tooltip>
+ )}
{rotationStatus === PamAccountRotationStatus.Rotating && (
<Badge variant="info" className="animate-pulse text-xs">
Rotating