Skip to content

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

fix: remove org bot DAL usage entirely

Daniel Hougaarde4c75cbb897c
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.ts
index e95dd501ca..f599ef3a14 100644
--- a/backend/src/server/routes/index.ts
+++ b/backend/src/server/routes/index.ts
@@ -245,7 +245,6 @@ import { userNotificationDALFactory } from "@app/services/notification/user-noti
import { offlineUsageReportDALFactory } from "@app/services/offline-usage-report/offline-usage-report-dal";
import { offlineUsageReportServiceFactory } from "@app/services/offline-usage-report/offline-usage-report-service";
import { incidentContactDALFactory } from "@app/services/org/incident-contacts-dal";
-import { orgBotDALFactory } from "@app/services/org/org-bot-dal";
import { orgDALFactory } from "@app/services/org/org-dal";
import { orgServiceFactory } from "@app/services/org/org-service";
import { orgAdminServiceFactory } from "@app/services/org-admin/org-admin-service";
@@ -382,7 +381,6 @@ export const registerRoutes = async (
const authTokenDAL = tokenDALFactory(db);
const orgDAL = orgDALFactory(db);
const orgMembershipDAL = orgMembershipDALFactory(db);
- const orgBotDAL = orgBotDALFactory(db);
const incidentContactDAL = incidentContactDALFactory(db);
const rateLimitDAL = rateLimitDALFactory(db);
const apiKeyDAL = apiKeyDALFactory(db);
@@ -889,7 +887,6 @@ export const registerRoutes = async (
smtpService,
userDAL,
groupDAL,
- orgBotDAL,
oidcConfigDAL,
ldapConfigDAL,
loginService,
diff --git a/backend/src/services/org/org-bot-dal.ts b/backend/src/services/org/org-bot-dal.ts
deleted file mode 100644
index b2ee547589..0000000000
--- a/backend/src/services/org/org-bot-dal.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import { TDbClient } from "@app/db";
-import { TableName } from "@app/db/schemas";
-import { ormify } from "@app/lib/knex";
-
-export type TOrgBotDALFactory = ReturnType<typeof orgBotDALFactory>;
-
-export const orgBotDALFactory = (db: TDbClient) => {
- const orgBotOrm = ormify(db, TableName.OrgBot);
- return orgBotOrm;
-};
diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts
index 5b98b44b18..365fb5954d 100644
--- a/backend/src/services/org/org-service.ts
+++ b/backend/src/services/org/org-service.ts
@@ -57,7 +57,6 @@ import { TSecretV2BridgeDALFactory } from "../secret-v2-bridge/secret-v2-bridge-
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
import { TUserDALFactory } from "../user/user-dal";
import { TIncidentContactsDALFactory } from "./incident-contacts-dal";
-import { TOrgBotDALFactory } from "./org-bot-dal";
import { TOrgDALFactory } from "./org-dal";
import { deleteOrgMembershipsFn } from "./org-fns";
import {
@@ -81,7 +80,6 @@ type TOrgServiceFactoryDep = {
secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "find">;
folderDAL: Pick<TSecretFolderDALFactory, "findByProjectId">;
orgDAL: TOrgDALFactory;
- orgBotDAL: TOrgBotDALFactory;
roleDAL: TRoleDALFactory;
userDAL: TUserDALFactory;
groupDAL: TGroupDALFactory;
@@ -135,7 +133,6 @@ export const orgServiceFactory = ({
projectKeyDAL,
orgMembershipDAL,
tokenService,
- orgBotDAL,
licenseService,
samlConfigDAL,
oidcConfigDAL,
@@ -567,23 +564,6 @@ export const orgServiceFactory = ({
},
trx?: Knex
) => {
- const { privateKey, publicKey } = await crypto.encryption().asymmetric().generateKeyPair();
- const key = crypto.randomBytes(32).toString("base64");
- const {
- ciphertext: encryptedPrivateKey,
- iv: privateKeyIV,
- tag: privateKeyTag,
- encoding: privateKeyKeyEncoding,
- algorithm: privateKeyAlgorithm
- } = crypto.encryption().symmetric().encryptWithRootEncryptionKey(privateKey);
- const {
- ciphertext: encryptedSymmetricKey,
- iv: symmetricKeyIV,
- tag: symmetricKeyTag,
- encoding: symmetricKeyKeyEncoding,
- algorithm: symmetricKeyAlgorithm
- } = crypto.encryption().symmetric().encryptWithRootEncryptionKey(key);
-
const customerId = await licenseService.generateOrgCustomerId(orgName, userEmail);
const createOrg = async (tx: Knex) => {
@@ -611,24 +591,7 @@ export const orgServiceFactory = ({
tx
);
}
- await orgBotDAL.create(
- {
- name: org.name,
- publicKey,
- privateKeyIV,
- encryptedPrivateKey,
- symmetricKeyIV,
- symmetricKeyTag,
- encryptedSymmetricKey,
- symmetricKeyAlgorithm,
- orgId: org.id,
- privateKeyTag,
- privateKeyAlgorithm,
- privateKeyKeyEncoding,
- symmetricKeyKeyEncoding
- },
- tx
- );
+
return org;
};