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
=a300abf67ac0
diff --git a/backend/src/ee/routes/v1/license-v2-router.ts b/backend/src/ee/routes/v1/license-v2-router.tsindex 642dc14cd0..3739747003 100644--- a/backend/src/ee/routes/v1/license-v2-router.ts+++ b/backend/src/ee/routes/v1/license-v2-router.ts@@ -182,6 +182,7 @@ const BillingV2OverviewSchema = z.object({.nullable(),invoices: BillingV2InvoiceSchema.array(),entitlements: z.record(BillingV2EntitlementSchema),+ trialedProductKeys: z.string().array(),trials: BillingV2TrialSchema.array(),onDemandAmount: z.number(),checkoutFrozen: z.boolean(),diff --git a/backend/src/ee/services/license-v2/license-v2-service.ts b/backend/src/ee/services/license-v2/license-v2-service.tsindex 5c0855880d..abcf5d6721 100644--- a/backend/src/ee/services/license-v2/license-v2-service.ts+++ b/backend/src/ee/services/license-v2/license-v2-service.ts@@ -119,6 +119,9 @@ const formatIsoDate = (iso: string | null | undefined): string | null => {const DAY_IN_MS = 24 * 60 * 60 * 1000;+const PRORATION_MAX_AGE_SECONDS = 15 * 60;+const PRORATION_MAX_SKEW_SECONDS = 60;+const daysUntil = (unixSeconds: number | null | undefined): number | null => {if (!unixSeconds) {return null;@@ -812,6 +815,7 @@ export const licenseV2ServiceFactory = ({billingDetails,invoices,entitlements,+ trialedProductKeys: [...new Set(trialHistory.map((trial) => trial.productKey))],trials: trialHistory,onDemandAmount,checkoutFrozen: subscription?.capabilities?.checkoutFrozen ?? false,@@ -1017,6 +1021,15 @@ export const licenseV2ServiceFactory = ({prorationDate}: TUpgradeBillingV2ProductDTO) => {await ensureManageBilling(orgId, actor);+ if (prorationDate !== undefined) {+ const nowSeconds = Math.floor(Date.now() / 1000);+ const age = nowSeconds - prorationDate;+ if (age > PRORATION_MAX_AGE_SECONDS || age < -PRORATION_MAX_SKEW_SECONDS) {+ throw new BadRequestError({+ message: "This quote is no longer current. Review the updated total and confirm again."+ });+ }+ }const result = await licenseClient.upgradeProduct(orgId, {productId,plan,diff --git a/backend/src/ee/services/license-v2/license-v2-types.ts b/backend/src/ee/services/license-v2/license-v2-types.tsindex 81cb35d72e..522a2df31b 100644--- a/backend/src/ee/services/license-v2/license-v2-types.ts+++ b/backend/src/ee/services/license-v2/license-v2-types.ts@@ -207,6 +207,7 @@ export type BillingV2Overview = {} | null;invoices: BillingV2Invoice[];entitlements: Record<string, BillingV2Entitlement>;+ trialedProductKeys: string[];trials: BillingV2Trial[];// Total monthly on-demand overage across all products (dollars), for the summary's on-demand note.onDemandAmount: number;diff --git a/frontend/src/hooks/api/billingV2/types.ts b/frontend/src/hooks/api/billingV2/types.tsindex a30b6d2e5d..e1904a31e2 100644--- a/frontend/src/hooks/api/billingV2/types.ts+++ b/frontend/src/hooks/api/billingV2/types.ts@@ -211,6 +211,7 @@ export type BillingV2Overview = {} | null;invoices: BillingV2Invoice[];entitlements: Record<string, BillingV2Entitlement>;+ trialedProductKeys: string[];trials: BillingV2Trial[];// Mutating billing actions are frozen server-side; the UI disables purchase/commit/remove controls.checkoutFrozen: boolean;diff --git a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsxindex 6f5b1dbd7f..3f468413b4 100644--- a/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/Overview.tsx@@ -136,6 +136,7 @@ export const Overview = ({<TrialBannersoverview={overview}catalog={catalog}+ readOnly={productsReadOnly}onManage={onUpgrade}onUpdatePayment={onUpdatePayment}onContact={onContact}diff --git a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsxindex a7325b13cb..ca9248d389 100644--- a/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/TrialBanners.tsx@@ -43,6 +43,7 @@ const isRecentRevert = (trial: BillingV2Trial): boolean =>type Props = {overview: BillingV2Overview;catalog: BillingV2CatalogProduct[];+ readOnly: boolean;onManage: (productId: string) => void;onUpdatePayment: () => void;onContact: (prod: BillingV2CatalogProduct) => void;@@ -53,6 +54,7 @@ type Props = {export const TrialBanners = ({overview,catalog,+ readOnly,onManage,onUpdatePayment,onContact@@ -81,7 +83,7 @@ export const TrialBanners = ({</AlertTitle><AlertDescription>{reason?.body ?? "Your trial ended."} You're still on {basePlan}.- {overview.selfServe && (+ {overview.selfServe && !readOnly && (<div className="mt-3 flex flex-wrap gap-2">{reason?.action === "payment" && (<Button variant="outline" size="xs" onClick={onUpdatePayment}>diff --git a/frontend/src/pages/organization/BillingV2Page/components/UpgradeView.tsx b/frontend/src/pages/organization/BillingV2Page/components/UpgradeView.tsxindex 05ebdd64a4..670b7227a6 100644--- a/frontend/src/pages/organization/BillingV2Page/components/UpgradeView.tsx+++ b/frontend/src/pages/organization/BillingV2Page/components/UpgradeView.tsx@@ -85,17 +85,22 @@ export const UpgradeView = ({const handleUpgrade = async () => {let priced = preview.data;- // A stale preview would be rejected on apply, and a version published in between would charge a- // number the customer never saw, so re-price first and confirm the total is unchanged.if (Date.now() - pricedAt > PREVIEW_MAX_AGE_MS) {const fresh = await rePreview();if (!fresh) {return;}- if (fresh.totalDueNow !== priced?.totalDueNow) {+ // Every term the customer was shown has to match, not just today's charge. A republished price+ // can move the recurring total or the plan version while the prorated remainder rounds to the+ // same cents, and accepting the new version here would defeat expectedPlanVersionId.+ const changed =+ fresh.totalDueNow !== priced?.totalDueNow ||+ fresh.nextRecurringTotal !== priced?.nextRecurringTotal ||+ fresh.toPlanVersionId !== priced?.toPlanVersionId;+ if (changed) {createNotification({type: "info",- text: "Prices changed while you were reviewing. Check the new total and confirm again."+ text: "Pricing changed while you were reviewing. Check the updated total and confirm again."});return;}