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
fix lint
Thiago Araujo da Silvad1e570dd8ead
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 360a289901..29f03d45c2 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -1039,8 +1039,6 @@ export const registerRoutes = async (alertProviderRegistry,alertRecipientResolver,kmsService,- orgDAL,- notificationService,smtpService});const alertQueue = alertQueueServiceFactory({diff --git a/backend/src/services/alert/alert-engine.test.ts b/backend/src/services/alert/alert-engine.test.tsindex 5684863fc4..1aebdb8a2f 100644--- a/backend/src/services/alert/alert-engine.test.ts+++ b/backend/src/services/alert/alert-engine.test.ts@@ -90,7 +90,6 @@ const buildEngine = (opts: {registry.register(makeProvider(opts.targets) as IResourceAlertProvider);const sentMail: Array<{ recipients: string[] }> = [];- const createdNotifications: unknown[][] = [];const historyWrites: Array<{ deliveries: TDelivery[]; status: string }> = [];const engine = alertEngineFactory({@@ -125,12 +124,6 @@ const buildEngine = (opts: {}},kmsService: kmsServiceMock,- orgDAL: { findOrgMembersByRole: async () => [] },- notificationService: {- createUserNotifications: async (data: unknown[]) => {- createdNotifications.push(data);- }- },smtpService: {sendMail: async (opt: { recipients: string[] }) => {if (opts.failEmail) throw new Error("smtp down");@@ -140,12 +133,12 @@ const buildEngine = (opts: {}} as unknown as TAlertEngineDep);- return { engine, sentMail, createdNotifications, historyWrites };+ return { engine, sentMail, historyWrites };};describe("alert engine", () => {test("dispatches email to resolved recipients and records a delivery per (target, channel)", async () => {- const { engine, sentMail, createdNotifications, historyWrites } = buildEngine({+ const { engine, sentMail, historyWrites } = buildEngine({targets: [{ id: "t1" }, { id: "t2" }],channels: [{ id: "c-email", channelType: "email", encryptedConfig: encConfig({}), enabled: true }]});@@ -154,7 +147,6 @@ describe("alert engine", () => {expect(sentMail).toHaveLength(1);expect(sentMail[0].recipients).toEqual(["[email protected]"]);- expect(createdNotifications).toHaveLength(0); // no failure fallback on successexpect(historyWrites).toHaveLength(1);expect(historyWrites[0].status).toBe(AlertRunStatus.SUCCESS);expect(historyWrites[0].deliveries).toEqual([diff --git a/backend/src/services/alert/alert-engine.ts b/backend/src/services/alert/alert-engine.tsindex a8e4e384e6..a05725a736 100644--- a/backend/src/services/alert/alert-engine.ts+++ b/backend/src/services/alert/alert-engine.ts@@ -1,11 +1,8 @@import pLimit from "p-limit";-import { OrgMembershipRole, OrgMembershipStatus, TAlerts } from "@app/db/schemas";+import { TAlerts } from "@app/db/schemas";import { logger } from "@app/lib/logger";import { TKmsServiceFactory } from "@app/services/kms/kms-service";-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 { TSmtpService } from "@app/services/smtp/smtp-service";import { decryptChannelConfig, getAlertChannelCipher } from "./alert-channel-crypto-fns";@@ -18,8 +15,6 @@ import { TAlertRecipientResolver } from "./alert-recipient-resolver";import { AlertRunStatus, DEFAULT_DEDUP_WINDOW_HOURS, TAlertContext } from "./alert-types";import { ALERT_CHANNEL_REGISTRY } from "./channels/alert-channel-registry";-const FAILURE_NOTIFICATION_MAX_ERROR_LENGTH = 200;-const RECIPIENT_SEND_CONCURRENCY = 10;export type TAlertEngineDep = {@@ -29,8 +24,6 @@ export type TAlertEngineDep = {alertProviderRegistry: TAlertProviderRegistry;alertRecipientResolver: Pick<TAlertRecipientResolver, "resolveMany">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;- orgDAL: Pick<TOrgDALFactory, "findOrgMembersByRole">;- notificationService: Pick<TNotificationServiceFactory, "createUserNotifications">;smtpService: Pick<TSmtpService, "sendMail">;};@@ -43,37 +36,8 @@ export const alertEngineFactory = ({alertProviderRegistry,alertRecipientResolver,kmsService,- orgDAL,- notificationService,smtpService}: TAlertEngineDep) => {- const notifyAdminsOfFailure = async (alert: TAlerts, viewUrl: string, error: string) => {- try {- const admins = (await orgDAL.findOrgMembersByRole(alert.orgId, OrgMembershipRole.Admin)).filter(- (admin) => admin.status !== OrgMembershipStatus.Invited && admin.user?.id- );- if (admins.length === 0) return;-- const truncatedError =- error.length > FAILURE_NOTIFICATION_MAX_ERROR_LENGTH- ? `${error.substring(0, FAILURE_NOTIFICATION_MAX_ERROR_LENGTH)}...`- : error;-- await notificationService.createUserNotifications(- admins.map((admin) => ({- userId: admin.user.id,- orgId: alert.orgId,- type: NotificationType.ALERT_CHANNEL_FAILED,- title: `Alert Channel Failed: ${alert.name}`,- body: `Your alert **${alert.name}** failed to deliver on one or more channels: \`${truncatedError}\``,- link: viewUrl- }))- );- } catch (err) {- logger.error(err, `Failed to notify admins of alert channel failure [alertId=${alert.id}]`);- }- };-const runAlert = async (alert: TAlerts) => {const provider = alertProviderRegistry.get(alert.resourceType);if (!provider) {@@ -222,7 +186,7 @@ export const alertEngineFactory = ({const errorText = errors.length > 0 ? errors.join("\n") : undefined;if (errorText) {- await notifyAdminsOfFailure(alert, viewUrl, errorText);+ logger.error(`Alert delivery failed on one or more channels [alertId=${alert.id}]: ${errorText}`);}await alertHistoryDAL.createWithTargets(alert.id, { status, error: errorText }, deliveries);diff --git a/backend/src/services/membership-user/membership-user-service.ts b/backend/src/services/membership-user/membership-user-service.tsindex 3002e353f4..2e7312bdad 100644--- a/backend/src/services/membership-user/membership-user-service.ts+++ b/backend/src/services/membership-user/membership-user-service.ts@@ -21,8 +21,8 @@ import { requestMemoKeys } from "@app/lib/request-context/memo-keys";import { requestMemoize } from "@app/lib/request-context/request-memoizer";import { SearchResourceOperators } from "@app/lib/search-resource/search";import { isDisposableEmail, sanitizeEmail, validateEmail } from "@app/lib/validator";-import { PamIdentities, SecretIdentities } from "@app/services/license-client";import { TAlertChannelRecipientDALFactory } from "@app/services/alert/alert-channel-recipient-dal";+import { PamIdentities, SecretIdentities } from "@app/services/license-client";import { TUsageMeteringServiceFactory } from "@app/services/license-client/usage";import { TAdditionalPrivilegeDALFactory } from "../additional-privilege/additional-privilege-dal";diff --git a/backend/src/services/notification/notification-types.ts b/backend/src/services/notification/notification-types.tsindex 840a129017..ad347a7231 100644--- a/backend/src/services/notification/notification-types.ts+++ b/backend/src/services/notification/notification-types.ts@@ -22,8 +22,7 @@ export enum NotificationType {APPROVAL_REQUIRED = "approval-required",PKI_ALERT_CHANNEL_FAILED = "pki-alert-channel-failed",CREDENTIAL_ROTATION_FAILED = "credential-rotation-failed",- AUDIT_LOG_MIGRATION_RECOMMENDED = "audit-log-migration-recommended",- ALERT_CHANNEL_FAILED = "alert-channel-failed"+ AUDIT_LOG_MIGRATION_RECOMMENDED = "audit-log-migration-recommended"}export interface TCreateUserNotificationDTO {