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
refactor(platfor-415): rename per review feedback
Tre Dubrava505eb98d779d
diff --git a/backend/src/ee/services/pam-resource/pam-resource-service.ts b/backend/src/ee/services/pam-resource/pam-resource-service.tsindex cfbc98ae37..02b6f534b7 100644--- a/backend/src/ee/services/pam-resource/pam-resource-service.ts+++ b/backend/src/ee/services/pam-resource/pam-resource-service.ts@@ -19,7 +19,7 @@ import { TAppConnectionDALFactory } from "@app/services/app-connection/app-conneimport { AppConnection } from "@app/services/app-connection/app-connection-enums";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { KmsDataKey } from "@app/services/kms/kms-types";-import { MaxResources } from "@app/services/license-client";+import { MaxPamResources } from "@app/services/license-client";import { TUsageMeteringServiceFactory } from "@app/services/license-client/usage";import { TResourceMetadataDALFactory } from "@app/services/resource-metadata/resource-metadata-dal";@@ -291,7 +291,7 @@ export const pamResourceServiceFactory = ({return { resource: newResource, insertedMetadata: metadataRows };});- usageMeteringService.emitForProject(projectId, MaxResources.key);+ usageMeteringService.emitForProject(projectId, MaxPamResources.key);return {...(await decryptResource(resource, projectId, kmsService)),@@ -622,7 +622,7 @@ export const pamResourceServiceFactory = ({try {const deletedResource = await pamResourceDAL.deleteById(id);- usageMeteringService.emitForProject(resource.projectId, MaxResources.key);+ usageMeteringService.emitForProject(resource.projectId, MaxPamResources.key);return await decryptResource(deletedResource, resource.projectId, kmsService);} catch (err) {if (diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex 221831c744..2b42ff9d70 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -132,7 +132,8 @@ export const KeyStorePrefixes = {AuditLogMigrationAlert: "audit-log-migration-alert-last-row-count",LicenseCloudPlan: (orgId: string) => `infisical-cloud-plan-${orgId}` as const,LicenseEntitlements: (orgId: string) => `license-entitlements-${orgId}` as const,- UsageLastReported: (orgId: string, featureKey: string) => `usage-last-reported-${orgId}-${featureKey}` as const,+ LicenseUsageLastReported: (orgId: string, featureKey: string) =>+ `license-usage-last-reported-${orgId}-${featureKey}` as const,IdentityLockoutState: (identityId: string, authMethod: string, slug: string) =>`lockout:identity:${identityId}:${authMethod}:${slug}` as const,IdentityLockoutStateByMethodPattern: (identityId: string, authMethod: string) =>@@ -168,7 +169,7 @@ export const KeyStoreTtls = {AuditLogMigrationAlertInSeconds: 604800, // 7 daysLicenseCloudPlanInSeconds: 300, // 5 minutesLicenseEntitlementsInSeconds: 1800, // 30 minutes- UsageLastReportedInSeconds: 7776000, // 90 days (~3 billing cycles) so orphaned meter keys self-clean+ LicenseUsageLastReportedInSeconds: 7776000, // 90 days (~3 billing cycles) so orphaned meter keys self-cleanAiMcpEndpointOAuthFlowInSeconds: 300, // 5 minutesOauthAuthorizationCodeInSeconds: 600, // 10 minutesAiMcpServerOAuthSessionInSeconds: 600, // 10 minutesdiff --git a/backend/src/lib/cron/cron-job.ts b/backend/src/lib/cron/cron-job.tsindex 7f96f213e7..33f2841b07 100644--- a/backend/src/lib/cron/cron-job.ts+++ b/backend/src/lib/cron/cron-job.ts@@ -38,7 +38,7 @@ export const CronJobName = {SignerIssuancePolling: "signer-issuance-polling",AuditLogStreamOutboxStaleClaimSweeper: "audit-log-stream-outbox-stale-claim-sweeper",AuditLogStreamOutboxCleanup: "audit-log-stream-outbox-cleanup",- UsageFlush: "usage-flush"+ LicenseUsageFlush: "license-usage-flush"} as const;// ── tuning constants ──────────────────────────────────────────────────────────diff --git a/backend/src/services/license-client/features.ts b/backend/src/services/license-client/features.tsindex 38a31a09cf..23ba9387e1 100644--- a/backend/src/services/license-client/features.ts+++ b/backend/src/services/license-client/features.ts@@ -9,4 +9,4 @@ export const AuditRetentionDays = defineFeature("audit_retention_days", 30);export const MaxIdentities = defineLimitFeature("max_identities", 0);export const MaxInternalCas = defineLimitFeature("max_internal_cas", 0);export const MaxActiveCerts = defineLimitFeature("max_active_certs", 0);-export const MaxResources = defineLimitFeature("max_resources", 0);+export const MaxPamResources = defineLimitFeature("max_resources", 0);diff --git a/backend/src/services/license-client/usage/usage-counters.ts b/backend/src/services/license-client/usage/usage-counters.tsindex 7f15ddab64..9a49b07e42 100644--- a/backend/src/services/license-client/usage/usage-counters.ts+++ b/backend/src/services/license-client/usage/usage-counters.ts@@ -1,7 +1,7 @@import { TLicenseDALFactory } from "@app/ee/services/license/license-dal";import { TFeatureCounterFn, TLimitFeatureDescriptor } from "../feature";-import { MaxActiveCerts, MaxIdentities, MaxInternalCas, MaxResources } from "../features";+import { MaxActiveCerts, MaxIdentities, MaxInternalCas, MaxPamResources } from "../features";import { TUsageCounterDALFactory } from "./usage-counter-dal";export type TMeteredFeature = {@@ -20,5 +20,5 @@ export const buildMeteredFeatures = ({ licenseDAL, usageCounterDAL }: TBuildMete{ feature: MaxIdentities, count: (orgId) => licenseDAL.countOrgUsersAndIdentities(orgId) },{ feature: MaxInternalCas, count: (orgId) => usageCounterDAL.countInternalCas(orgId) },{ feature: MaxActiveCerts, count: (orgId) => usageCounterDAL.countActiveCerts(orgId) },- { feature: MaxResources, count: (orgId) => usageCounterDAL.countPamResources(orgId) }+ { feature: MaxPamResources, count: (orgId) => usageCounterDAL.countPamResources(orgId) }];diff --git a/backend/src/services/license-client/usage/usage-event-queue.ts b/backend/src/services/license-client/usage/usage-event-queue.tsindex 1fb3a76467..c290ba2745 100644--- a/backend/src/services/license-client/usage/usage-event-queue.ts+++ b/backend/src/services/license-client/usage/usage-event-queue.ts@@ -47,7 +47,7 @@ export const usageEventQueueFactory = ({const value = await metered.count(orgId);- const lastReportedKey = KeyStorePrefixes.UsageLastReported(orgId, featureKey);+ const lastReportedKey = KeyStorePrefixes.LicenseUsageLastReported(orgId, featureKey);const lastReported = await keyStore.getItem(lastReportedKey);if (lastReported !== null && Number(lastReported) === value) {return;@@ -66,7 +66,7 @@ export const usageEventQueueFactory = ({}]);- await keyStore.setItemWithExpiry(lastReportedKey, KeyStoreTtls.UsageLastReportedInSeconds, String(value));+ await keyStore.setItemWithExpiry(lastReportedKey, KeyStoreTtls.LicenseUsageLastReportedInSeconds, String(value));};// Self-hosted true-up: online instances also report event-driven, so this is a periodic backstop@@ -107,7 +107,7 @@ export const usageEventQueueFactory = ({const appCfg = getConfig();cronJob.register({- name: CronJobName.UsageFlush,+ name: CronJobName.LicenseUsageFlush,pattern: "*/30 * * * *",runHashTtlS: 60 * 60,enabled: !appCfg.isCloud,diff --git a/backend/src/services/license-client/usage/usage-metering.test.ts b/backend/src/services/license-client/usage/usage-metering.test.tsindex 681d0755a5..98d36033b4 100644--- a/backend/src/services/license-client/usage/usage-metering.test.ts+++ b/backend/src/services/license-client/usage/usage-metering.test.ts@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, test, vi } from "vitest";import { QueueJobs, QueueName } from "@app/queue";import { featureReaderFactory } from "../feature-reader";-import { MaxActiveCerts, MaxIdentities, MaxInternalCas, MaxResources } from "../features";+import { MaxActiveCerts, MaxIdentities, MaxInternalCas, MaxPamResources } from "../features";import { buildMeteredFeatures } from "./usage-counters";import { usageEventQueueFactory } from "./usage-event-queue";import { usageMeteringServiceFactory } from "./usage-metering-service";@@ -97,14 +97,14 @@ describe("usageMeteringService.emitForProject (project-scoped)", () => {envConfig: { LICENSE_SERVER_V2_ENABLED: true }});- svc.emitForProject(PROJECT_ID, MaxResources.key);+ svc.emitForProject(PROJECT_ID, MaxPamResources.key);await flushAsync();expect(findById).toHaveBeenCalledWith(PROJECT_ID);expect(queue).toHaveBeenCalledTimes(1);const [, , data, opts] = queue.mock.calls[0] as unknown as TQueueCall;- expect(data).toEqual({ orgId: ORG_ID, featureKey: MaxResources.key });- expect(opts.jobId).toBe(`usage-event:${ORG_ID}:${MaxResources.key}`);+ expect(data).toEqual({ orgId: ORG_ID, featureKey: MaxPamResources.key });+ expect(opts.jobId).toBe(`usage-event:${ORG_ID}:${MaxPamResources.key}`);});test("does not enqueue when the project is missing (e.g. soft-deleted)", async () => {@@ -115,7 +115,7 @@ describe("usageMeteringService.emitForProject (project-scoped)", () => {envConfig: { LICENSE_SERVER_V2_ENABLED: true }});- svc.emitForProject(PROJECT_ID, MaxResources.key);+ svc.emitForProject(PROJECT_ID, MaxPamResources.key);await flushAsync();expect(queue).not.toHaveBeenCalled();@@ -130,7 +130,7 @@ describe("usageMeteringService.emitForProject (project-scoped)", () => {envConfig: { LICENSE_SERVER_V2_ENABLED: false }});- svc.emitForProject(PROJECT_ID, MaxResources.key);+ svc.emitForProject(PROJECT_ID, MaxPamResources.key);await flushAsync();expect(findById).not.toHaveBeenCalled();@@ -170,13 +170,13 @@ describe("buildMeteredFeatures", () => {const byKey = Object.fromEntries(metered.map((m) => [m.feature.key, m.count]));expect(Object.keys(byKey).sort()).toEqual(- [MaxIdentities.key, MaxInternalCas.key, MaxActiveCerts.key, MaxResources.key].sort()+ [MaxIdentities.key, MaxInternalCas.key, MaxActiveCerts.key, MaxPamResources.key].sort());expect(await byKey[MaxIdentities.key](ORG_ID)).toBe(7);expect(await byKey[MaxInternalCas.key](ORG_ID)).toBe(1);expect(await byKey[MaxActiveCerts.key](ORG_ID)).toBe(2);- expect(await byKey[MaxResources.key](ORG_ID)).toBe(3);+ expect(await byKey[MaxPamResources.key](ORG_ID)).toBe(3);expect(licenseDAL.countOrgUsersAndIdentities).toHaveBeenCalledWith(ORG_ID);});});@@ -227,12 +227,12 @@ describe("usageEventQueue.handleUsageEvent (worker)", () => {value: 42,source: "test-region"});- expect(keyStore.store.get(`usage-last-reported-${ORG_ID}-${MaxIdentities.key}`)).toBe("42");+ expect(keyStore.store.get(`license-usage-last-reported-${ORG_ID}-${MaxIdentities.key}`)).toBe("42");});test("skips the report when the count is unchanged", async () => {const keyStore = createFakeKeyStore();- keyStore.store.set(`usage-last-reported-${ORG_ID}-${MaxIdentities.key}`, "42");+ keyStore.store.set(`license-usage-last-reported-${ORG_ID}-${MaxIdentities.key}`, "42");const { queue, reportSnapshots } = buildQueue({ keyStore });await queue.handleUsageEvent(ORG_ID, MaxIdentities.key);