Skip to content

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

feat: add endpoint to check if org user should receive the deprecation banner

adilson067795f47213
diff --git a/backend/src/server/routes/v1/integration-router.ts b/backend/src/server/routes/v1/integration-router.ts
index f7954b7a19..41f66466bd 100644
--- a/backend/src/server/routes/v1/integration-router.ts
+++ b/backend/src/server/routes/v1/integration-router.ts
@@ -418,4 +418,29 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
return { integration };
}
});
+
+ server.route({
+ method: "GET",
+ url: "/deprecation-status",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ // internal: backs the deprecation banner in the UI, not part of the public API surface
+ hide: true,
+ response: {
+ 200: z.object({
+ hasNativeIntegrations: z.boolean()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) =>
+ server.services.integration.getDeprecationStatus({
+ actor: req.permission.type,
+ actorId: req.permission.id,
+ actorAuthMethod: req.permission.authMethod,
+ actorOrgId: req.permission.orgId
+ })
+ });
};
diff --git a/backend/src/services/integration/integration-dal.ts b/backend/src/services/integration/integration-dal.ts
index c25f94065d..36e8fd26ca 100644
--- a/backend/src/services/integration/integration-dal.ts
+++ b/backend/src/services/integration/integration-dal.ts
@@ -206,8 +206,6 @@ export const integrationDALFactory = (db: TDbClient) => {
// native integrations are deprecated in favour of secret syncs — the three helpers below back the monthly
// deprecation notice, which enumerates every org still holding one.
- // filters Environment.deleteAfter AND Project.deleteAfter: an environment soft-delete does not imply a
- // project soft-delete, so a cross-project enumeration has to exclude both independently.
const liveOrgIntegrationQuery = (conn: Knex) =>
conn(TableName.Integration)
.join(TableName.Environment, `${TableName.Integration}.envId`, `${TableName.Environment}.id`)
diff --git a/backend/src/services/integration/integration-deprecation-queue.ts b/backend/src/services/integration/integration-deprecation-queue.ts
index 27efb3d066..5f4b820302 100644
--- a/backend/src/services/integration/integration-deprecation-queue.ts
+++ b/backend/src/services/integration/integration-deprecation-queue.ts
@@ -37,7 +37,7 @@ type TIntegrationDeprecationQueueFactoryDep = {
export type TIntegrationDeprecationQueueFactory = ReturnType<typeof integrationDeprecationQueueFactory>;
-const NOTICE_SUBJECT = "Action recommended: native integrations are moving to Secret Syncs";
+const NOTICE_SUBJECT = "Action recommended: move native integrations to Secret Syncs";
const NOTICE_BODY =
"Native integrations are deprecated. Secret Syncs are the maintained replacement and cover the same third-party services.";
diff --git a/backend/src/services/integration/integration-service.ts b/backend/src/services/integration/integration-service.ts
index af66dcfd57..f9351549bc 100644
--- a/backend/src/services/integration/integration-service.ts
+++ b/backend/src/services/integration/integration-service.ts
@@ -1,6 +1,7 @@
import { ForbiddenError } from "@casl/ability";
-import { ActionProjectType } from "@app/db/schemas";
+import { ActionProjectType, OrganizationActionScope } from "@app/db/schemas";
+import { OrgPermissionActions, OrgPermissionSubjects } from "@app/ee/services/permission/org-permission";
import { throwIfMissingSecretReadValueOrDescribePermission } from "@app/ee/services/permission/permission-fns";
import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";
import {
@@ -29,6 +30,7 @@ import { TIntegrationDALFactory } from "./integration-dal";
import {
TCreateIntegrationDTO,
TDeleteIntegrationDTO,
+ TGetIntegrationDeprecationStatusDTO,
TGetIntegrationDTO,
TSyncIntegrationDTO,
TUpdateIntegrationDTO
@@ -39,7 +41,7 @@ type TIntegrationServiceFactoryDep = {
integrationAuthDAL: TIntegrationAuthDALFactory;
integrationAuthService: TIntegrationAuthServiceFactory;
folderDAL: Pick<TSecretFolderDALFactory, "findBySecretPath" | "findByManySecretPath">;
- permissionService: Pick<TPermissionServiceFactory, "getProjectPermission">;
+ permissionService: Pick<TPermissionServiceFactory, "getProjectPermission" | "getOrgPermission">;
projectBotService: TProjectBotServiceFactory;
secretQueueService: Pick<TSecretQueueFactory, "syncIntegrations">;
secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "find" | "findByFolderIds" | "findByFolderId">;
@@ -389,6 +391,32 @@ export const integrationServiceFactory = ({
return { ...integration, envId: integration.environment.id };
};
+ /**
+ * Backs the org-wide deprecation banner. Restricted to org admins — they are the ones who can act on it, and the
+ * same audience the monthly deprecation notice emails. Only a boolean leaves the service.
+ */
+ const getDeprecationStatus = async ({
+ actor,
+ actorId,
+ actorOrgId,
+ actorAuthMethod
+ }: TGetIntegrationDeprecationStatusDTO) => {
+ const { permission } = await permissionService.getOrgPermission({
+ actor,
+ actorId,
+ orgId: actorOrgId,
+ actorAuthMethod,
+ actorOrgId,
+ scope: OrganizationActionScope.Any
+ });
+ // members hold only Read on org settings, so Edit is an effective admin gate that still honours custom roles
+ ForbiddenError.from(permission).throwUnlessCan(OrgPermissionActions.Edit, OrgPermissionSubjects.Settings);
+
+ const hasNativeIntegrations = await integrationDAL.hasIntegrationsByOrgId(actorOrgId);
+
+ return { hasNativeIntegrations };
+ };
+
return {
createIntegration,
updateIntegration,
@@ -396,6 +424,7 @@ export const integrationServiceFactory = ({
listIntegrationByProject,
getIntegration,
getIntegrationAWSIamRole,
- syncIntegration
+ syncIntegration,
+ getDeprecationStatus
};
};
diff --git a/backend/src/services/integration/integration-types.ts b/backend/src/services/integration/integration-types.ts
index f662affd81..d79eb80af3 100644
--- a/backend/src/services/integration/integration-types.ts
+++ b/backend/src/services/integration/integration-types.ts
@@ -1,4 +1,4 @@
-import { TProjectPermission } from "@app/lib/types";
+import { TOrgPermission, TProjectPermission } from "@app/lib/types";
export type TCreateIntegrationDTO = {
secretPath: string;
@@ -79,3 +79,5 @@ export type TDeleteIntegrationDTO = {
export type TSyncIntegrationDTO = {
id: string;
} & Omit<TProjectPermission, "projectId">;
+
+export type TGetIntegrationDeprecationStatusDTO = Omit<TOrgPermission, "orgId">;
diff --git a/backend/src/services/smtp/emails/NativeIntegrationDeprecationTemplate.tsx b/backend/src/services/smtp/emails/NativeIntegrationDeprecationTemplate.tsx
index 9ca1c77ae4..454cc7927d 100644
--- a/backend/src/services/smtp/emails/NativeIntegrationDeprecationTemplate.tsx
+++ b/backend/src/services/smtp/emails/NativeIntegrationDeprecationTemplate.tsx
@@ -4,12 +4,6 @@ import { BaseButton } from "./BaseButton";
import { BaseEmailWrapper, BaseEmailWrapperProps } from "./BaseEmailWrapper";
import { BaseLink } from "./BaseLink";
-const BENEFITS = [
- "Continuous, automatic syncing with no manual re-runs",
- "Reusable App Connections shared across syncs",
- "Actively maintained and supported"
-];
-
interface NativeIntegrationDeprecationTemplateProps
extends Omit<BaseEmailWrapperProps, "title" | "preview" | "children"> {
orgName: string;
@@ -48,11 +42,6 @@ export const NativeIntegrationDeprecationTemplate = ({
Native integrations are deprecated. Secret Syncs are the maintained replacement and cover the same third-party
services, so we recommend migrating.
</Text>
- {BENEFITS.map((benefit) => (
- <Text key={benefit} className="text-black text-[14px] leading-[20px] my-[4px]">
- • {benefit}
- </Text>
- ))}
</Section>
<Section className="mb-[28px]">
<Text className="text-[14px] font-semibold mb-[12px]">