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: patching bugs with integration test with new license server
=3c8b4ac74b49
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.tsindex 3ecd5b6259..f945881830 100644--- a/backend/src/ee/routes/v1/license-v2-router.ts+++ b/backend/src/ee/routes/v1/license-v2-router.ts@@ -29,8 +29,8 @@ const BillingV2DimSchema = z.object({const BillingV2CompareRowSchema = z.object({label: z.string(),- pro: z.union([z.string(), z.boolean()]),- ent: z.union([z.string(), z.boolean()])+ pro: z.union([z.string(), z.number(), z.boolean()]),+ ent: z.union([z.string(), z.number(), z.boolean()])});const BillingV2CatalogProductSchema = z.object({diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.tsindex 79f4126889..1d44597650 100644--- a/backend/src/ee/services/license-v2/license-v2-service.ts+++ b/backend/src/ee/services/license-v2/license-v2-service.ts@@ -128,9 +128,17 @@ const normalizeCadence = (cadence: string | undefined): "monthly" | "annual" =>return "monthly";};+// A plan carries pricing either as a flat base fee, as per-dimension prices, or both. Checking the+// per-dimension prices alone wrongly treats a base-only plan (e.g. the NHI add-on, which has a base+// fee but no metered dimensions) as unpriced.+const planHasPricing = (plan: TCatalogProduct["plans"][number]): boolean =>+ plan.prices.length > 0 ||+ (plan.basePriceMonthlyCents !== null && plan.basePriceMonthlyCents !== undefined) ||+ (plan.basePriceAnnualCents !== null && plan.basePriceAnnualCents !== undefined);+// The paid self-serve plan (e.g. "pro"); the free tier is self-serve too but carries no prices.const findPaidSelfServePlan = (product: TCatalogProduct) =>- product.plans.find((plan) => plan.selfServe === true && plan.tier !== "free" && plan.prices.length > 0);+ product.plans.find((plan) => plan.selfServe === true && plan.tier !== "free" && planHasPricing(plan));const toCatalogProduct = (product: TCatalogProduct): BillingV2CatalogProduct => {const paidSelfServePlan = findPaidSelfServePlan(product);@@ -183,7 +191,10 @@ const toCatalogProduct = (product: TCatalogProduct): BillingV2CatalogProduct =>enterprise = { sales: true, feature: salesLedPlan.feature ?? "" };}- const cellValue = (cells: { tier: string; value: string | boolean }[], tier: string): string | boolean => {+ const cellValue = (+ cells: { tier: string; value: string | number | boolean }[],+ tier: string+ ): string | boolean | number => {const cell = cells.find((candidate) => candidate.tier === tier);if (!cell) {return false;@@ -214,7 +225,8 @@ const toCatalogProduct = (product: TCatalogProduct): BillingV2CatalogProduct =>};// Translates a catalog product into the line items the checkout endpoint expects: its paid-// self-serve plan plus the primary priced dimension for the chosen cadence at quantity 1.+// self-serve plan plus the primary priced dimension for the chosen cadence at quantity 1. A base-only+// product (a base fee with no metered dimensions, e.g. the NHI add-on) checks out with no quantities.const buildCheckoutItems = (product: TCatalogProduct, cadence: "monthly" | "annual"): TCheckoutLineItem[] | null => {const paidSelfServePlan = findPaidSelfServePlan(product);if (!paidSelfServePlan) {@@ -224,7 +236,13 @@ const buildCheckoutItems = (product: TCatalogProduct, cadence: "monthly" | "annuconst price = paidSelfServePlan.prices.find((candidate) => candidate.cadence === cadence && candidate.unitAmountCents > 0);- if (!price) {++ const baseCents =+ cadence === "annual" ? paidSelfServePlan.basePriceAnnualCents : paidSelfServePlan.basePriceMonthlyCents;+ const hasBasePrice = baseCents !== null && baseCents !== undefined;++ // Neither a metered price nor a base fee for this cadence means there's nothing to charge.+ if (!price && !hasBasePrice) {return null;}@@ -233,7 +251,7 @@ const buildCheckoutItems = (product: TCatalogProduct, cadence: "monthly" | "annuproductId: product.id,plan: paidSelfServePlan.tier,cadence,- quantities: { [price.dimensionKey]: 1 }+ quantities: price ? { [price.dimensionKey]: 1 } : {}}];};diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.tsindex 1437cd9158..478d171d24 100644--- a/backend/src/ee/services/license-v2/license-v2-types.ts+++ b/backend/src/ee/services/license-v2/license-v2-types.ts@@ -17,8 +17,8 @@ export type BillingV2Dim = {export type BillingV2CompareRow = {label: string;- pro: string | boolean;- ent: string | boolean;+ pro: string | boolean | number;+ ent: string | boolean | number;};export type BillingV2CatalogProduct = {diff --git a/backend/src/ee/services/license/license-service.ts b/backend/src/ee/services/license/license-service.tsindex e369fc26d6..6bf1db4b18 100644--- a/backend/src/ee/services/license/license-service.ts+++ b/backend/src/ee/services/license/license-service.ts@@ -61,6 +61,7 @@ type TLicenseServiceFactoryDep = {| "INTERNAL_REGION"| "SITE_URL"| "LICENSE_SERVER_V2_MODE"+ | "LICENSE_SERVER_V2_SERVICE_KEY">;orgDAL: Pick<TOrgDALFactory, "findRootOrgDetails" | "countAllOrgMembers" | "findById">;permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;@@ -140,6 +141,13 @@ export const licenseServiceFactory = ({const init = async () => {try {+ if (envConfig.LICENSE_SERVER_V2_SERVICE_KEY) {+ instanceType = InstanceType.Cloud;+ logger.info(`Instance type: ${InstanceType.Cloud}`);+ isValidLicense = true;+ return;+ }+if (envConfig.LICENSE_SERVER_KEY) {const token = await licenseServerCloudApi.refreshLicense();if (token) instanceType = InstanceType.Cloud;diff --git a/backend/src/services/license-client/license-client-types.ts b/backend/src/services/license-client/license-client-types.tsindex 2819c14fb4..494a430e75 100644--- a/backend/src/services/license-client/license-client-types.ts+++ b/backend/src/services/license-client/license-client-types.ts@@ -49,7 +49,7 @@ const catalogPlanSchema = zconst catalogComparisonCellSchema = z.object({tier: z.string(),- value: z.union([z.string(), z.boolean()])+ value: z.union([z.string(), z.number(), z.boolean()])}).passthrough();diff --git a/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts b/frontend/src/pages/organization/BillingV2Page/billing-v2-data.tsindex c89070a891..d6875a8397 100644--- a/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts+++ b/frontend/src/pages/organization/BillingV2Page/billing-v2-data.ts@@ -33,6 +33,14 @@ export const cadenceWord = (cad: BillingV2Cadence): string => {return "month";};+// Abbreviated cadence used beside per-unit dimension prices (e.g. "$5 per MCP / mo").+export const cadenceWordShort = (cad: BillingV2Cadence): string => {+ if (cad === "annual") {+ return "yr";+ }+ return "mo";+};+// Maps the real overview interval onto the catalog cadence used for marketing prices.export const intervalToCadence = (interval: "month" | "year" | null): BillingV2Cadence => {if (interval === "year") {diff --git a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsxindex 0bfb01ad88..ee36139a26 100644--- a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx@@ -50,7 +50,7 @@ import {} from "@app/hooks/api";import { fmtMoney, intervalWord, pluralizeUnit } from "../billing-v2-data";-import { ActiveBadge, LimitMeter, ProductIcon } from "./shared";+import { ActiveBadge, ProductIcon } from "./shared";export type BillingV2Mode = "self-serve" | "managed";export type BillingV2RenderState =@@ -332,28 +332,80 @@ type UsageCardProps = {overview: BillingV2Overview;};-const UsageCard = ({ overview }: UsageCardProps) => (- <Card>- <CardHeader>- <CardTitle>- <GaugeIcon className="size-4 text-accent" />- Usage- </CardTitle>- </CardHeader>- <CardContent className="flex flex-col gap-2.5">- <LimitMeter- label="Members"- used={overview.usage.members}- limit={overview.usage.memberLimit}- />- <LimitMeter- label="Machine identities"- used={overview.usage.identities}- limit={overview.usage.identityLimit}- />- </CardContent>- </Card>-);+const UsageCard = ({ overview }: UsageCardProps) => {+ const { members, identities, identityLimit } = overview.usage;+ // Members and machine identities draw from one shared seat pool (identityLimit); there is no+ // separate member limit, so they're metered together against the single limit.+ const limit = identityLimit;+ const used = members + identities;+ const isUnlimited = limit === null;+ const available = isUnlimited ? 0 : Math.max(0, limit - used);+ const membersPct = limit ? Math.min(100, (members / limit) * 100) : 0;+ const identitiesPct = limit ? Math.min(100, (identities / limit) * 100) : 0;++ return (+ <Card>+ <CardHeader>+ <CardTitle>+ <GaugeIcon className="size-4 text-accent" />+ Usage+ </CardTitle>+ </CardHeader>+ <CardContent className="flex flex-col gap-3">+ <div className="flex items-baseline justify-between gap-2.5">+ <span className="text-sm font-medium text-foreground">+ Members & machine identities+ </span>+ <span className="text-sm text-muted tabular-nums">+ <span className="text-foreground">{used.toLocaleString()}</span>+ {isUnlimited ? " used" : ` / ${limit.toLocaleString()} used`}+ </span>+ </div>++ {!isUnlimited && limit > 0 && (+ <div className="flex h-1.5 w-full gap-0.5 overflow-hidden rounded-full bg-border">+ <div+ className="h-full rounded-full bg-org transition-all"+ style={{ width: `${membersPct}%` }}+ />+ <div+ className="h-full rounded-full bg-org/50 transition-all"+ style={{ width: `${identitiesPct}%` }}+ />+ </div>+ )}++ <div className="flex items-center justify-between gap-2.5 text-xs">+ <div className="flex flex-wrap items-center gap-x-4 gap-y-1.5">+ <span className="flex items-center gap-1.5">+ <span className="size-2.5 rounded-sm bg-org" />+ <span className="text-muted">Members</span>+ <span className="font-medium text-foreground tabular-nums">+ {members.toLocaleString()}+ </span>+ </span>+ <span className="flex items-center gap-1.5">+ <span className="size-2.5 rounded-sm bg-org/50" />+ <span className="text-muted">Machine identities</span>+ <span className="font-medium text-foreground tabular-nums">+ {identities.toLocaleString()}+ </span>+ </span>+ </div>+ <span className="shrink-0 text-muted tabular-nums">+ {isUnlimited ? "Unlimited" : `${available.toLocaleString()} available`}+ </span>+ </div>++ <div className="border-t border-border pt-3 text-xs text-muted">+ {isUnlimited+ ? "Members and machine identities share a single, unlimited pool."+ : `Members and machine identities share a single limit of ${limit.toLocaleString()}.`}+ </div>+ </CardContent>+ </Card>+ );+};type ProductRowProps = {prod: BillingV2CatalogProduct;diff --git a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsxindex 9728bb6af6..981ecf6743 100644--- a/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/ProductSheet.tsx@@ -18,28 +18,76 @@ import {} from "@app/components/v3";import { BillingV2Cadence, BillingV2CatalogProduct, BillingV2Entitlement } from "@app/hooks/api";-import { cadenceWord, fmtMoney, unitPrice } from "../billing-v2-data";+import { cadenceWord, cadenceWordShort, fmtMoney, unitPrice } from "../billing-v2-data";import { ActiveBadge, ProductIcon } from "./shared";-type ProPriceParts = { amount: string; unit: string } | null;+type PriceLine = { amount: string; unit: string };-const proPriceParts = (prod: BillingV2CatalogProduct, cadence: BillingV2Cadence): ProPriceParts => {- if (prod.model === "flat" || prod.model === "limit") {- const base = prod.pro?.base;- if (!base) {- return null;- }- return { amount: fmtMoney(unitPrice(base, cadence)), unit: `/ ${cadenceWord(cadence)}` };+// The plan's flat/base fee for the active cadence, when it has one (e.g. "$20 / month").+const proBaseLine = (+ prod: BillingV2CatalogProduct,+ cadence: BillingV2Cadence+): PriceLine | null => {+ const base = prod.pro?.base;+ if (!base) {+ return null;+ }+ return { amount: fmtMoney(unitPrice(base, cadence)), unit: `/ ${cadenceWord(cadence)}` };+};++// A plan's price is a base fee plus any number of metered dimensions, and any combination is valid:+// base only, meter only, or both. The base fee leads as the headline; every priced dimension is then+// listed below (e.g. "$5 per MCP / mo", "$3 per Agent / mo"). When there's no base fee the first+// dimension is promoted to the headline so the card always opens with a price.+const ProPricing = ({+ prod,+ cadence+}: {+ prod: BillingV2CatalogProduct;+ cadence: BillingV2Cadence;+}) => {+ const dims = prod.pro?.dims ?? [];+ const dimLines = dims.map((dim) => ({+ key: dim.key,+ amount: fmtMoney(unitPrice(dim, cadence), 2),+ unit: `per ${dim.noun} / ${cadenceWordShort(cadence)}`+ }));++ let headline = proBaseLine(prod, cadence);+ let usageLines = dimLines;+ if (!headline && dims.length > 0) {+ headline = {+ amount: fmtMoney(unitPrice(dims[0], cadence), 2),+ unit: `/ ${dims[0].noun} / ${cadenceWord(cadence)}`+ };+ usageLines = dimLines.slice(1);}- const dimension = prod.pro?.dims?.[0];- if (!dimension) {+ if (!headline) {return null;}- return {- amount: fmtMoney(unitPrice(dimension, cadence), 2),- unit: `/ ${dimension.noun} / ${cadenceWord(cadence)}`- };++ return (+ <div className="flex flex-col gap-3.5">+ <div className="flex flex-wrap items-baseline gap-1.5">+ <span className="text-2xl font-medium text-foreground">{headline.amount}</span>+ <span className="text-xs text-muted">{headline.unit}</span>+ </div>+ {usageLines.length > 0 && (+ <div className="flex flex-col gap-2 border-t border-border pt-3.5">+ <span className="text-[10px] font-medium tracking-wide text-muted uppercase">+ Plus per-unit usage+ </span>+ {usageLines.map((line) => (+ <div key={line.key} className="flex items-baseline gap-1.5">+ <span className="text-sm font-medium text-foreground">{line.amount}</span>+ <span className="text-xs text-muted">{line.unit}</span>+ </div>+ ))}+ </div>+ )}+ </div>+ );};const renderCompareCell = (value: string | boolean) => {@@ -86,7 +134,6 @@ type PlansViewProps = {const PlansView = ({ prod, entitlement, cadence, onContact }: PlansViewProps) => {const hasEnterprise = !!prod.enterprise;- const priceParts = proPriceParts(prod, cadence);const entitled = Boolean(entitlement?.entitled);const selfServe = Boolean(prod.pro?.planKey);@@ -101,7 +148,7 @@ const PlansView = ({ prod, entitlement, cadence, onContact }: PlansViewProps) =>}`}><div className="flex items-center justify-between gap-2">- <span className="text-[15px] font-semibold text-foreground">Pro</span>+ <span className="text-[15px] font-medium text-foreground">Pro</span>{entitled ? (<Badge variant="success"><Check className="text-success" />@@ -111,23 +158,18 @@ const PlansView = ({ prod, entitlement, cadence, onContact }: PlansViewProps) =><Badge variant="neutral">Self-Checkout</Badge>)}</div>- {priceParts && (- <div className="flex flex-wrap items-baseline gap-1.5">- <span className="text-2xl font-semibold text-foreground">{priceParts.amount}</span>- <span className="text-xs text-muted">{priceParts.unit}</span>- </div>- )}+ <ProPricing prod={prod} cadence={cadence} />{prod.pro?.proFeature && <div className="text-xs text-accent">{prod.pro.proFeature}</div>}</div>{hasEnterprise && prod.enterprise && (<div className="flex flex-col gap-3.5 rounded-xl border border-border bg-card p-[18px]"><div className="flex items-center justify-between gap-2">- <span className="text-[15px] font-semibold text-foreground">Enterprise</span>+ <span className="font-mediumtext-foreground">Enterprise</span><Badge variant="neutral">Talk to Us</Badge></div><div className="flex items-baseline">- <span className="text-2xl font-semibold text-foreground">Custom</span>+ <span className="text-2xl font-medium text-foreground">Custom</span></div><div className="text-xs text-accent">{prod.enterprise.feature}</div>{selfServe && (@@ -147,7 +189,7 @@ const PlansView = ({ prod, entitlement, cadence, onContact }: PlansViewProps) =>{hasEnterprise && prod.compare && (<div>- <div className="mb-3 text-xs font-semibold text-muted">Compare Plans</div>+ <div className="mb-3 text-xs font-medium text-muted">Compare Plans</div><Table><TableHeader><TableRow>@@ -171,7 +213,7 @@ const PlansView = ({ prod, entitlement, cadence, onContact }: PlansViewProps) =>{!(hasEnterprise && prod.compare) && prod.includes && (<div>- <div className="mb-3 text-xs font-semibold tracking-wide text-muted uppercase">+ <div className="mb-3 text-xs font-medium tracking-wide text-muted uppercase">What's included</div><div className="grid gap-x-5 gap-y-2.5 sm:grid-cols-2">diff --git a/frontend/src/pages/organization/BillingV2Page/components/shared.tsx b/frontend/src/pages/organization/BillingV2Page/components/shared.tsxindex a7c63d177c..4fa194de96 100644--- a/frontend/src/pages/organization/BillingV2Page/components/shared.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/shared.tsx@@ -1,11 +1,9 @@import { Box } from "lucide-react";import { DynamicIcon, type IconName } from "lucide-react/dynamic";-import { Badge, Label } from "@app/components/v3";+import { Badge } from "@app/components/v3";import { BillingV2CatalogProduct } from "@app/hooks/api";-type MeterTone = "ok" | "near" | "full";-type ProductIconProps = {product: BillingV2CatalogProduct;size?: number;@@ -42,67 +40,3 @@ export const ProductIcon = ({ product, size = 36 }: ProductIconProps) => {};export const ActiveBadge = () => <Badge variant="success">Active</Badge>;--// A null limit is unlimited (no bar, no alarm).-const meterTone = (used: number, limit: number | null): MeterTone => {- if (!limit || limit <= 2) {- return "ok";- }- const r = used / limit;- if (r >= 1) {- return "full";- }- if (r >= 0.85) {- return "near";- }- return "ok";-};--const FILL_TONE: Record<MeterTone, string> = {- ok: "bg-org",- near: "bg-warning",- full: "bg-danger"-};--const COUNT_TONE: Record<MeterTone, string> = {- ok: "text-foreground",- near: "text-warning",- full: "text-danger"-};--type LimitMeterProps = {- label: string;- used: number;- limit: number | null;-};--export const LimitMeter = ({ label, used, limit }: LimitMeterProps) => {- const tone = meterTone(used, limit);- let pct = 0;- if (limit) {- pct = Math.min(100, Math.round((used / limit) * 100));- }- return (- <div className="flex flex-col gap-1.5">- <div className="flex items-baseline justify-between gap-2.5">- <Label>{label}</Label>- <span className={`text-sm tabular-nums ${COUNT_TONE[tone]}`}>- {used.toLocaleString()}- {limit === null ? (- <span className="text-muted"> / Unlimited</span>- ) : (- <span className="text-muted"> / {limit.toLocaleString()}</span>- )}- </span>- </div>- {limit !== null && limit > 0 && (- <div className="h-1.5 overflow-hidden rounded-full bg-border">- <div- className={`h-full rounded-full transition-all ${FILL_TONE[tone]}`}- style={{ width: `${pct}%` }}- />- </div>- )}- </div>- );-};