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 review comments
=f876cd973341
diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 9d90a41a6e..acd283a6ec 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -813,9 +813,15 @@ export const registerRoutes = async (permissionService});+ // Offline (air-gapped) licenses are stored in LICENSE_KEY too, but must never reach the license+ // server. The v2 client is left dormant for them so no billing/entitlement read can transmit the+ // signed license credential; usage reporting + its cron are disabled below for the same reason.+ const licenseKeyConfig = getLicenseKeyConfig(envConfig);+ const isOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline;+// License Server v2 client SDK. Coexists with licenseService during migration - getFeature()// is the single read primitive; falls back to feature defaults until the server is configured.- const licenseClient = licenseClientFactory({ envConfig, keyStore });+ const licenseClient = licenseClientFactory({ envConfig, keyStore, isOffline: isOfflineLicense });// Created before licenseService so the latter can emit the v2 user-seat meter from its// updateSubscriptionOrgMemberCount chokepoint.@@ -837,10 +843,6 @@ export const registerRoutes = async (const usageCounterDAL = usageCounterDALFactory(db);const meteredFeatures = buildMeteredFeatures({ licenseDAL, usageCounterDAL, isCloud: envConfig.isCloud });meteredFeatures.forEach(({ feature, count }) => licenseClient.registerCounter(feature, count));- // An offline (air-gapped) license can't reach the license server, so usage reporting + its daily- // true-up cron are inert: skip the reporter entirely and disable the cron below.- const licenseKeyConfig = getLicenseKeyConfig(envConfig);- const isOfflineLicense = licenseKeyConfig.isValid && licenseKeyConfig.type === LicenseType.Offline;const usageReporter = isOfflineLicense ? null : buildUsageReporter(envConfig);let usageSource = "self-hosted";if (envConfig.isCloud) {diff --git a/backend/src/services/license-client/license-client.ts b/backend/src/services/license-client/license-client.tsindex 67e8ffafcb..6a2b798221 100644--- a/backend/src/services/license-client/license-client.ts+++ b/backend/src/services/license-client/license-client.ts@@ -28,13 +28,24 @@ type TLicenseClientFactoryDep = {| "INTERNAL_REGION">;keyStore: Pick<TKeyStoreFactory, "getItem" | "setItemWithExpiry" | "deleteItem">;+ // Offline (air-gapped) licenses must never contact the license server; the SDK stays dormant for them.+ isOffline?: boolean;};export type TLicenseClientFactory = ReturnType<typeof licenseClientFactory>;// Returns null (SDK dormant -> getFeature serves fallbacks) unless the kill switch is on and either a// self-hosted license key or the cloud service key (plus server URL) is configured.-const buildBackend = (envConfig: TLicenseClientFactoryDep["envConfig"]): TLicenseClientBackend | null => {+const buildBackend = (+ envConfig: TLicenseClientFactoryDep["envConfig"],+ isOffline: boolean+): TLicenseClientBackend | null => {+ // An offline (air-gapped) license lives in LICENSE_KEY, but transmitting it would violate the+ // air-gap and leak the signed credential — keep the SDK dormant so no read can POST it to the server.+ if (isOffline) {+ return null;+ }+const licenseKey = envConfig.LICENSE_KEY;if (licenseKey) {if (!envConfig.LICENSE_SERVER_URL) {@@ -80,8 +91,8 @@ const buildBackend = (envConfig: TLicenseClientFactoryDep["envConfig"]): TLicensreturn licenseServerBackend(serverUrl, signingKey.replace(/\\n/g, "\n"), envConfig.INTERNAL_REGION);};-export const licenseClientFactory = ({ envConfig, keyStore }: TLicenseClientFactoryDep) => {- const backend = buildBackend(envConfig);+export const licenseClientFactory = ({ envConfig, keyStore, isOffline = false }: TLicenseClientFactoryDep) => {+ const backend = buildBackend(envConfig, isOffline);const resolver = backend ? entitlementResolverFactory({ keyStore, backend }) : null;const getEntitlements = async (org: TEntitlementOrg) => {