Skip to content

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

fix: addressed requested changes

Daniel Hougaard49bfbcc310b2
diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.ts
index 9e6b118add..8f9b7aab97 100644
--- a/backend/src/ee/services/permission/default-roles.ts
+++ b/backend/src/ee/services/permission/default-roles.ts
@@ -367,7 +367,8 @@ const buildAdminPermissionRules = () => {
ProjectPermissionAppConnectionActions.Edit,
ProjectPermissionAppConnectionActions.Delete,
ProjectPermissionAppConnectionActions.Read,
- ProjectPermissionAppConnectionActions.Connect
+ ProjectPermissionAppConnectionActions.Connect,
+ ProjectPermissionAppConnectionActions.RotateCredentials
],
ProjectPermissionSub.AppConnections
);
diff --git a/backend/src/ee/services/permission/org-permission.ts b/backend/src/ee/services/permission/org-permission.ts
index 1c58b6c07c..dba765d347 100644
--- a/backend/src/ee/services/permission/org-permission.ts
+++ b/backend/src/ee/services/permission/org-permission.ts
@@ -36,7 +36,8 @@ export enum OrgPermissionAppConnectionActions {
Create = "create",
Edit = "edit",
Delete = "delete",
- Connect = "connect"
+ Connect = "connect",
+ RotateCredentials = "rotate-credentials"
}
export enum OrgPermissionAuditLogsActions {
@@ -432,6 +433,7 @@ const buildAdminPermission = () => {
can(OrgPermissionAppConnectionActions.Edit, OrgPermissionSubjects.AppConnections);
can(OrgPermissionAppConnectionActions.Delete, OrgPermissionSubjects.AppConnections);
can(OrgPermissionAppConnectionActions.Connect, OrgPermissionSubjects.AppConnections);
+ can(OrgPermissionAppConnectionActions.RotateCredentials, OrgPermissionSubjects.AppConnections);
can(OrgPermissionGatewayActions.ListGateways, OrgPermissionSubjects.Gateway);
can(OrgPermissionGatewayActions.CreateGateways, OrgPermissionSubjects.Gateway);
diff --git a/backend/src/ee/services/permission/project-permission.ts b/backend/src/ee/services/permission/project-permission.ts
index cdb679fac5..9bbcc1f82f 100644
--- a/backend/src/ee/services/permission/project-permission.ts
+++ b/backend/src/ee/services/permission/project-permission.ts
@@ -215,7 +215,8 @@ export enum ProjectPermissionAppConnectionActions {
Create = "create-app-connections",
Edit = "edit-app-connections",
Delete = "delete-app-connections",
- Connect = "connect-app-connections"
+ Connect = "connect-app-connections",
+ RotateCredentials = "rotate-credentials"
}
export enum ProjectPermissionSecretScanningFindingActions {
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index aa04e878de..3661c2c9ed 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -2623,7 +2623,12 @@ export const registerRoutes = async (
await appConnectionCredentialRotationQueueFactory({
queueService,
appConnectionCredentialRotationDAL,
- appConnectionCredentialRotationService
+ appConnectionCredentialRotationService,
+ smtpService,
+ notificationService,
+ projectMembershipDAL,
+ projectDAL,
+ orgDAL
});
const secretScanningV2Queue = secretScanningV2QueueServiceFactory({
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index a3e73d883d..ed7c69a150 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -1002,7 +1002,7 @@ export const appConnectionServiceFactory = ({
});
ForbiddenError.from(permission).throwUnlessCan(
- ProjectPermissionAppConnectionActions.Edit,
+ ProjectPermissionAppConnectionActions.RotateCredentials,
subject(ProjectPermissionSub.AppConnections, { connectionId })
);
} else {
@@ -1016,7 +1016,7 @@ export const appConnectionServiceFactory = ({
});
ForbiddenError.from(permission).throwUnlessCan(
- OrgPermissionAppConnectionActions.Edit,
+ OrgPermissionAppConnectionActions.RotateCredentials,
subject(OrgPermissionSubjects.AppConnections, { connectionId })
);
}
diff --git a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts
index 1700f68ce6..d3030cc137 100644
--- a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts
+++ b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-queue.ts
@@ -1,8 +1,15 @@
import { v4 as uuidv4 } from "uuid";
+import { OrgMembershipRole, ProjectMembershipRole } from "@app/db/schemas";
import { getConfig } from "@app/lib/config/env";
import { logger } from "@app/lib/logger";
import { QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
+import { TNotificationServiceFactory } from "@app/services/notification/notification-service";
+import { NotificationType } from "@app/services/notification/notification-types";
+import { TOrgDALFactory } from "@app/services/org/org-dal";
+import { TProjectDALFactory } from "@app/services/project/project-dal";
+import { TProjectMembershipDALFactory } from "@app/services/project-membership/project-membership-dal";
+import { SmtpTemplates, TSmtpService } from "@app/services/smtp/smtp-service";
import { TAppConnectionCredentialRotationDALFactory } from "./app-connection-credential-rotation-dal";
import { getCredentialRotationJobOptions, getNextUtcRotationInterval } from "./app-connection-credential-rotation-fns";
@@ -19,12 +26,22 @@ type TAppConnectionCredentialRotationQueueFactoryDep = {
"findRotationsDueForQueue" | "findByIdWithConnection"
>;
appConnectionCredentialRotationService: Pick<TAppConnectionCredentialRotationServiceFactory, "rotateCredentials">;
+ smtpService: Pick<TSmtpService, "sendMail">;
+ notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;
+ projectMembershipDAL: Pick<TProjectMembershipDALFactory, "findAllProjectMembers">;
+ projectDAL: Pick<TProjectDALFactory, "findById">;
+ orgDAL: Pick<TOrgDALFactory, "findAllOrgMembers">;
};
export const appConnectionCredentialRotationQueueFactory = async ({
queueService,
appConnectionCredentialRotationDAL,
- appConnectionCredentialRotationService
+ appConnectionCredentialRotationService,
+ smtpService,
+ notificationService,
+ projectMembershipDAL,
+ projectDAL,
+ orgDAL
}: TAppConnectionCredentialRotationQueueFactoryDep) => {
const appCfg = getConfig();
@@ -63,7 +80,7 @@ export const appConnectionCredentialRotationQueueFactory = async ({
await appConnectionCredentialRotationService.rotateCredentials(rotationId, {
jobId: job.id || uuidv4(),
shouldSendNotification: true,
- isFinalAttempt: retryCount === retryLimit,
+ isFinalAttempt: retryCount + 1 >= retryLimit,
isManualRotation
});
@@ -130,10 +147,64 @@ export const appConnectionCredentialRotationQueueFactory = async ({
try {
logger.info(`credentialRotationQueue: Sending Failure Notification [connectionId=${payload.connectionId}]`);
- // Notification sending can be expanded later with email + in-app notifications
- logger.warn(
- `credentialRotationQueue: Credential rotation failed for connection "${payload.connectionName}" (strategy: ${payload.strategy}). Last attempt: ${payload.lastRotationAttemptedAt.toISOString()}`
+ let adminEmails: string[] = [];
+ let adminUserIds: string[] = [];
+ let projectName: string | undefined;
+ let rotationUrl: string;
+
+ if (payload.projectId) {
+ // Project-scoped connection: notify project admins
+ const projectMembers = await projectMembershipDAL.findAllProjectMembers(payload.projectId);
+ const project = await projectDAL.findById(payload.projectId);
+
+ const projectAdmins = projectMembers.filter((member) =>
+ member.roles.some((role) => role.role === ProjectMembershipRole.Admin)
+ );
+
+ adminEmails = projectAdmins.map((admin) => admin.user.email!).filter(Boolean);
+ adminUserIds = projectAdmins.map((admin) => admin.userId);
+ projectName = project.name;
+ rotationUrl = encodeURI(
+ `${appCfg.SITE_URL}/organizations/${payload.orgId}/projects/secret-management/${payload.projectId}/app-connections`
+ );
+ } else {
+ // Org-scoped connection: notify org admins
+ const orgMembers = await orgDAL.findAllOrgMembers(payload.orgId);
+
+ const orgAdmins = orgMembers.filter((member) => member.role === OrgMembershipRole.Admin);
+
+ adminEmails = orgAdmins.map((admin) => admin.user.email!).filter(Boolean);
+ adminUserIds = orgAdmins.map((admin) => admin.user.id);
+ rotationUrl = encodeURI(`${appCfg.SITE_URL}/organizations/${payload.orgId}/settings/app-connections`);
+ }
+
+ const rotationType = payload.strategy;
+
+ await notificationService.createUserNotifications(
+ adminUserIds.map((userId) => ({
+ userId,
+ orgId: payload.orgId,
+ type: NotificationType.CREDENTIAL_ROTATION_FAILED,
+ title: "Credential Rotation Failed",
+ body: `Your **${rotationType}** credential rotation for connection **${payload.connectionName}** failed to rotate.`,
+ link: rotationUrl
+ }))
);
+
+ await smtpService.sendMail({
+ recipients: adminEmails,
+ template: SmtpTemplates.CredentialRotationFailed,
+ subjectLine: "Credential Rotation Failed",
+ substitutions: {
+ connectionName: payload.connectionName,
+ rotationType,
+ content: `Your ${rotationType} credential rotation failed during its scheduled rotation. The last rotation attempt occurred at ${new Date(
+ payload.lastRotationAttemptedAt
+ ).toISOString()}. Please check the rotation status in Infisical for more details.`,
+ projectName,
+ rotationUrl
+ }
+ });
} catch (error) {
logger.error(
error,
diff --git a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-schemas.ts b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-schemas.ts
index d36d8c7e5a..4f59c84220 100644
--- a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-schemas.ts
+++ b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-schemas.ts
@@ -1,8 +1,8 @@
import { z } from "zod";
export const AppConnectionCredentialRotationRotateAtUtcSchema = z.object({
- hours: z.number().int().min(0).max(23).describe("The hour (0-23) at which to rotate."),
- minutes: z.number().int().min(0).max(59).describe("The minute (0-59) at which to rotate.")
+ hours: z.number().int().min(0).max(23).describe("The hour (0-23) at which to rotate (UTC timezone)."),
+ minutes: z.number().int().min(0).max(59).describe("The minute (0-59) at which to rotate (UTC timezone).")
});
export const CreateAppConnectionCredentialRotationSchema = z.object({
diff --git a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-service.ts b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-service.ts
index c39b61f4ab..91ddbae721 100644
--- a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-service.ts
+++ b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-service.ts
@@ -232,7 +232,7 @@ export const appConnectionCredentialRotationServiceFactory = ({
* Update credential rotation config for a connection.
* Permission checks are handled by the caller.
*/
- const updateRotation = async (dto: TUpdateAppConnectionCredentialRotationDTO, tx?: Knex) => {
+ const updateRotation = async (dto: TUpdateAppConnectionCredentialRotationDTO, tx: Knex) => {
const { connectionId, rotationInterval, rotateAtUtc, isAutoRotationEnabled } = dto;
const connection = await appConnectionDAL.findById(connectionId, tx);
@@ -245,16 +245,8 @@ export const appConnectionCredentialRotationServiceFactory = ({
// If disabling auto rotation, preserve the rotation record but null out nextRotationAt so cron won't pick it up
if (isAutoRotationEnabled === false) {
- const disable = async (trx: Knex) => {
- await appConnectionDAL.updateById(connectionId, { isAutoRotationEnabled: false }, trx);
- await appConnectionCredentialRotationDAL.updateById(existingRotation.id, { nextRotationAt: null }, trx);
- };
-
- if (tx) {
- await disable(tx);
- } else {
- await appConnectionDAL.transaction(disable);
- }
+ await appConnectionDAL.updateById(connectionId, { isAutoRotationEnabled: false }, tx);
+ await appConnectionCredentialRotationDAL.updateById(existingRotation.id, { nextRotationAt: null }, tx);
return null;
}
@@ -499,13 +491,13 @@ export const appConnectionCredentialRotationServiceFactory = ({
if (inactiveCredential) {
try {
logger.info(
- `credentialRotation: Revoking old credential keyId=${inactiveCredential.keyId} at index=${inactiveIndex} [rotationId=${rotationId}]`
+ `credentialRotation: Revoking old credential [inactive-index=${inactiveIndex}] [rotationId=${rotationId}]`
);
await provider.revokeCredential(inactiveCredential, config, parsedCredentials.data);
} catch (revokeError) {
logger.warn(
revokeError,
- `credentialRotation: Failed to revoke old credential keyId=${inactiveCredential.keyId} [rotationId=${rotationId}] — will retry on next cycle`
+ `credentialRotation: Failed to revoke old credential [inactive-index=${inactiveIndex}] [rotationId=${rotationId}] — will retry on next cycle`
);
}
}
@@ -555,6 +547,7 @@ export const appConnectionCredentialRotationServiceFactory = ({
connectionId,
connectionName,
orgId,
+ projectId: connection?.projectId,
strategy,
lastRotationAttemptedAt: now
},
diff --git a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-types.ts b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-types.ts
index d4c6ef557c..b226bb2e7d 100644
--- a/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-types.ts
+++ b/backend/src/services/app-connection/credential-rotation/app-connection-credential-rotation-types.ts
@@ -109,6 +109,7 @@ export type TAppConnectionCredentialRotationSendNotificationJobPayload = {
connectionId: string;
connectionName: string;
orgId: string;
+ projectId?: string | null;
strategy: string;
lastRotationAttemptedAt: Date;
};
diff --git a/backend/src/services/notification/notification-types.ts b/backend/src/services/notification/notification-types.ts
index a788c68712..e75aa87868 100644
--- a/backend/src/services/notification/notification-types.ts
+++ b/backend/src/services/notification/notification-types.ts
@@ -19,7 +19,8 @@ export enum NotificationType {
GATEWAY_HEALTH_ALERT = "gateway-health-alert",
RELAY_HEALTH_ALERT = "relay-health-alert",
APPROVAL_REQUIRED = "approval-required",
- PKI_ALERT_CHANNEL_FAILED = "pki-alert-channel-failed"
+ PKI_ALERT_CHANNEL_FAILED = "pki-alert-channel-failed",
+ CREDENTIAL_ROTATION_FAILED = "credential-rotation-failed"
}
export interface TCreateUserNotificationDTO {
diff --git a/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx b/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx
new file mode 100644
index 0000000000..91bab46931
--- /dev/null
+++ b/backend/src/services/smtp/emails/CredentialRotationFailedTemplate.tsx
@@ -0,0 +1,63 @@
+import { Heading, Section, Text } from "@react-email/components";
+import React from "react";
+
+import { BaseButton } from "./BaseButton";
+import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";
+
+interface CredentialRotationFailedTemplateProps extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {
+ rotationType: string;
+ connectionName: string;
+ rotationUrl: string;
+ projectName?: string;
+ content: string;
+}
+
+export const CredentialRotationFailedTemplate = ({
+ rotationType,
+ connectionName,
+ rotationUrl,
+ projectName,
+ siteUrl,
+ content
+}: CredentialRotationFailedTemplateProps) => {
+ return (
+ <BaseEmailWrapper
+ title="Credential Rotation Failed"
+ preview="A credential rotation failed."
+ siteUrl={siteUrl}
+ >
+ <Heading className="text-black text-[18px] leading-[28px] text-center font-normal p-0 mx-0">
+ Your <strong>{rotationType}</strong> credential rotation for connection{" "}
+ <strong>{connectionName}</strong> failed to rotate
+ </Heading>
+ <Section className="px-[24px] mb-[28px] mt-[36px] pt-[26px] pb-[4px] text-[14px] border border-solid border-gray-200 rounded-md bg-gray-50">
+ <strong>Connection</strong>
+ <Text className="text-[14px] mt-[4px]">{connectionName}</Text>
+ <strong>Type</strong>
+ <Text className="text-[14px] mt-[4px]">{rotationType}</Text>
+ {projectName && (
+ <>
+ <strong>Project</strong>
+ <Text className="text-[14px] mt-[4px]">{projectName}</Text>
+ </>
+ )}
+ <strong>Reason:</strong>
+ <Text className="text-[14px] text-red-600 mt-[4px]">{content}</Text>
+ </Section>
+ <Section className="text-center">
+ <BaseButton href={rotationUrl}>View in Infisical</BaseButton>
+ </Section>
+ </BaseEmailWrapper>
+ );
+};
+
+export default CredentialRotationFailedTemplate;
+
+CredentialRotationFailedTemplate.PreviewProps = {
+ rotationType: "Azure Client Secret",
+ connectionName: "my-azure-connection",
+ rotationUrl: "https://infisical.com",
+ content: "See Rotation status for details",
+ projectName: "Example Project",
+ siteUrl: "https://infisical.com"
+} as CredentialRotationFailedTemplateProps;
diff --git a/backend/src/services/smtp/emails/index.ts b/backend/src/services/smtp/emails/index.ts
index d7e3a6f500..5f347c56b2 100644
--- a/backend/src/services/smtp/emails/index.ts
+++ b/backend/src/services/smtp/emails/index.ts
@@ -1,6 +1,7 @@
export * from "./AccessApprovalRequestTemplate";
export * from "./AccessApprovalRequestUpdatedTemplate";
export * from "./AccountDeletionConfirmationTemplate";
+export * from "./CredentialRotationFailedTemplate";
export * from "./EmailMfaTemplate";
export * from "./EmailVerificationTemplate";
export * from "./ExternalImportFailedTemplate";
diff --git a/backend/src/services/smtp/smtp-service.ts b/backend/src/services/smtp/smtp-service.ts
index ab1fe6ce9f..4e37013726 100644
--- a/backend/src/services/smtp/smtp-service.ts
+++ b/backend/src/services/smtp/smtp-service.ts
@@ -10,6 +10,7 @@ import {
AccessApprovalRequestTemplate,
AccessApprovalRequestUpdatedTemplate,
AccountDeletionConfirmationTemplate,
+ CredentialRotationFailedTemplate,
EmailMfaTemplate,
EmailVerificationTemplate,
ExternalImportFailedTemplate,
@@ -95,7 +96,8 @@ export enum SmtpTemplates {
SecretScanningV2SecretsDetected = "secretScanningV2SecretsDetected",
AccountDeletionConfirmation = "accountDeletionConfirmation",
HealthAlert = "healthAlert",
- DynamicSecretLeaseRevocationFailed = "dynamicSecretLeaseRevocationFailed"
+ DynamicSecretLeaseRevocationFailed = "dynamicSecretLeaseRevocationFailed",
+ CredentialRotationFailed = "credentialRotationFailed"
}
export enum SmtpHost {
@@ -146,7 +148,8 @@ const EmailTemplateMap: Record<SmtpTemplates, React.FC<any>> = {
[SmtpTemplates.SecretScanningV2SecretsDetected]: SecretScanningSecretsDetectedTemplate,
[SmtpTemplates.AccountDeletionConfirmation]: AccountDeletionConfirmationTemplate,
[SmtpTemplates.HealthAlert]: HealthAlertTemplate,
- [SmtpTemplates.DynamicSecretLeaseRevocationFailed]: DynamicSecretLeaseRevocationFailedTemplate
+ [SmtpTemplates.DynamicSecretLeaseRevocationFailed]: DynamicSecretLeaseRevocationFailedTemplate,
+ [SmtpTemplates.CredentialRotationFailed]: CredentialRotationFailedTemplate
};
export const smtpServiceFactory = (cfg: TSmtpConfig) => {
diff --git a/frontend/src/context/OrgPermissionContext/types.ts b/frontend/src/context/OrgPermissionContext/types.ts
index e231f21679..7efbc0d9fb 100644
--- a/frontend/src/context/OrgPermissionContext/types.ts
+++ b/frontend/src/context/OrgPermissionContext/types.ts
@@ -87,7 +87,8 @@ export enum OrgPermissionAppConnectionActions {
Create = "create",
Edit = "edit",
Delete = "delete",
- Connect = "connect"
+ Connect = "connect",
+ RotateCredentials = "rotate-credentials"
}
export enum OrgPermissionAuditLogsActions {
diff --git a/frontend/src/context/ProjectPermissionContext/types.ts b/frontend/src/context/ProjectPermissionContext/types.ts
index 18074ce882..1c1e40d94e 100644
--- a/frontend/src/context/ProjectPermissionContext/types.ts
+++ b/frontend/src/context/ProjectPermissionContext/types.ts
@@ -224,7 +224,8 @@ export enum ProjectPermissionAppConnectionActions {
Create = "create-app-connections",
Edit = "edit-app-connections",
Delete = "delete-app-connections",
- Connect = "connect-app-connections"
+ Connect = "connect-app-connections",
+ RotateCredentials = "rotate-credentials"
}
export enum PermissionConditionOperators {
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
index 961c9ea077..0f43ad6126 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
+++ b/frontend/src/pages/organization/RoleByIDPage/components/OrgRoleModifySection.utils.ts
@@ -46,7 +46,8 @@ const appConnectionsPermissionSchema = z
[OrgPermissionAppConnectionActions.Edit]: z.boolean().optional(),
[OrgPermissionAppConnectionActions.Create]: z.boolean().optional(),
[OrgPermissionAppConnectionActions.Delete]: z.boolean().optional(),
- [OrgPermissionAppConnectionActions.Connect]: z.boolean().optional()
+ [OrgPermissionAppConnectionActions.Connect]: z.boolean().optional(),
+ [OrgPermissionAppConnectionActions.RotateCredentials]: z.boolean().optional()
})
.optional();
diff --git a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionAppConnectionRow.tsx b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionAppConnectionRow.tsx
index b8e13af69f..ead37e75f2 100644
--- a/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionAppConnectionRow.tsx
+++ b/frontend/src/pages/organization/RoleByIDPage/components/RolePermissionsSection/OrgPermissionAppConnectionRow.tsx
@@ -28,7 +28,8 @@ const PERMISSION_ACTIONS = [
{ action: OrgPermissionAppConnectionActions.Create, label: "Create" },
{ action: OrgPermissionAppConnectionActions.Edit, label: "Modify" },
{ action: OrgPermissionAppConnectionActions.Delete, label: "Remove" },
- { action: OrgPermissionAppConnectionActions.Connect, label: "Connect" }
+ { action: OrgPermissionAppConnectionActions.Connect, label: "Connect" },
+ { action: OrgPermissionAppConnectionActions.RotateCredentials, label: "Rotate Credentials" }
] as const;
export const OrgPermissionAppConnectionRow = ({ isEditable, control, setValue }: Props) => {
@@ -83,7 +84,8 @@ export const OrgPermissionAppConnectionRow = ({ isEditable, control, setValue }:
[OrgPermissionAppConnectionActions.Edit]: true,
[OrgPermissionAppConnectionActions.Create]: true,
[OrgPermissionAppConnectionActions.Delete]: true,
- [OrgPermissionAppConnectionActions.Connect]: true
+ [OrgPermissionAppConnectionActions.Connect]: true,
+ [OrgPermissionAppConnectionActions.RotateCredentials]: true
},
{ shouldDirty: true }
);
@@ -96,7 +98,8 @@ export const OrgPermissionAppConnectionRow = ({ isEditable, control, setValue }:
[OrgPermissionAppConnectionActions.Edit]: false,
[OrgPermissionAppConnectionActions.Create]: false,
[OrgPermissionAppConnectionActions.Delete]: false,
- [OrgPermissionAppConnectionActions.Connect]: false
+ [OrgPermissionAppConnectionActions.Connect]: false,
+ [OrgPermissionAppConnectionActions.RotateCredentials]: false
},
{ shouldDirty: true }
);
@@ -111,7 +114,8 @@ export const OrgPermissionAppConnectionRow = ({ isEditable, control, setValue }:
[OrgPermissionAppConnectionActions.Edit]: false,
[OrgPermissionAppConnectionActions.Create]: false,
[OrgPermissionAppConnectionActions.Delete]: false,
- [OrgPermissionAppConnectionActions.Connect]: false
+ [OrgPermissionAppConnectionActions.Connect]: false,
+ [OrgPermissionAppConnectionActions.RotateCredentials]: false
},
{ shouldDirty: true }
);
diff --git a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
index af9b03e8e5..6c5105980e 100644
--- a/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
+++ b/frontend/src/pages/project/RoleDetailsBySlugPage/components/ProjectRoleModifySection.utils.tsx
@@ -171,7 +171,8 @@ const AppConnectionPolicyActionSchema = z.object({
[ProjectPermissionAppConnectionActions.Read]: z.boolean().optional(),
[ProjectPermissionAppConnectionActions.Edit]: z.boolean().optional(),
[ProjectPermissionAppConnectionActions.Delete]: z.boolean().optional(),
- [ProjectPermissionAppConnectionActions.Connect]: z.boolean().optional()
+ [ProjectPermissionAppConnectionActions.Connect]: z.boolean().optional(),
+ [ProjectPermissionAppConnectionActions.RotateCredentials]: z.boolean().optional()
});
const KmipPolicyActionSchema = z.object({
@@ -1176,6 +1177,9 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
const canEdit = action.includes(ProjectPermissionAppConnectionActions.Edit);
const canDelete = action.includes(ProjectPermissionAppConnectionActions.Delete);
const canConnect = action.includes(ProjectPermissionAppConnectionActions.Connect);
+ const canRotateCredentials = action.includes(
+ ProjectPermissionAppConnectionActions.RotateCredentials
+ );
// from above statement we are sure it won't be undefined
formVal[subject]!.push({
@@ -1184,6 +1188,7 @@ export const rolePermission2Form = (permissions: TProjectPermission[] = []) => {
[ProjectPermissionAppConnectionActions.Edit]: canEdit,
[ProjectPermissionAppConnectionActions.Delete]: canDelete,
[ProjectPermissionAppConnectionActions.Connect]: canConnect,
+ [ProjectPermissionAppConnectionActions.RotateCredentials]: canRotateCredentials,
conditions: conditions ? convertCaslConditionToFormOperator(conditions) : [],
inverted
});
@@ -2992,6 +2997,11 @@ export const PROJECT_PERMISSION_OBJECT: TProjectPermissionObject = {
label: "Connect",
value: ProjectPermissionAppConnectionActions.Connect,
description: "Establish connections to external platforms and services"
+ },
+ {
+ label: "Rotate Credentials",
+ value: ProjectPermissionAppConnectionActions.RotateCredentials,
+ description: "Rotate credentials for app connections"
}
]
},