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
add support for legacy keys
Andreyb731e23f7c5d
diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.tsindex d33d3f7024..9a0b189af0 100644--- a/backend/src/ee/services/license/license-service.ts+++ b/backend/src/ee/services/license/license-service.ts@@ -137,6 +137,11 @@ export const licenseServiceFactory = ({? projectV2ToFeatureSet(getDefaultOnPremFeatures(), contents.license.entitlements): { ...getDefaultOnPremFeatures(), ...contents.license.features };+ // Keys issued before PAM alerts moved to the alert module grant them through the old Slack flag.+ if ((contents.license.features as { pamSlackNotifications?: boolean } | undefined)?.pamSlackNotifications) {+ features.pamEnterpriseAlerting = true;+ }+onPremFeatures = {...features,slug: "enterprise",diff --git a/backend/src/services/license-client/entitlement-projection.test.ts b/backend/src/services/license-client/entitlement-projection.test.tsindex 73e0c885f4..1f14b7ccba 100644--- a/backend/src/services/license-client/entitlement-projection.test.ts+++ b/backend/src/services/license-client/entitlement-projection.test.ts@@ -35,6 +35,14 @@ describe("projectV2ToFeatureSet", () => {expect(plan.rateLimits.readLimit).toBe(500);});+ test("turns a feature on through a legacy registry key the current key leaves off", () => {+ const plan = projectV2ToFeatureSet(+ makeBase({ pamEnterpriseAlerting: false }),+ makeEntitlements({ pam_enterprise_alerting: { value: false }, pam_slack_notifications: { value: true } })+ );+ expect(plan.pamEnterpriseAlerting).toBe(true);+ });+test("does not mutate the passed base", () => {const base = makeBase({ rbac: false });projectV2ToFeatureSet(base, makeEntitlements({ rbac: { value: true } }));diff --git a/backend/src/services/license-client/entitlement-projection.ts b/backend/src/services/license-client/entitlement-projection.tsindex 4b86ab5994..b377521a65 100644--- a/backend/src/services/license-client/entitlement-projection.ts+++ b/backend/src/services/license-client/entitlement-projection.ts@@ -22,16 +22,17 @@ export const projectV2ToFeatureSet = (base: TFeatureSet, entitlements: TEntitlemif (mapping.v1Field === null) {return;}- const raw = entitlements.features[mapping.v2Key];- if (!raw || raw.value === null || raw.value === undefined) {+ const isLegacyGranted = mapping.legacyV2Keys?.some((key) => entitlements.features[key]?.value === true);+ const value = isLegacyGranted ? true : entitlements.features[mapping.v2Key]?.value;+ if (value === null || value === undefined) {return;}if (mapping.v1Field.includes(".")) {const [parent, child] = mapping.v1Field.split(".");- (plan[parent] as Record<string, unknown>)[child] = raw.value;+ (plan[parent] as Record<string, unknown>)[child] = value;} else {- plan[mapping.v1Field] = raw.value;+ plan[mapping.v1Field] = value;}});diff --git a/backend/src/services/license-client/feature-mapping.ts b/backend/src/services/license-client/feature-mapping.tsindex 66b6b63335..2593466706 100644--- a/backend/src/services/license-client/feature-mapping.ts+++ b/backend/src/services/license-client/feature-mapping.ts@@ -14,6 +14,8 @@ export type TFeatureMapping = {// The TFeatureSet field this maps to (drives the completeness test); dotted for nested fields// (e.g. "rateLimits.readLimit"). null when the feature has no plan field to write.v1Field: string | null;+ // Registry keys a boolean feature was previously sold under; any of them being on turns the feature on.+ legacyV2Keys?: string[];};// Org-wide capabilities that are not tied to a single product: identity and access, audit, KMS/HSM,@@ -354,7 +356,8 @@ const pamMappings: TFeatureMapping[] = [},{v2Key: "pam_enterprise_alerting",- v1Field: "pamEnterpriseAlerting"+ v1Field: "pamEnterpriseAlerting",+ legacyV2Keys: ["pam_slack_notifications"]},{// Max PAM accounts allowed. null (v1 default) means uncapped.