mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 07:26:45 +00:00
fix: remove org bot DAL usage entirely
This commit is contained in:
@@ -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 { offlineUsageReportDALFactory } from "@app/services/offline-usage-report/offline-usage-report-dal";
|
||||||
import { offlineUsageReportServiceFactory } from "@app/services/offline-usage-report/offline-usage-report-service";
|
import { offlineUsageReportServiceFactory } from "@app/services/offline-usage-report/offline-usage-report-service";
|
||||||
import { incidentContactDALFactory } from "@app/services/org/incident-contacts-dal";
|
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 { orgDALFactory } from "@app/services/org/org-dal";
|
||||||
import { orgServiceFactory } from "@app/services/org/org-service";
|
import { orgServiceFactory } from "@app/services/org/org-service";
|
||||||
import { orgAdminServiceFactory } from "@app/services/org-admin/org-admin-service";
|
import { orgAdminServiceFactory } from "@app/services/org-admin/org-admin-service";
|
||||||
@@ -382,7 +381,6 @@ export const registerRoutes = async (
|
|||||||
const authTokenDAL = tokenDALFactory(db);
|
const authTokenDAL = tokenDALFactory(db);
|
||||||
const orgDAL = orgDALFactory(db);
|
const orgDAL = orgDALFactory(db);
|
||||||
const orgMembershipDAL = orgMembershipDALFactory(db);
|
const orgMembershipDAL = orgMembershipDALFactory(db);
|
||||||
const orgBotDAL = orgBotDALFactory(db);
|
|
||||||
const incidentContactDAL = incidentContactDALFactory(db);
|
const incidentContactDAL = incidentContactDALFactory(db);
|
||||||
const rateLimitDAL = rateLimitDALFactory(db);
|
const rateLimitDAL = rateLimitDALFactory(db);
|
||||||
const apiKeyDAL = apiKeyDALFactory(db);
|
const apiKeyDAL = apiKeyDALFactory(db);
|
||||||
@@ -889,7 +887,6 @@ export const registerRoutes = async (
|
|||||||
smtpService,
|
smtpService,
|
||||||
userDAL,
|
userDAL,
|
||||||
groupDAL,
|
groupDAL,
|
||||||
orgBotDAL,
|
|
||||||
oidcConfigDAL,
|
oidcConfigDAL,
|
||||||
ldapConfigDAL,
|
ldapConfigDAL,
|
||||||
loginService,
|
loginService,
|
||||||
|
|||||||
@@ -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;
|
|
||||||
};
|
|
||||||
@@ -57,7 +57,6 @@ import { TSecretV2BridgeDALFactory } from "../secret-v2-bridge/secret-v2-bridge-
|
|||||||
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
|
import { SmtpTemplates, TSmtpService } from "../smtp/smtp-service";
|
||||||
import { TUserDALFactory } from "../user/user-dal";
|
import { TUserDALFactory } from "../user/user-dal";
|
||||||
import { TIncidentContactsDALFactory } from "./incident-contacts-dal";
|
import { TIncidentContactsDALFactory } from "./incident-contacts-dal";
|
||||||
import { TOrgBotDALFactory } from "./org-bot-dal";
|
|
||||||
import { TOrgDALFactory } from "./org-dal";
|
import { TOrgDALFactory } from "./org-dal";
|
||||||
import { deleteOrgMembershipsFn } from "./org-fns";
|
import { deleteOrgMembershipsFn } from "./org-fns";
|
||||||
import {
|
import {
|
||||||
@@ -81,7 +80,6 @@ type TOrgServiceFactoryDep = {
|
|||||||
secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "find">;
|
secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "find">;
|
||||||
folderDAL: Pick<TSecretFolderDALFactory, "findByProjectId">;
|
folderDAL: Pick<TSecretFolderDALFactory, "findByProjectId">;
|
||||||
orgDAL: TOrgDALFactory;
|
orgDAL: TOrgDALFactory;
|
||||||
orgBotDAL: TOrgBotDALFactory;
|
|
||||||
roleDAL: TRoleDALFactory;
|
roleDAL: TRoleDALFactory;
|
||||||
userDAL: TUserDALFactory;
|
userDAL: TUserDALFactory;
|
||||||
groupDAL: TGroupDALFactory;
|
groupDAL: TGroupDALFactory;
|
||||||
@@ -135,7 +133,6 @@ export const orgServiceFactory = ({
|
|||||||
projectKeyDAL,
|
projectKeyDAL,
|
||||||
orgMembershipDAL,
|
orgMembershipDAL,
|
||||||
tokenService,
|
tokenService,
|
||||||
orgBotDAL,
|
|
||||||
licenseService,
|
licenseService,
|
||||||
samlConfigDAL,
|
samlConfigDAL,
|
||||||
oidcConfigDAL,
|
oidcConfigDAL,
|
||||||
@@ -567,23 +564,6 @@ export const orgServiceFactory = ({
|
|||||||
},
|
},
|
||||||
trx?: Knex
|
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 customerId = await licenseService.generateOrgCustomerId(orgName, userEmail);
|
||||||
|
|
||||||
const createOrg = async (tx: Knex) => {
|
const createOrg = async (tx: Knex) => {
|
||||||
@@ -611,24 +591,7 @@ export const orgServiceFactory = ({
|
|||||||
tx
|
tx
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await orgBotDAL.create(
|
|
||||||
{
|
|
||||||
name: org.name,
|
|
||||||
publicKey,
|
|
||||||
privateKeyIV,
|
|
||||||
encryptedPrivateKey,
|
|
||||||
symmetricKeyIV,
|
|
||||||
symmetricKeyTag,
|
|
||||||
encryptedSymmetricKey,
|
|
||||||
symmetricKeyAlgorithm,
|
|
||||||
orgId: org.id,
|
|
||||||
privateKeyTag,
|
|
||||||
privateKeyAlgorithm,
|
|
||||||
privateKeyKeyEncoding,
|
|
||||||
symmetricKeyKeyEncoding
|
|
||||||
},
|
|
||||||
tx
|
|
||||||
);
|
|
||||||
return org;
|
return org;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user