Skip to content

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

Make rotationIntervalSeconds nullable

x03220585daaf806e53
diff --git a/backend/src/db/migrations/20251015042917_pam-account-rotation.ts b/backend/src/db/migrations/20251015042917_pam-account-rotation.ts
index eee9fd1fdd..4e9fc90d46 100644
--- a/backend/src/db/migrations/20251015042917_pam-account-rotation.ts
+++ b/backend/src/db/migrations/20251015042917_pam-account-rotation.ts
@@ -10,7 +10,7 @@ export async function up(knex: Knex): Promise<void> {
) {
await knex.schema.alterTable(TableName.PamAccount, (t) => {
t.boolean("rotationEnabled").notNullable().defaultTo(false);
- t.integer("rotationIntervalSeconds").notNullable();
+ t.integer("rotationIntervalSeconds").nullable();
t.timestamp("lastRotatedAt").nullable();
});
}
diff --git a/backend/src/db/schemas/pam-accounts.ts b/backend/src/db/schemas/pam-accounts.ts
index 9bcfa5cec1..7e78e0874b 100644
--- a/backend/src/db/schemas/pam-accounts.ts
+++ b/backend/src/db/schemas/pam-accounts.ts
@@ -20,7 +20,7 @@ export const PamAccountsSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
rotationEnabled: z.boolean().default(false),
- rotationIntervalSeconds: z.number().default(2592000),
+ rotationIntervalSeconds: z.number().nullable().optional(),
lastRotatedAt: z.date().nullable().optional()
});
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 dccaaa8ca9..44e2a5ea11 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
@@ -23,7 +23,7 @@ export const registerPamResourceEndpoints = <C extends TPamAccount>({
name: C["name"];
description?: C["description"];
rotationEnabled: C["rotationEnabled"];
- rotationIntervalSeconds: C["rotationIntervalSeconds"];
+ rotationIntervalSeconds?: C["rotationIntervalSeconds"];
}>;
updateAccountSchema: z.ZodType<{
credentials?: C["credentials"];
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 94561e6d8e..8569d764bc 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -3798,7 +3798,7 @@ interface PamAccountCreateEvent {
name: string;
description?: string | null;
rotationEnabled: boolean;
- rotationIntervalSeconds: number;
+ rotationIntervalSeconds?: number | null;
};
}
@@ -3811,7 +3811,7 @@ interface PamAccountUpdateEvent {
name?: string;
description?: string | null;
rotationEnabled?: boolean;
- rotationIntervalSeconds?: number;
+ rotationIntervalSeconds?: number | null;
};
}
diff --git a/backend/src/ee/services/pam-account/pam-account-dal.ts b/backend/src/ee/services/pam-account/pam-account-dal.ts
index e0377871cf..4c8f5136a7 100644
--- a/backend/src/ee/services/pam-account/pam-account-dal.ts
+++ b/backend/src/ee/services/pam-account/pam-account-dal.ts
@@ -49,6 +49,7 @@ export const pamAccountDALFactory = (db: TDbClient) => {
const accounts = await dbClient(TableName.PamAccount)
.innerJoin(TableName.PamResource, `${TableName.PamAccount}.resourceId`, `${TableName.PamResource}.id`)
.whereNotNull(`${TableName.PamResource}.encryptedRotationAccountCredentials`)
+ .whereNotNull(`${TableName.PamAccount}.rotationIntervalSeconds`)
.whereRaw(
`COALESCE("${TableName.PamAccount}"."lastRotatedAt", "${TableName.PamAccount}"."createdAt") + "${TableName.PamAccount}"."rotationIntervalSeconds" * interval '1 second' < NOW()`
)
diff --git a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
index 8f4752f4e6..7f6165d88c 100644
--- a/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
+++ b/backend/src/ee/services/pam-resource/pam-resource-schemas.ts
@@ -42,12 +42,12 @@ export const BaseCreatePamAccountSchema = z.object({
name: slugSchema({ field: "name" }),
description: z.string().max(512).nullable().optional(),
rotationEnabled: z.boolean(),
- rotationIntervalSeconds: z.number().min(3600)
+ rotationIntervalSeconds: z.number().min(3600).nullable().optional()
});
export const BaseUpdatePamAccountSchema = z.object({
name: slugSchema({ field: "name" }).optional(),
description: z.string().max(512).nullable().optional(),
rotationEnabled: z.boolean().optional(),
- rotationIntervalSeconds: z.number().min(3600).optional()
+ rotationIntervalSeconds: z.number().min(3600).nullable().optional()
});
diff --git a/frontend/src/hooks/api/pam/types/base-account.ts b/frontend/src/hooks/api/pam/types/base-account.ts
index 09ad6550df..20cb7aa606 100644
--- a/frontend/src/hooks/api/pam/types/base-account.ts
+++ b/frontend/src/hooks/api/pam/types/base-account.ts
@@ -14,7 +14,7 @@ export interface TBasePamAccount {
name: string;
description?: string | null;
rotationEnabled: boolean;
- rotationIntervalSeconds: number;
+ rotationIntervalSeconds?: number | null;
lastRotatedAt?: string | null;
createdAt: string;
updatedAt: string;
diff --git a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
index 2739e1cd5c..a73fad58bb 100644
--- a/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
+++ b/frontend/src/pages/pam/PamAccountsPage/components/PamAccountForm/RotateAccountFields.tsx
@@ -6,7 +6,7 @@ import { FormControl, Select, SelectItem, Switch, Tooltip } from "@app/component
export const rotateAccountFieldsSchema = z.object({
rotationEnabled: z.boolean(),
- rotationIntervalSeconds: z.number()
+ rotationIntervalSeconds: z.number().nullable().optional()
});
export const RotateAccountFields = ({
@@ -16,7 +16,7 @@ export const RotateAccountFields = ({
}) => {
const { control, watch } = useFormContext<{
rotationEnabled: boolean;
- rotationIntervalSeconds: number;
+ rotationIntervalSeconds?: number | null;
}>();
const rotationEnabled = watch("rotationEnabled");
@@ -62,7 +62,7 @@ export const RotateAccountFields = ({
className="mb-0"
>
<Select
- value={value.toString()}
+ value={(value || 2592000).toString()}
onValueChange={(val) => onChange(parseInt(val, 10))}
className="w-full border border-mineshaft-500 capitalize"
position="popper"