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
feat; addressed llm review
=f9dc90fa8795
diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.tsindex 3cbd5033fc..ea5c5f5e0d 100644--- a/backend/src/ee/services/license/license-service.ts+++ b/backend/src/ee/services/license/license-service.ts@@ -295,9 +295,7 @@ export const licenseServiceFactory = ({}};- // Called after an org is deleted so it stops billing. Cloud-only: a self-hosted license covers the- // whole instance and has no per-org subscription to cancel. Never fatal, since the org row is already- // gone by this point and a License Server failure must not fail the deletion.+ // Called after an org is deleted so it stops billing. Cloud-onlyconst cancelOrgSubscription = async (orgId: string) => {if (!envConfig.isCloud) {return;@@ -305,10 +303,15 @@ export const licenseServiceFactory = ({try {await licenseClient?.cancelSubscription(orgId);- await licenseClient?.invalidateEntitlements(orgId);} catch (error) {- logger.error(error, `cancelOrgSubscription: failed to cancel subscription [orgId=${orgId}]`);+ if (error instanceof BadRequestError) {+ logger.info(`cancelOrgSubscription: no subscription to cancel [orgId=${orgId}]`);+ } else {+ throw error;+ }}++ await licenseClient?.invalidateEntitlements(orgId);};const updateSubscriptionOrgMemberCount = async (orgId: string, tx?: Knex) => {diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.tsindex 7575933506..9105e93bb5 100644--- a/backend/src/services/org/org-service.ts+++ b/backend/src/services/org/org-service.ts@@ -782,6 +782,12 @@ export const orgServiceFactory = ({const decodedToken = crypto.jwt().verify(authToken, cfg.AUTH_SECRET) as AuthModeJwtTokenPayload;if (!decodedToken.authMethod) throw new UnauthorizedError({ name: "Auth method not found on existing token" });+ const org = await requestMemoize(requestMemoKeys.orgFindOrgById(orgId), () => orgDAL.findOrgById(orgId));+ // if root org null = this is a root org then cancel the subscription.+ if (!org.rootOrgId) {+ await licenseService.cancelOrgSubscription(orgId);+ }+const response = await orgDAL.transaction(async (tx) => {const projects = await projectDAL.find({ orgId }, { tx });@@ -820,11 +826,6 @@ export const orgServiceFactory = ({};});- // if root org null = this is a root org then cancel the subscription.- if (!response.organization.rootOrgId) {- await licenseService.cancelOrgSubscription(orgId);- }-return response;};/*