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
change the count amount of the header stats
adilson42ab8e3a14ef
diff --git a/backend/src/ee/routes/v1/insights-router.ts b/backend/src/ee/routes/v1/insights-router.tsindex 3bd272583f..b44b9a9416 100644--- a/backend/src/ee/routes/v1/insights-router.ts+++ b/backend/src/ee/routes/v1/insights-router.ts@@ -291,7 +291,7 @@ export const registerInsightsRouter = async (server: FastifyZodProvider) => {schema: {operationId: "getSecretsCounts",description:- "Get whole-organization counts of secret management resources: projects, secrets, environments, and secret rotations.",+ "Get whole-organization counts of secret management resources: dynamic secrets, secrets, and secret rotations.",security: [{ bearerAuth: [] }],response: {200: z.object({diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex b5b5770fc8..4d290b3f0e 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -5573,9 +5573,8 @@ interface ViewSecretManagementInsightsProjectWarningsEvent {interface ViewSecretManagementInsightsOrgCountsEvent {type: EventType.VIEW_INSIGHTS_SECRETS_MANAGEMENT_ORG_COUNTS;metadata: {- projects: number;+ dynamicSecrets: number;secrets: number;- environments: number;rotations: number;};}diff --git a/backend/src/ee/services/insights/insights-dal.ts b/backend/src/ee/services/insights/insights-dal.tsindex 9d2c5a31d3..2e0d294b4b 100644--- a/backend/src/ee/services/insights/insights-dal.ts+++ b/backend/src/ee/services/insights/insights-dal.ts@@ -288,7 +288,7 @@ export const insightsDALFactory = (db: TDbClient) => {const countOrgSecretsResources = async (orgId: string,tx?: Knex- ): Promise<{ projects: number; secrets: number; environments: number; rotations: number }> => {+ ): Promise<{ dynamicSecrets: number; secrets: number; rotations: number }> => {try {const conn = tx || db.replicaNode();@@ -299,10 +299,11 @@ export const insightsDALFactory = (db: TDbClient) => {.where(`${TableName.Project}.version`, ProjectVersion.V3).whereNull(`${TableName.Project}.deleteAfter`) as T;- const [projectsRow, environmentsRow, secretsRow, rotationsRow] = await Promise.all([- scopeToOrgProjects(conn(TableName.Project)).count("* as count").first(),+ const [dynamicSecretsRow, secretsRow, rotationsRow] = await Promise.all([scopeToOrgProjects(- conn(TableName.Environment)+ conn(TableName.DynamicSecret)+ .join(TableName.SecretFolder, `${TableName.DynamicSecret}.folderId`, `${TableName.SecretFolder}.id`)+ .join(TableName.Environment, `${TableName.SecretFolder}.envId`, `${TableName.Environment}.id`).join(TableName.Project, `${TableName.Environment}.projectId`, `${TableName.Project}.id`).whereNull(`${TableName.Environment}.deleteAfter`))@@ -323,9 +324,8 @@ export const insightsDALFactory = (db: TDbClient) => {const toCount = (row: unknown) => Number((row as { count?: string | number } | undefined)?.count ?? 0);return {- projects: toCount(projectsRow),+ dynamicSecrets: toCount(dynamicSecretsRow),secrets: toCount(secretsRow),- environments: toCount(environmentsRow),rotations: toCount(rotationsRow)};} catch (error) {diff --git a/backend/src/ee/services/insights/insights-schemas.ts b/backend/src/ee/services/insights/insights-schemas.tsindex 199bbeb157..b66d313777 100644--- a/backend/src/ee/services/insights/insights-schemas.ts+++ b/backend/src/ee/services/insights/insights-schemas.ts@@ -48,9 +48,8 @@ export const OrgAuthMethodDistributionSchema = z.object({});export const OrgSecretsCountsSchema = z.object({- projects: z.number().int().describe(INSIGHTS.GET_SECRETS_COUNTS.projects),+ dynamicSecrets: z.number().int().describe(INSIGHTS.GET_SECRETS_COUNTS.dynamicSecrets),secrets: z.number().int().describe(INSIGHTS.GET_SECRETS_COUNTS.secrets),- environments: z.number().int().describe(INSIGHTS.GET_SECRETS_COUNTS.environments),rotations: z.number().int().describe(INSIGHTS.GET_SECRETS_COUNTS.rotations)});diff --git a/backend/src/ee/services/insights/insights-service.ts b/backend/src/ee/services/insights/insights-service.tsindex f7c74dc99e..b3dde7995f 100644--- a/backend/src/ee/services/insights/insights-service.ts+++ b/backend/src/ee/services/insights/insights-service.ts@@ -692,7 +692,7 @@ export const insightsServiceFactory = ({const getOrgSecretsCounts = async (dto: TOrgInsightsDTO): Promise<TOrgSecretsCounts> => {await assertOrgInsightsRead(dto);- const cacheKey = KeyStorePrefixes.InsightsCache(dto.orgId, "org-counts");+ const cacheKey = KeyStorePrefixes.InsightsCache(dto.orgId, "org-counts-v2");return withCache({keyStore,key: cacheKey,diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 7e92b22669..b5e785a5bb 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -935,10 +935,9 @@ export const INSIGHTS = {"The total number of times a secret value was accessed by a machine identity across every project in the organization in the last seven days. Accesses by users are not counted, and neither are accesses whose authentication method could not be determined, which happens for accesses recorded before the method was captured in audit logs."},GET_SECRETS_COUNTS: {- projects: "The number of secret management projects in the organization.",+ dynamicSecrets: "The total number of dynamic secrets across every secret management project in the organization.",secrets:"The total number of shared static secrets across every secret management project in the organization. Personal secret overrides are not counted.",- environments: "The total number of environments across every secret management project in the organization.",rotations: "The total number of secret rotations across every secret management project in the organization."},GET_STATIC_SECRETS_USAGE: {diff --git a/frontend/src/hooks/api/secretInsights/types.ts b/frontend/src/hooks/api/secretInsights/types.tsindex 08b56aaa92..3c2081177a 100644--- a/frontend/src/hooks/api/secretInsights/types.ts+++ b/frontend/src/hooks/api/secretInsights/types.ts@@ -222,8 +222,7 @@ export type TOrgSecretAccessVolume = {};export type TOrgSecretsCounts = {- projects: number;+ dynamicSecrets: number;secrets: number;- environments: number;rotations: number;};diff --git a/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx b/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsxindex 88ea261604..264571dab1 100644--- a/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx+++ b/frontend/src/pages/organization/SecretInsightsPage/SecretInsightsPage.tsx@@ -1,7 +1,7 @@import { Fragment, ReactNode, useMemo } from "react";import { Helmet } from "react-helmet";import { format } from "date-fns";-import { BoxIcon, FileTextIcon, KeyIcon, LayersIcon, PlusIcon, RefreshCwIcon } from "lucide-react";+import { BoxIcon, FileTextIcon, KeyIcon, RefreshCwIcon } from "lucide-react";import { OrgPermissionCan } from "@app/components/permissions";import { PageHeader } from "@app/components/v2";@@ -107,8 +107,8 @@ export const SecretInsightsPage = withPermission(const headerStats: { label: string; value: number; icon: ReactNode }[] = counts? [{- label: "projects",- value: counts.projects,+ label: "total dynamic secrets",+ value: counts.dynamicSecrets,icon: <BoxIcon className="size-3.5 text-accent" />},{@@ -117,19 +117,14 @@ export const SecretInsightsPage = withPermission(icon: <KeyIcon className="size-3.5 text-accent" />},{- label: "environments",- value: counts.environments,- icon: <LayersIcon className="size-3.5 text-accent" />- },- {- label: "rotations",+ label: "secret rotations",value: counts.rotations,icon: <RefreshCwIcon className="size-3.5 text-secret-rotation" />}]: [];- const renderStatStrip = (className: string) => (+ const renderStatStrip = (className: string, withTrailingSeparator = false) => (<div className={`flex-wrap items-center gap-x-2 gap-y-1 text-xs text-accent ${className}`}>{headerStats.map((stat, idx) => (<Fragment key={stat.label}>@@ -143,6 +138,7 @@ export const SecretInsightsPage = withPermission(</span></Fragment>))}+ {withTrailingSeparator && headerStats.length > 0 && <span className="text-border">|</span>}</div>);@@ -160,7 +156,7 @@ export const SecretInsightsPage = withPermission(title="Insights"description="Organization-wide visibility into secret health, access patterns, and authentication hygiene.">- {renderStatStrip("hidden justify-end dashboard:flex")}+ {renderStatStrip("hidden justify-end dashboard:flex", true)}<div className="flex items-center gap-3">{lastSentReport && (<span className="flex items-center gap-1.5 text-xs whitespace-nowrap text-mineshaft-300">diff --git a/frontend/src/pages/organization/SecretInsightsPage/components/StaticSecretPresenceCard.tsx b/frontend/src/pages/organization/SecretInsightsPage/components/StaticSecretPresenceCard.tsxindex 9aa1b1ca2a..a19e4545ad 100644--- a/frontend/src/pages/organization/SecretInsightsPage/components/StaticSecretPresenceCard.tsx+++ b/frontend/src/pages/organization/SecretInsightsPage/components/StaticSecretPresenceCard.tsx@@ -82,14 +82,10 @@ export const StaticSecretPresenceCard = ({ data }: { data: TOrgStaticSecretUsageconst trend = useMemo(() => getCreationTrend(data.weeks), [data.weeks]);return (- // h-full lets the card stretch to match AuthMethodsCard when they share a grid row- // (the Card base class is h-fit, which would otherwise opt out of the stretch)<Card className="h-full"><CardHeader>- <CardTitle>Static Secret Presence</CardTitle>- <CardDescription>- Static secrets created across all projects, past 12 weeks.- </CardDescription>+ <CardTitle>New Secrets Created</CardTitle>+ <CardDescription>Secrets created across all projects, past 12 weeks.</CardDescription>{trend && (<CardAction><Badge variant={trend.variant}>