Skip to content

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

feat: update PAM account types and endpoint handling for optional rotation settings

Victor Santosb2e4c1e6bf4b
diff --git a/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts b/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
index 44e2a5ea11..4043c3cc83 100644
--- a/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
+++ b/backend/src/ee/routes/v1/pam-account-routers/pam-account-endpoints.ts
@@ -22,7 +22,7 @@ export const registerPamResourceEndpoints = <C extends TPamAccount>({
folderId?: C["folderId"];
name: C["name"];
description?: C["description"];
- rotationEnabled: C["rotationEnabled"];
+ rotationEnabled?: C["rotationEnabled"];
rotationIntervalSeconds?: C["rotationIntervalSeconds"];
}>;
updateAccountSchema: z.ZodType<{
@@ -65,7 +65,7 @@ export const registerPamResourceEndpoints = <C extends TPamAccount>({
folderId: req.body.folderId,
name: req.body.name,
description: req.body.description,
- rotationEnabled: req.body.rotationEnabled,
+ rotationEnabled: req.body.rotationEnabled ?? false,
rotationIntervalSeconds: req.body.rotationIntervalSeconds
}
}
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 302fd006f0..1edfb19e26 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -293,15 +293,15 @@ export const pamAccountServiceFactory = ({
try {
const updatedAccount = await pamAccountDAL.updateById(accountId, updateDoc);
- return {
- ...(await decryptAccount(updatedAccount, account.projectId, kmsService)),
- resource: {
- id: resource.id,
- name: resource.name,
- resourceType: resource.resourceType,
- rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
- }
- };
+ return {
+ ...(await decryptAccount(updatedAccount, account.projectId, kmsService)),
+ resource: {
+ id: resource.id,
+ name: resource.name,
+ resourceType: resource.resourceType,
+ rotationCredentialsConfigured: !!resource.encryptedRotationAccountCredentials
+ }
+ };
} catch (err) {
if (err instanceof DatabaseError && (err.error as { code: string })?.code === DatabaseErrorCode.UniqueViolation) {
throw new BadRequestError({
diff --git a/backend/src/ee/services/pam-account/pam-account-types.ts b/backend/src/ee/services/pam-account/pam-account-types.ts
index b8498036e1..241d38a115 100644
--- a/backend/src/ee/services/pam-account/pam-account-types.ts
+++ b/backend/src/ee/services/pam-account/pam-account-types.ts
@@ -6,8 +6,10 @@ import { PamAccountOrderBy, PamAccountView } from "./pam-account-enums";
// DTOs
export type TCreateAccountDTO = Pick<
TPamAccount,
- "name" | "description" | "credentials" | "folderId" | "resourceId" | "rotationEnabled" | "rotationIntervalSeconds"
->;
+ "name" | "description" | "credentials" | "folderId" | "resourceId" | "rotationIntervalSeconds"
+> & {
+ rotationEnabled?: boolean;
+};
export type TUpdateAccountDTO = Partial<Omit<TCreateAccountDTO, "folderId" | "resourceId">> & {
accountId: string;