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: add query to get the amount of users, identities and active leases
adilsona7726ac391d6
diff --git a/backend/e2e-test/product-insights-service.spec.ts b/backend/e2e-test/product-insights-service.spec.tsnew file mode 100644index 0000000000..1d1250a5d2--- /dev/null+++ b/backend/e2e-test/product-insights-service.spec.ts@@ -0,0 +1,373 @@+import { randomUUID } from "node:crypto";++import { createMongoAbility, ForbiddenError, MongoAbility } from "@casl/ability";+import { Knex } from "knex";+import { afterAll, beforeAll, describe, expect, test } from "vitest";++import {+ AccessScope,+ OrgMembershipStatus,+ ProjectType,+ TableName,+ TDynamicSecretLeasesInsert,+ TDynamicSecretsInsert,+ TIdentitiesInsert,+ TMembershipsInsert,+ TOrganizationsInsert,+ TProjectEnvironmentsInsert,+ TProjectsInsert,+ TSecretFoldersInsert,+ TUsersInsert+} from "@app/db/schemas";+import { dynamicSecretLeaseDALFactory } from "@app/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal";+import { TFeatureSet } from "@app/ee/services/license/license-types";+import {+ OrgPermissionSecretsManagementInsightsActions,+ OrgPermissionSet,+ OrgPermissionSubjects+} from "@app/ee/services/permission/org-permission";+import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";+import { productInsightsServiceFactory } from "@app/ee/services/product-insights/product-insights-service";+import { TProductInsightsDTO } from "@app/ee/services/product-insights/product-insights-types";+import { ActorType, AuthMethod } from "@app/services/auth/auth-type";+import { identityOrgDALFactory } from "@app/services/identity/identity-org-dal";+import { orgDALFactory } from "@app/services/org/org-dal";++declare const testDb: Knex;++const ORG_ID = randomUUID();+const OTHER_ORG_ID = randomUUID();+const suffix = randomUUID().slice(0, 8);++const ids = {+ // users: only uCounted satisfies accepted + active + non-ghost+ uCounted: randomUUID(),+ uGhost: randomUUID(),+ uInvited: randomUUID(),+ uDeactivated: randomUUID(),+ // identities: only the two with an org-scoped membership count+ iOrgA: randomUUID(),+ iOrgB: randomUUID(),+ iProjectOnly: randomUUID()+};++// One project per lease-visibility rule, so each filter in countLeasesForOrg is exercised+// independently. Only `counted` may contribute.+const scopes = {+ counted: { projectId: randomUUID(), envId: randomUUID(), folderId: randomUUID(), dynamicSecretId: randomUUID() },+ otherProductType: {+ projectId: randomUUID(),+ envId: randomUUID(),+ folderId: randomUUID(),+ dynamicSecretId: randomUUID()+ },+ deletedProject: {+ projectId: randomUUID(),+ envId: randomUUID(),+ folderId: randomUUID(),+ dynamicSecretId: randomUUID()+ },+ deletedEnvironment: {+ projectId: randomUUID(),+ envId: randomUUID(),+ folderId: randomUUID(),+ dynamicSecretId: randomUUID()+ },+ otherOrg: { projectId: randomUUID(), envId: randomUUID(), folderId: randomUUID(), dynamicSecretId: randomUUID() }+};++const scopeList = Object.values(scopes);++const buildPermission = (canRead: boolean): MongoAbility<OrgPermissionSet> =>+ createMongoAbility<OrgPermissionSet>(+ canRead+ ? [+ {+ action: OrgPermissionSecretsManagementInsightsActions.Read,+ subject: OrgPermissionSubjects.SecretsManagementInsights+ }+ ]+ : []+ );++let canReadInsights = true;+let planHasInsights = true;++const permissionService: Pick<TPermissionServiceFactory, "getOrgPermission"> = {+ getOrgPermission: async () => ({+ permission: buildPermission(canReadInsights),+ memberships: [],+ hasRole: () => false+ })+};++const licenseService = {+ getPlan: async () => ({ secretAccessInsights: planHasInsights }) as unknown as TFeatureSet+};++const productInsightsService = productInsightsServiceFactory({+ permissionService,+ licenseService,+ orgDAL: orgDALFactory(testDb),+ identityOrgMembershipDAL: identityOrgDALFactory(testDb),+ dynamicSecretLeaseDAL: dynamicSecretLeaseDALFactory(testDb)+});++const actor = (orgId: string): TProductInsightsDTO => ({+ actor: ActorType.USER,+ actorId: ids.uCounted,+ actorAuthMethod: AuthMethod.EMAIL,+ actorOrgId: orgId,+ orgId+});++const lease = (dynamicSecretId: string): TDynamicSecretLeasesInsert & { id: string } => {+ const id = randomUUID();+ return {+ id,+ version: 1,+ externalEntityId: `ext-${id}`,+ expireAt: new Date(Date.now() + 60 * 60 * 1000),+ dynamicSecretId+ };+};++describe("product-insights secrets usage insights", () => {+ beforeAll(async () => {+ // The generated *Insert types omit the immutable `id` key, and TS's excess-property check only+ // fires on fresh object literals, so fixtures are held in typed consts to set explicit ids.+ const orgRows: (TOrganizationsInsert & { id: string })[] = [+ { id: ORG_ID, name: `insights-${suffix}`, slug: `insights-${suffix}` },+ { id: OTHER_ORG_ID, name: `insights-other-${suffix}`, slug: `insights-other-${suffix}` }+ ];+ await testDb(TableName.Organization).insert(orgRows);++ const userRows: (TUsersInsert & { id: string })[] = [+ { id: ids.uCounted, username: `counted-${suffix}`, isAccepted: true, isGhost: false },+ { id: ids.uGhost, username: `ghost-${suffix}`, isAccepted: true, isGhost: true },+ { id: ids.uInvited, username: `invited-${suffix}`, isAccepted: false, isGhost: false },+ { id: ids.uDeactivated, username: `deactivated-${suffix}`, isAccepted: true, isGhost: false }+ ];+ await testDb(TableName.Users).insert(userRows);++ const identityRows: (TIdentitiesInsert & { id: string })[] = [+ { id: ids.iOrgA, name: `identity-a-${suffix}`, orgId: ORG_ID },+ { id: ids.iOrgB, name: `identity-b-${suffix}`, orgId: ORG_ID },+ { id: ids.iProjectOnly, name: `identity-project-${suffix}`, orgId: ORG_ID }+ ];+ await testDb(TableName.Identity).insert(identityRows);++ const projectRows: (TProjectsInsert & { id: string })[] = [+ {+ id: scopes.counted.projectId,+ name: `sm-${suffix}`,+ slug: `sm-${suffix}`,+ orgId: ORG_ID,+ type: ProjectType.SecretManager+ },+ {+ id: scopes.otherProductType.projectId,+ name: `pam-${suffix}`,+ slug: `pam-${suffix}`,+ orgId: ORG_ID,+ type: ProjectType.PAM+ },+ {+ id: scopes.deletedProject.projectId,+ name: `sm-del-${suffix}`,+ slug: `sm-del-${suffix}`,+ orgId: ORG_ID,+ type: ProjectType.SecretManager,+ deleteAfter: new Date()+ },+ {+ id: scopes.deletedEnvironment.projectId,+ name: `sm-del-env-${suffix}`,+ slug: `sm-del-env-${suffix}`,+ orgId: ORG_ID,+ type: ProjectType.SecretManager+ },+ {+ id: scopes.otherOrg.projectId,+ name: `sm-other-org-${suffix}`,+ slug: `sm-other-org-${suffix}`,+ orgId: OTHER_ORG_ID,+ type: ProjectType.SecretManager+ }+ ];+ await testDb(TableName.Project).insert(projectRows);++ const environmentRows: (TProjectEnvironmentsInsert & { id: string })[] = scopeList.map((scope, index) => ({+ id: scope.envId,+ name: "Development",+ slug: "dev",+ position: index + 1,+ projectId: scope.projectId,+ ...(scope === scopes.deletedEnvironment ? { deleteAfter: new Date() } : {})+ }));+ await testDb(TableName.Environment).insert(environmentRows);++ const folderRows: (TSecretFoldersInsert & { id: string })[] = scopeList.map((scope) => ({+ id: scope.folderId,+ name: "root",+ envId: scope.envId,+ parentId: null+ }));+ await testDb(TableName.SecretFolder).insert(folderRows);++ const dynamicSecretRows: (TDynamicSecretsInsert & { id: string })[] = scopeList.map((scope) => ({+ id: scope.dynamicSecretId,+ name: `dyn-${scope.folderId}`,+ version: 1,+ type: "sql-database",+ defaultTTL: "1h",+ folderId: scope.folderId,+ encryptedInput: Buffer.from("{}")+ }));+ await testDb(TableName.DynamicSecret).insert(dynamicSecretRows);++ const membershipRows: (TMembershipsInsert & { id: string })[] = [+ // Users.+ {+ id: randomUUID(),+ scope: AccessScope.Organization,+ scopeOrgId: ORG_ID,+ actorUserId: ids.uCounted,+ status: OrgMembershipStatus.Accepted,+ isActive: true+ },+ {+ id: randomUUID(),+ scope: AccessScope.Organization,+ scopeOrgId: ORG_ID,+ actorUserId: ids.uGhost,+ status: OrgMembershipStatus.Accepted,+ isActive: true+ },+ {+ id: randomUUID(),+ scope: AccessScope.Organization,+ scopeOrgId: ORG_ID,+ actorUserId: ids.uInvited,+ status: OrgMembershipStatus.Invited,+ isActive: true+ },+ {+ id: randomUUID(),+ scope: AccessScope.Organization,+ scopeOrgId: ORG_ID,+ actorUserId: ids.uDeactivated,+ status: OrgMembershipStatus.Accepted,+ isActive: false+ },+ // Identities.+ { id: randomUUID(), scope: AccessScope.Organization, scopeOrgId: ORG_ID, actorIdentityId: ids.iOrgA },+ { id: randomUUID(), scope: AccessScope.Organization, scopeOrgId: ORG_ID, actorIdentityId: ids.iOrgB },+ {+ id: randomUUID(),+ scope: AccessScope.Project,+ scopeOrgId: ORG_ID,+ scopeProjectId: scopes.counted.projectId,+ actorIdentityId: ids.iProjectOnly+ }+ ];+ await testDb(TableName.Membership).insert(membershipRows);++ // Two leases in the only visible scope, one in each scope that must be filtered out.+ await testDb(TableName.DynamicSecretLease).insert([+ lease(scopes.counted.dynamicSecretId),+ lease(scopes.counted.dynamicSecretId),+ lease(scopes.otherProductType.dynamicSecretId),+ lease(scopes.deletedProject.dynamicSecretId),+ lease(scopes.deletedEnvironment.dynamicSecretId),+ lease(scopes.otherOrg.dynamicSecretId)+ ]);+ });++ afterAll(async () => {+ const orgIds = [ORG_ID, OTHER_ORG_ID];+ await testDb(TableName.DynamicSecretLease)+ .whereIn(+ "dynamicSecretId",+ scopeList.map((scope) => scope.dynamicSecretId)+ )+ .delete();+ await testDb(TableName.DynamicSecret)+ .whereIn(+ "id",+ scopeList.map((scope) => scope.dynamicSecretId)+ )+ .delete();+ await testDb(TableName.SecretFolder)+ .whereIn(+ "id",+ scopeList.map((scope) => scope.folderId)+ )+ .delete();+ await testDb(TableName.Environment)+ .whereIn(+ "id",+ scopeList.map((scope) => scope.envId)+ )+ .delete();+ await testDb(TableName.Membership).whereIn("scopeOrgId", orgIds).delete();+ await testDb(TableName.Project).whereIn("orgId", orgIds).delete();+ await testDb(TableName.Identity).whereIn("orgId", orgIds).delete();+ await testDb(TableName.Users).whereIn("id", Object.values(ids)).delete();+ await testDb(TableName.Organization).whereIn("id", orgIds).delete();+ });++ test("returns the three usage counts for the organization", async () => {+ const insights = await productInsightsService.getSecretsUsageInsights(actor(ORG_ID));++ // uCounted only: the ghost, the invited and the deactivated membership are all excluded.+ expect(insights.users).toBe(1);+ // iOrgA + iOrgB: iProjectOnly has no org-scoped membership.+ expect(insights.identities).toBe(2);+ // The two leases in the live SecretManager project. The PAM project, the soft-deleted project,+ // the soft-deleted environment and the other org each contribute nothing.+ expect(insights.activeLeases).toBe(2);+ });++ test("activeLeases drops when a lease is revoked", async () => {+ const revoked = await testDb(TableName.DynamicSecretLease)+ .where({ dynamicSecretId: scopes.counted.dynamicSecretId })+ .first();+ expect(revoked).toBeDefined();++ // Revocation hard-deletes the row, which is why the metric is active leases rather than+ // every lease ever created.+ await testDb(TableName.DynamicSecretLease).where({ id: revoked!.id }).delete();++ const insights = await productInsightsService.getSecretsUsageInsights(actor(ORG_ID));+ expect(insights.activeLeases).toBe(1);++ await testDb(TableName.DynamicSecretLease).insert(lease(scopes.counted.dynamicSecretId));+ expect((await productInsightsService.getSecretsUsageInsights(actor(ORG_ID))).activeLeases).toBe(2);+ });++ test("an organization with no resources reports zeroes", async () => {+ const insights = await productInsightsService.getSecretsUsageInsights(actor(randomUUID()));+ expect(insights).toEqual({ activeLeases: 0, users: 0, identities: 0 });+ });++ test("throws when the actor cannot read secrets management insights", async () => {+ canReadInsights = false;+ try {+ await expect(productInsightsService.getSecretsUsageInsights(actor(ORG_ID))).rejects.toBeInstanceOf(+ ForbiddenError+ );+ } finally {+ canReadInsights = true;+ }+ });++ test("throws when the plan does not include secret access insights", async () => {+ planHasInsights = false;+ try {+ await expect(productInsightsService.getSecretsUsageInsights(actor(ORG_ID))).rejects.toThrow(/Upgrade your plan/);+ } finally {+ planHasInsights = true;+ }+ });+});diff --git a/backend/e2e-test/routes/v1/product-insights.spec.ts b/backend/e2e-test/routes/v1/product-insights.spec.tsnew file mode 100644index 0000000000..7162473b01--- /dev/null+++ b/backend/e2e-test/routes/v1/product-insights.spec.ts@@ -0,0 +1,26 @@+import { describe, expect, test } from "vitest";++const URL = "/api/v1/product-insights/secrets/usage-insights";++// The counting itself is covered against a real database in e2e-test/product-insights-service.spec.ts.+// This file only asserts the route wiring, because the e2e instance runs unlicensed and the plan gate+// therefore rejects every request before any count is taken.+describe("Product Insights V1 Router", async () => {+ test("GET usage insights requires authentication", async () => {+ const res = await testServer.inject({ method: "GET", url: URL });+ expect(res.statusCode).toBe(401);+ });++ test("GET usage insights is registered and refuses on plan restriction", async () => {+ const res = await testServer.inject({+ method: "GET",+ url: URL,+ headers: { authorization: `Bearer ${jwtAuthToken}` }+ });++ // 400, not 403: the seeded user is an org admin, so it clears the Secrets Management Insights+ // permission check and falls through to the licence gate.+ expect(res.statusCode).toBe(400);+ expect(res.json().message).toContain("Upgrade your plan");+ });+});diff --git a/backend/src/ee/routes/v1/product-insights-router.ts b/backend/src/ee/routes/v1/product-insights-router.tsindex b7d80cc7f6..9f39be89f3 100644--- a/backend/src/ee/routes/v1/product-insights-router.ts+++ b/backend/src/ee/routes/v1/product-insights-router.ts@@ -1,2 +1,37 @@-// eslint-disable-next-line @typescript-eslint/no-unused-vars-export const registerProductInsightsRouter = async (server: FastifyZodProvider) => {};+import { z } from "zod";++import { SecretsUsageInsightsSchema } from "@app/ee/services/product-insights/product-insights-schemas";+import { readLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";+import { AuthMode } from "@app/services/auth/auth-type";++export const registerProductInsightsRouter = async (server: FastifyZodProvider) => {+ server.route({+ method: "GET",+ url: "/secrets/usage-insights",+ config: {+ rateLimit: readLimit+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ schema: {+ operationId: "getSecretsUsageInsights",+ description: "Get secrets management usage counts for the requesting organization.",+ response: {+ 200: z.object({+ usageInsights: SecretsUsageInsightsSchema+ })+ }+ },+ handler: async (req) => {+ const usageInsights = await server.services.productInsights.getSecretsUsageInsights({+ actor: req.permission.type,+ actorId: req.permission.id,+ actorAuthMethod: req.permission.authMethod,+ actorOrgId: req.permission.orgId,+ orgId: req.permission.orgId+ });++ return { usageInsights };+ }+ });+};diff --git a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal.ts b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal.tsindex 974e200612..0321e1ff05 100644--- a/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal.ts+++ b/backend/src/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal.ts@@ -1,12 +1,13 @@import { Knex } from "knex";import { TDbClient } from "@app/db";-import { DynamicSecretLeasesSchema, TableName } from "@app/db/schemas";+import { DynamicSecretLeasesSchema, ProjectType, TableName } from "@app/db/schemas";import { DatabaseError } from "@app/lib/errors";import { ormify, selectAllTableCols, TOrmify } from "@app/lib/knex";export interface TDynamicSecretLeaseDALFactory extends Omit<TOrmify<TableName.DynamicSecretLease>, "findById"> {countLeasesForDynamicSecret: (dynamicSecretId: string, tx?: Knex) => Promise<number>;+ countLeasesForOrg: (orgId: string, tx?: Knex) => Promise<number>;findById: (id: string,tx?: Knex@@ -56,6 +57,32 @@ export const dynamicSecretLeaseDALFactory = (db: TDbClient) => {}};+ // Leases are hard-deleted on revocation/expiry, so this is a count of currently active leases+ // rather than of every lease the org has ever created.+ const countLeasesForOrg = async (orgId: string, tx?: Knex) => {+ try {+ const doc = (await (tx || db.replicaNode())(TableName.DynamicSecretLease)+ .join(+ TableName.DynamicSecret,+ `${TableName.DynamicSecretLease}.dynamicSecretId`,+ `${TableName.DynamicSecret}.id`+ )+ .join(TableName.SecretFolder, `${TableName.DynamicSecret}.folderId`, `${TableName.SecretFolder}.id`)+ .join(TableName.Environment, `${TableName.SecretFolder}.envId`, `${TableName.Environment}.id`)+ .whereNull(`${TableName.Environment}.deleteAfter`)+ .join(TableName.Project, `${TableName.Environment}.projectId`, `${TableName.Project}.id`)+ .where(`${TableName.Project}.orgId`, orgId)+ .whereNull(`${TableName.Project}.deleteAfter`)+ .where(`${TableName.Project}.type`, ProjectType.SecretManager)+ .count(`${TableName.DynamicSecretLease}.id as count`)+ .first()) as { count: string } | undefined;++ return parseInt(doc?.count || "0", 10);+ } catch (error) {+ throw new DatabaseError({ error, name: "DynamicSecretCountLeasesForOrg" });+ }+ };+const findById = async (id: string, tx?: Knex) => {try {const doc = await (tx || db.replicaNode())(TableName.DynamicSecretLease)@@ -105,5 +132,5 @@ export const dynamicSecretLeaseDALFactory = (db: TDbClient) => {}};- return { ...orm, findById, countLeasesForDynamicSecret };+ return { ...orm, findById, countLeasesForDynamicSecret, countLeasesForOrg };};diff --git a/backend/src/ee/services/product-insights/product-insights-schemas.ts b/backend/src/ee/services/product-insights/product-insights-schemas.tsindex e69de29bb2..2d015d417d 100644--- a/backend/src/ee/services/product-insights/product-insights-schemas.ts+++ b/backend/src/ee/services/product-insights/product-insights-schemas.ts@@ -0,0 +1,9 @@+import { z } from "zod";++import { PRODUCT_INSIGHTS } from "@app/lib/api-docs";++export const SecretsUsageInsightsSchema = z.object({+ activeLeases: z.number().int().describe(PRODUCT_INSIGHTS.GET_SECRETS_USAGE_INSIGHTS.activeLeases),+ users: z.number().int().describe(PRODUCT_INSIGHTS.GET_SECRETS_USAGE_INSIGHTS.users),+ identities: z.number().int().describe(PRODUCT_INSIGHTS.GET_SECRETS_USAGE_INSIGHTS.identities)+});diff --git a/backend/src/ee/services/product-insights/product-insights-service.ts b/backend/src/ee/services/product-insights/product-insights-service.tsindex 76969619d6..7b4b586215 100644--- a/backend/src/ee/services/product-insights/product-insights-service.ts+++ b/backend/src/ee/services/product-insights/product-insights-service.ts@@ -1,17 +1,56 @@+import { TableName } from "@app/db/schemas";+import { TDynamicSecretLeaseDALFactory } from "@app/ee/services/dynamic-secret-lease/dynamic-secret-lease-dal";+import { OrgPermissionSecretsManagementInsightsActions } from "@app/ee/services/permission/org-permission";import { TPermissionServiceFactory } from "@app/ee/services/permission/permission-service-types";+import { BadRequestError } from "@app/lib/errors";+import { TIdentityOrgDALFactory } from "@app/services/identity/identity-org-dal";+import { TOrgDALFactory } from "@app/services/org/org-dal";import { TLicenseServiceFactory } from "../license/license-service";+import { checkSecretsManagementInsightsPermission } from "./product-insights-fns";+import { TGetSecretsUsageInsightsDTO, TSecretsUsageInsights } from "./product-insights-types";type TProductInsightsServiceFactoryDep = {permissionService: Pick<TPermissionServiceFactory, "getOrgPermission">;licenseService: Pick<TLicenseServiceFactory, "getPlan">;+ orgDAL: Pick<TOrgDALFactory, "countAllOrgMembers">;+ identityOrgMembershipDAL: Pick<TIdentityOrgDALFactory, "countAllOrgIdentities">;+ dynamicSecretLeaseDAL: Pick<TDynamicSecretLeaseDALFactory, "countLeasesForOrg">;};export type TProductInsightsServiceFactory = ReturnType<typeof productInsightsServiceFactory>;-export const productInsightsServiceFactory = (- // eslint-disable-next-line @typescript-eslint/no-unused-vars- { permissionService, licenseService }: TProductInsightsServiceFactoryDep-) => {- return {};+export const productInsightsServiceFactory = ({+ permissionService,+ licenseService,+ orgDAL,+ identityOrgMembershipDAL,+ dynamicSecretLeaseDAL+}: TProductInsightsServiceFactoryDep) => {+ const getSecretsUsageInsights = async (dto: TGetSecretsUsageInsightsDTO): Promise<TSecretsUsageInsights> => {+ await checkSecretsManagementInsightsPermission(+ permissionService,+ OrgPermissionSecretsManagementInsightsActions.Read,+ dto+ );++ const plan = await licenseService.getPlan(dto.orgId);+ if (!plan.secretAccessInsights) {+ throw new BadRequestError({+ message: "Secrets management insights are not available on your plan. Upgrade your plan to access insights."+ });+ }++ const [activeLeases, users, identities] = await Promise.all([+ dynamicSecretLeaseDAL.countLeasesForOrg(dto.orgId),+ orgDAL.countAllOrgMembers(dto.orgId),+ identityOrgMembershipDAL.countAllOrgIdentities({+ [`${TableName.Membership}.scopeOrgId` as "scopeOrgId"]: dto.orgId+ })+ ]);++ return { activeLeases, users, identities };+ };++ return { getSecretsUsageInsights };};diff --git a/backend/src/ee/services/product-insights/product-insights-types.ts b/backend/src/ee/services/product-insights/product-insights-types.tsindex 827123e754..ed9bab2371 100644--- a/backend/src/ee/services/product-insights/product-insights-types.ts+++ b/backend/src/ee/services/product-insights/product-insights-types.ts@@ -1,3 +1,11 @@import { TOrgPermission } from "@app/lib/types";export type TProductInsightsDTO = TOrgPermission;++export type TGetSecretsUsageInsightsDTO = TProductInsightsDTO;++export type TSecretsUsageInsights = {+ activeLeases: number;+ users: number;+ identities: number;+};diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex b010154d2a..3ac3258a55 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -2750,7 +2750,10 @@ export const registerRoutes = async (const productInsightsService = productInsightsServiceFactory({permissionService,- licenseService+ licenseService,+ orgDAL,+ identityOrgMembershipDAL,+ dynamicSecretLeaseDAL});// DAILY