Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
requested changes
Daniel Hougaardcf9a622fb345
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex ed7c69a150..87587052cf 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -706,19 +706,19 @@ export const appConnectionServiceFactory = ({);}} else if (credentials && existingRotation) {- // Credentials were changed and rotation was torn down above — re-initialize- const existingRotateAtUtc = existingRotation.rotateAtUtc as { hours: number; minutes: number };- await appConnectionCredentialRotationService.createRotation(+ // Credentials were changed and rotation was torn down above — re-enable with updated config+ await appConnectionCredentialRotationService.updateRotation({connectionId,+ isAutoRotationEnabled: true,rotationInterval: rotation?.rotationInterval ?? existingRotation.rotationInterval,- rotateAtUtc: rotation?.rotateAtUtc ?? existingRotateAtUtc+ rotateAtUtc:+ rotation?.rotateAtUtc ?? (existingRotation.rotateAtUtc as { hours: number; minutes: number })},tx);- await appConnectionDAL.updateById(connectionId, { isAutoRotationEnabled: true }, tx);} else if (existingRotation && isAutoRotationEnabled === true) {- // Re-enabling rotation on a connection that was previously disabled (record preserved)+ // Re-enabling rotation on a connection that was previously disabledawait appConnectionCredentialRotationService.updateRotation({ connectionId, isAutoRotationEnabled: true, ...rotation },tx@@ -740,16 +740,16 @@ export const appConnectionServiceFactory = ({await appConnectionCredentialRotationService.updateRotation({ connectionId, ...rotation }, tx);}} else if (credentials && existingRotation) {- // Credentials changed but no rotation fields provided — re-initialize with previous config- await appConnectionCredentialRotationService.createRotation(+ // Credentials changed but no rotation fields provided — re-enable with previous config+ await appConnectionCredentialRotationService.updateRotation({connectionId,+ isAutoRotationEnabled: true,rotationInterval: existingRotation.rotationInterval,rotateAtUtc: existingRotation.rotateAtUtc as { hours: number; minutes: number }},tx);- await appConnectionDAL.updateById(connectionId, { isAutoRotationEnabled: true }, tx);}return connection;diff --git a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.tsindex 880b48ce2d..1e96dee364 100644--- a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts+++ b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts@@ -176,7 +176,8 @@ export const SanitizedAzureClientSecretsConnectionSchema = z.discriminatedUnion(method: z.literal(AzureClientSecretsConnectionMethod.ClientSecret),credentials: AzureClientSecretsConnectionClientSecretOutputCredentialsSchema.pick({clientId: true,- tenantId: true+ tenantId: true,+ clientSecretKeyId: true})}).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.AzureClientSecrets]} (Client Secret)` })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.tsindex d3030cc137..c303ed5490 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@@ -175,7 +175,7 @@ export const appConnectionCredentialRotationQueueFactory = async ({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`);+ rotationUrl = encodeURI(`${appCfg.SITE_URL}/organizations/${payload.orgId}/app-connections`);}const rotationType = payload.strategy;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.tsindex 91ddbae721..e297667167 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@@ -307,6 +307,10 @@ export const appConnectionCredentialRotationServiceFactory = ({await appConnectionDAL.updateById(connectionId, { isAutoRotationEnabled }, tx);}+ if (Object.keys(updateData).length === 0) {+ return expandCredentialRotation(existingRotation, connection.orgId, connection.projectId, kmsService);+ }+const updated = await appConnectionCredentialRotationDAL.updateById(existingRotation.id, updateData, tx);return expandCredentialRotation(updated, connection.orgId, connection.projectId, kmsService);};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsxindex 45ebd8c5a2..5c3cfc208c 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx@@ -123,14 +123,18 @@ const getDefaultValues = (appConnection?: TAzureClientSecretsConnection): Partia}break;case AzureClientSecretsConnectionMethod.ClientSecret:- if ("clientSecret" in credentials && "clientId" in credentials) {+ if ("clientId" in credentials) {return {...base,method: AzureClientSecretsConnectionMethod.ClientSecret,credentials: {- clientSecret: credentials.clientSecret,clientId: credentials.clientId,- tenantId: credentials.tenantId+ tenantId: credentials.tenantId,+ clientSecretKeyId:+ "clientSecretKeyId" in credentials+ ? (credentials.clientSecretKeyId as string | undefined)+ : undefined,+ clientSecret: ""}};}diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/shared/CrededentialRotationBadge.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/shared/CrededentialRotationBadge.tsxindex 4ca2cec877..11ff718b74 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/shared/CrededentialRotationBadge.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/shared/CrededentialRotationBadge.tsx@@ -1,7 +1,7 @@import { faXmark } from "@fortawesome/free-solid-svg-icons";import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";import { format, formatDistanceToNow } from "date-fns";-import { RefreshCwIcon, XIcon } from "lucide-react";+import { PauseIcon, RefreshCwIcon, XIcon } from "lucide-react";import { Tooltip } from "@app/components/v2";import { Badge } from "@app/components/v3";@@ -15,10 +15,19 @@ type Props = {export const CrededentialRotationStatusBadge = ({ appConnection }: Props) => {const { isAutoRotationEnabled, rotation } = appConnection;- if (!rotation || !isAutoRotationEnabled) {+ if (!rotation) {return null;}+ if (!isAutoRotationEnabled) {+ return (+ <Badge variant="neutral">+ <PauseIcon />+ Auto-Rotation Disabled+ </Badge>+ );+ }+if (rotation.rotationStatus === AppConnectionCredentialRotationStatus.Failed) {let errorMessage = rotation.lastRotationMessage;if (rotation.lastRotationMessage) {diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionRow.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionRow.tsxindex 9c1146b264..bef434f401 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionRow.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionRow.tsx@@ -8,6 +8,8 @@ import {faEdit,faEllipsisV,faInfoCircle,+ faPause,+ faPlay,faRotate,faTable,faTrash@@ -46,6 +48,7 @@ type Props = {onEditCredentials: (appConnection: TAppConnection) => void;onEditDetails: (appConnection: TAppConnection) => void;onRotateCredentials: (appConnection: TAppConnection) => void;+ onToggleAutoRotation: (appConnection: TAppConnection) => void;isProjectView: boolean;};@@ -55,6 +58,7 @@ export const AppConnectionRow = ({onEditCredentials,onEditDetails,onRotateCredentials,+ onToggleAutoRotation,isProjectView}: Props) => {const { currentOrg } = useOrganization();@@ -180,7 +184,7 @@ export const AppConnectionRow = ({</Tooltip>)}- {isAutoRotationEnabled && (+ {appConnection.rotation && (<CrededentialRotationStatusBadge appConnection={appConnection} />)}@@ -259,7 +263,7 @@ export const AppConnectionRow = ({</DropdownMenuItem>)}</VariablePermissionCan>- {isAutoRotationEnabled && (+ {appConnection.rotation && (<VariablePermissionCantype={isProjectView ? "project" : "org"}I={@@ -278,13 +282,26 @@ export const AppConnectionRow = ({}>{(isAllowed: boolean) => (- <DropdownMenuItem- isDisabled={!isAllowed}- icon={<FontAwesomeIcon icon={faRotate} />}- onClick={() => onRotateCredentials(appConnection)}- >- Rotate Credentials- </DropdownMenuItem>+ <>+ {isAutoRotationEnabled && (+ <DropdownMenuItem+ isDisabled={!isAllowed}+ icon={<FontAwesomeIcon icon={faRotate} />}+ onClick={() => onRotateCredentials(appConnection)}+ >+ Rotate Credentials+ </DropdownMenuItem>+ )}+ <DropdownMenuItem+ isDisabled={!isAllowed}+ icon={+ <FontAwesomeIcon icon={isAutoRotationEnabled ? faPause : faPlay} />+ }+ onClick={() => onToggleAutoRotation(appConnection)}+ >+ {isAutoRotationEnabled ? "Disable" : "Enable"} Auto-Rotation+ </DropdownMenuItem>+ </>)}</VariablePermissionCan>)}diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionsTable.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionsTable.tsxindex 14f12deeea..f5c6cd39c1 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionsTable.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionsTable.tsx@@ -47,7 +47,8 @@ import { usePagination, usePopUp, useResetPageHelper } from "@app/hooks";import {TAppConnection,useListAppConnections,- useRotateAppConnectionCredentials+ useRotateAppConnectionCredentials,+ useUpdateAppConnection} from "@app/hooks/api/appConnections";import { AppConnection } from "@app/hooks/api/appConnections/enums";import { OrderByDirection } from "@app/hooks/api/generic/types";@@ -86,6 +87,7 @@ export const AppConnectionsTable = ({ projectId, projectType }: Props) => {const isProjectView = Boolean(projectId);const { isPending, data: appConnections = [] } = useListAppConnections(projectId);const rotateCredentials = useRotateAppConnectionCredentials();+ const updateAppConnection = useUpdateAppConnection();const { popUp, handlePopUpOpen, handlePopUpToggle } = usePopUp(["addConnection",@@ -233,6 +235,31 @@ export const AppConnectionsTable = ({ projectId, projectType }: Props) => {);};+ const handleToggleAutoRotation = (appConnection: TAppConnection) => {+ const enabling = !appConnection.isAutoRotationEnabled;+ updateAppConnection.mutate(+ {+ connectionId: appConnection.id,+ app: appConnection.app,+ isAutoRotationEnabled: enabling+ },+ {+ onSuccess: () => {+ createNotification({+ text: `Auto-rotation ${enabling ? "enabled" : "disabled"}`,+ type: "success"+ });+ },+ onError: (error) => {+ createNotification({+ text: `Failed to ${enabling ? "enable" : "disable"} auto-rotation: ${error.message}`,+ type: "error"+ });+ }+ }+ );+ };+return (<div className="rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"><div className="mb-4 flex flex-wrap items-center justify-between gap-2">@@ -442,6 +469,7 @@ export const AppConnectionsTable = ({ projectId, projectType }: Props) => {onEditCredentials={handleEditCredentials}onEditDetails={handleEditDetails}onRotateCredentials={handleRotateCredentials}+ onToggleAutoRotation={handleToggleAutoRotation}isProjectView={isProjectView}/>))}