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
find duplicated values
Matheus Nogueirab0029f99ab2c
diff --git a/backend/src/db/migrations/20260604100000_add-secret-blind-index-enabled-to-project.ts b/backend/src/db/migrations/20260604100000_add-secret-blind-index-enabled-to-project.tsnew file mode 100644index 0000000000..586b033aae--- /dev/null+++ b/backend/src/db/migrations/20260604100000_add-secret-blind-index-enabled-to-project.ts@@ -0,0 +1,32 @@+import { Knex } from "knex";++import { TableName } from "../schemas";++export async function up(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(TableName.Project);+ if (!hasTable) return;++ const hasColumn = await knex.schema.hasColumn(TableName.Project, "secretBlindIndexEnabled");+ if (!hasColumn) {+ await knex.schema.alterTable(TableName.Project, (t) => {+ t.boolean("secretBlindIndexEnabled").defaultTo(true).notNullable();+ });++ // Ensure all existing projects are flagged with `secretBlindIndexEnabled: false`+ // New projects already populate the `blindIndex`, so only old projects don't have it enabled+ // by default.+ await knex(TableName.Project).update({ secretBlindIndexEnabled: false });+ }+}++export async function down(knex: Knex): Promise<void> {+ const hasTable = await knex.schema.hasTable(TableName.Project);+ if (!hasTable) return;++ const hasColumn = await knex.schema.hasColumn(TableName.Project, "secretBlindIndexEnabled");+ if (hasColumn) {+ await knex.schema.alterTable(TableName.Project, (t) => {+ t.dropColumn("secretBlindIndexEnabled");+ });+ }+}diff --git a/backend/src/db/schemas/projects.ts b/backend/src/db/schemas/projects.tsindex 851143ab5c..87b6727bb8 100644--- a/backend/src/db/schemas/projects.ts+++ b/backend/src/db/schemas/projects.ts@@ -36,7 +36,8 @@ export const ProjectsSchema = z.object({deleteAfter: z.date().nullable().optional(),softDeletedAt: z.date().nullable().optional(),deletedByActorType: z.string().nullable().optional(),- deletedByActorId: z.string().uuid().nullable().optional()+ deletedByActorId: z.string().uuid().nullable().optional(),+ secretBlindIndexEnabled: z.boolean().default(true)});export type TProjects = z.infer<typeof ProjectsSchema>;diff --git a/backend/src/ee/routes/v1/insights-router.ts b/backend/src/ee/routes/v1/insights-router.tsindex 7c65e229fd..4caa042b83 100644--- a/backend/src/ee/routes/v1/insights-router.ts+++ b/backend/src/ee/routes/v1/insights-router.ts@@ -163,6 +163,49 @@ export const registerInsightsRouter = async (server: FastifyZodProvider) => {}});+ server.route({+ method: "GET",+ url: "/secrets/secrets-duplication",+ config: { rateLimit: readLimit },+ schema: {+ operationId: "getInsightsSecretsDuplication",+ description: "Get groups of duplicated secrets across environments and paths",+ security: [{ bearerAuth: [] }],+ querystring: z.object({+ projectId: z.string().trim(),+ offset: z.coerce.number().min(0).max(10000).default(0),+ limit: z.coerce.number().min(1).max(100).default(50)+ }),+ response: {+ 200: z.object({+ secretBlindIndexEnabled: z.boolean(),+ groups: z.array(+ z.object({+ secrets: z.array(+ z.object({+ key: z.string(),+ environment: z.string(),+ secretPath: z.string()+ })+ )+ })+ )+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const { projectId, offset, limit } = req.query;+ const result = await server.services.insights.getSecretsDuplication({ projectId, offset, limit }, req.permission);+ await server.services.auditLog.createAuditLog({+ projectId,+ event: { type: EventType.VIEW_INSIGHTS_SECRETS_DUPLICATION, metadata: { projectId } },+ ...req.auditLogInfo+ });+ return result;+ }+ });+server.route({method: "GET",url: "/secrets/summary",diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.tsindex 2179d4b357..2edcdac0a7 100644--- a/backend/src/ee/services/audit-log/audit-log-types.ts+++ b/backend/src/ee/services/audit-log/audit-log-types.ts@@ -676,6 +676,7 @@ export enum EventType {VIEW_INSIGHTS_SECRETS_MANAGEMENT_ACCESS_VOLUME = "view-insights-secrets-management-access-volume",VIEW_INSIGHTS_SECRETS_MANAGEMENT_ACCESS_LOCATIONS = "view-insights-secrets-management-access-locations",VIEW_INSIGHTS_SECRETS_MANAGEMENT_SUMMARY = "view-insights-secrets-management-summary",+ VIEW_INSIGHTS_SECRETS_DUPLICATION = "view-insights-secrets-duplication",VIEW_INSIGHTS_PAM_SUMMARY = "view-insights-pam-summary",VIEW_INSIGHTS_PAM_SESSION_ACTIVITY = "view-insights-pam-session-activity",VIEW_INSIGHTS_PAM_TOP_ACTORS = "view-insights-pam-top-actors",@@ -5603,6 +5604,13 @@ interface ViewSecretManagementInsightsSummaryEvent {};}+interface ViewInsightsSecretsDuplicationEvent {+ type: EventType.VIEW_INSIGHTS_SECRETS_DUPLICATION;+ metadata: {+ projectId: string;+ };+}+interface ViewAuditLogsEvent {type: EventType.VIEW_AUDIT_LOGS;metadata?: Record<string, unknown>;@@ -7737,6 +7745,7 @@ export type Event =| ViewSecretManagementInsightsAccessLocationsEvent| ViewInsightsAuthMethodsEvent| ViewSecretManagementInsightsSummaryEvent+ | ViewInsightsSecretsDuplicationEvent| ViewAuditLogsEvent| ViewPamInsightsSummaryEvent| ViewPamInsightsSessionActivityEventdiff --git a/backend/src/ee/services/insights/insights-service.ts b/backend/src/ee/services/insights/insights-service.tsindex a1071ea148..c17e5a4c90 100644--- a/backend/src/ee/services/insights/insights-service.ts+++ b/backend/src/ee/services/insights/insights-service.ts@@ -14,6 +14,7 @@ import { BadRequestError } from "@app/lib/errors";import { OrgServiceActor } from "@app/lib/types";import { ActorType } from "@app/services/auth/auth-type";import { TProjectBotServiceFactory } from "@app/services/project-bot/project-bot-service";+import { TProjectDALFactory } from "@app/services/project/project-dal";import { TReminderDALFactory } from "@app/services/reminder/reminder-dal";import { TSecretFolderDALFactory } from "@app/services/secret-folder/secret-folder-dal";import { TSecretV2BridgeDALFactory } from "@app/services/secret-v2-bridge/secret-v2-bridge-dal";@@ -24,7 +25,8 @@ import {TGetAccessVolumeDTO,TGetAuthMethodDistributionDTO,TGetInsightsCalendarDTO,- TGetInsightsSummaryDTO+ TGetInsightsSummaryDTO,+ TGetSecretsDuplicationDTO} from "./insights-types";type TInsightsServiceFactoryDep = {@@ -34,8 +36,9 @@ type TInsightsServiceFactoryDep = {secretRotationV2DAL: Pick<TSecretRotationV2DALFactory, "findByProjectAndDateRange" | "findByProject">;reminderDAL: Pick<TReminderDALFactory, "findByProjectAndDateRange">;folderDAL: Pick<TSecretFolderDALFactory, "findSecretPathByFolderIds">;- secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "findStaleByProject" | "countStaleByProject">;+ secretV2BridgeDAL: Pick<TSecretV2BridgeDALFactory, "findStaleByProject" | "countStaleByProject" | "findDuplicatedSecretValues">;projectBotService: Pick<TProjectBotServiceFactory, "getBotKey">;+ projectDAL: Pick<TProjectDALFactory, "findById">;userDAL: Pick<TUserDALFactory, "find">;keyStore: Pick<TKeyStoreFactory, "setItemWithExpiry" | "getItem">;};@@ -85,6 +88,7 @@ export const insightsServiceFactory = ({folderDAL,secretV2BridgeDAL,projectBotService,+ projectDAL,userDAL,keyStore}: TInsightsServiceFactoryDep) => {@@ -488,11 +492,46 @@ export const insightsServiceFactory = ({});};+ const getSecretsDuplication = async (dto: TGetSecretsDuplicationDTO, actorDto: OrgServiceActor) => {+ await checkInsightsPermission(permissionService, licenseService, dto.projectId, actorDto);++ const project = await projectDAL.findById(dto.projectId);++ if (!project.secretBlindIndexEnabled) {+ return { secretBlindIndexEnabled: false, groups: [] };+ }++ const rawGroups = await secretV2BridgeDAL.findDuplicatedSecretValues(dto.projectId, {+ offset: dto.offset ?? 0,+ limit: dto.limit ?? 50+ });++ const folderIds = [...new Set(rawGroups.flatMap((g) => g.secrets.map((s) => s.folderId)))];+ const foldersWithPath = folderIds.length+ ? await folderDAL.findSecretPathByFolderIds(dto.projectId, folderIds)+ : [];+ const folderRecord: Record<string, string> = {};+ foldersWithPath.forEach((f) => {+ if (f) folderRecord[f.id] = f.path;+ });++ const groups = rawGroups.map((g) => ({+ secrets: g.secrets.map((s) => ({+ key: s.key,+ environment: s.environment,+ secretPath: folderRecord[s.folderId] ?? "/"+ }))+ }));++ return { secretBlindIndexEnabled: true, groups };+ };+return {getCalendar,getAccessVolume,// getAccessLocations,getAuthMethodDistribution,- getSummary+ getSummary,+ getSecretsDuplication};};diff --git a/backend/src/ee/services/insights/insights-types.ts b/backend/src/ee/services/insights/insights-types.tsindex 4705b5c609..ae9bb70268 100644--- a/backend/src/ee/services/insights/insights-types.ts+++ b/backend/src/ee/services/insights/insights-types.ts@@ -23,3 +23,9 @@ export type TGetInsightsSummaryDTO = {staleSecretsOffset?: number;staleSecretsLimit?: number;};++export type TGetSecretsDuplicationDTO = {+ projectId: string;+ offset?: number;+ limit?: number;+};diff --git a/backend/src/lib/errors/index.ts b/backend/src/lib/errors/index.tsindex c7577fe7bf..d50ae09f1f 100644--- a/backend/src/lib/errors/index.ts+++ b/backend/src/lib/errors/index.ts@@ -118,6 +118,31 @@ export class BadRequestError extends Error {}}+export class PreconditionFailedError extends Error {+ name: string;++ error: unknown;++ details?: unknown;++ constructor({+ name,+ error,+ message,+ details+ }: {+ message?: string;+ name?: string;+ error?: unknown;+ details?: unknown;+ }) {+ super(message ?? "A precondition for this request was not met");+ this.name = name || "PreconditionFailed";+ this.error = error;+ this.details = details;+ }+}+export class RateLimitError extends Error {constructor({ message }: { message?: string }) {super(message || "Rate limit exceeded");diff --git a/backend/src/server/plugins/error-handler.ts b/backend/src/server/plugins/error-handler.tsindex 47a5cfd3eb..197a5928f6 100644--- a/backend/src/server/plugins/error-handler.ts+++ b/backend/src/server/plugins/error-handler.ts@@ -18,6 +18,7 @@ import {OidcAuthError,PermissionBoundaryError,PolicyViolationError,+ PreconditionFailedError,RateLimitError,ScimRequestError,UnauthorizedError@@ -37,6 +38,7 @@ enum HttpStatusCodes {NotFound = 404,Unauthorized = 401,Forbidden = 403,+ PreconditionFailed = 412,UnprocessableContent = 422,// eslint-disable-next-line @typescript-eslint/no-shadowInternalServerError = 500,@@ -153,6 +155,14 @@ export const fastifyErrHandler = fastifyPlugin(async (server: FastifyZodProvidererror: error.name,details: error.details});+ } else if (error instanceof PreconditionFailedError) {+ void res.status(HttpStatusCodes.PreconditionFailed).send({+ reqId: req.id,+ statusCode: HttpStatusCodes.PreconditionFailed,+ message: error.message,+ error: error.name,+ details: error.details+ });} else if (error instanceof NotFoundError) {void res.status(HttpStatusCodes.NotFound)diff --git a/backend/src/server/routes/index.ts b/backend/src/server/routes/index.tsindex 3f60027115..5432b65cab 100644--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@ -2612,6 +2612,7 @@ export const registerRoutes = async (folderDAL,secretV2BridgeDAL,projectBotService,+ projectDAL,userDAL,keyStore});diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.tsindex 6dc6effe44..b5213c3f10 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-dal.ts@@ -1200,6 +1200,64 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => {}};+ const findDuplicatedSecretValues = async (+ projectId: string,+ pagination?: { offset: number; limit: number },+ tx?: Knex+ ) => {+ try {+ const duplicateBlindIndexes = (tx || db.replicaNode())(TableName.SecretV2)+ .join(TableName.SecretFolder, `${TableName.SecretV2}.folderId`, `${TableName.SecretFolder}.id`)+ .join(TableName.Environment, `${TableName.SecretFolder}.envId`, `${TableName.Environment}.id`)+ .where(`${TableName.Environment}.projectId`, projectId)+ .whereNull(`${TableName.Environment}.deleteAfter`)+ .whereNull(`${TableName.SecretV2}.userId`)+ .whereNotNull(`${TableName.SecretV2}.secretValueBlindIndex`)+ .groupBy(`${TableName.SecretV2}.secretValueBlindIndex`)+ .having(db.raw("count(*) > 1"))+ .select(`${TableName.SecretV2}.secretValueBlindIndex`)+ .orderBy(`${TableName.SecretV2}.secretValueBlindIndex`)+ .offset(pagination?.offset ?? 0)+ .limit(pagination?.limit ?? 50);++ const rows = await (tx || db.replicaNode())(TableName.SecretV2)+ .join(TableName.SecretFolder, `${TableName.SecretV2}.folderId`, `${TableName.SecretFolder}.id`)+ .join(TableName.Environment, `${TableName.SecretFolder}.envId`, `${TableName.Environment}.id`)+ .whereIn(`${TableName.SecretV2}.secretValueBlindIndex`, duplicateBlindIndexes)+ .whereNull(`${TableName.Environment}.deleteAfter`)+ .whereNull(`${TableName.SecretV2}.userId`)+ .select(+ `${TableName.SecretV2}.key`,+ `${TableName.SecretV2}.folderId`,+ `${TableName.SecretV2}.secretValueBlindIndex`,+ `${TableName.Environment}.slug as environment`+ )+ .orderBy(`${TableName.SecretV2}.secretValueBlindIndex`);++ const groups: { secrets: { key: string; environment: string; folderId: string }[] }[] = [];+ let currentIndex: string | null = null;+ let currentGroup: { key: string; environment: string; folderId: string }[] = [];++ for (const row of rows as { key: string; folderId: string; secretValueBlindIndex: string; environment: string }[]) {+ if (row.secretValueBlindIndex !== currentIndex) {+ if (currentGroup.length > 0) {+ groups.push({ secrets: currentGroup });+ }+ currentIndex = row.secretValueBlindIndex;+ currentGroup = [];+ }+ currentGroup.push({ key: row.key, environment: row.environment, folderId: row.folderId });+ }+ if (currentGroup.length > 0) {+ groups.push({ secrets: currentGroup });+ }++ return groups;+ } catch (error) {+ throw new DatabaseError({ error, name: "findDuplicatedSecretValues" });+ }+ };+const countStaleByProject = async (projectId: string, staleBeforeDate: Date, tx?: Knex) => {try {const result = await (tx || db.replicaNode())(TableName.SecretV2)@@ -1236,6 +1294,7 @@ export const secretV2BridgeDALFactory = ({ db, keyStore }: TSecretV2DalArg) => {countByFolderIds,findStaleByProject,countStaleByProject,+ findDuplicatedSecretValues,findOne,find,invalidateSecretCacheByProjectId,diff --git a/frontend/src/hooks/api/secretInsights/index.ts b/frontend/src/hooks/api/secretInsights/index.tsindex 6f6a248854..2091982cd0 100644--- a/frontend/src/hooks/api/secretInsights/index.ts+++ b/frontend/src/hooks/api/secretInsights/index.ts@@ -3,13 +3,16 @@ export {useGetCalendarInsights,useGetInsightsSummary,// useGetSecretAccessLocations,- useGetSecretAccessVolume+ useGetSecretAccessVolume,+ useGetSecretsDuplication} from "./queries";export type {TAccessLocation,TAuthMethodCount,TCalendarReminder,TCalendarRotation,+ TDuplicatedSecretEntry,+ TDuplicatedSecretGroup,TGetAuthMethodDistributionDTO,TGetAuthMethodDistributionResponse,TGetCalendarInsightsDTO,@@ -18,6 +21,8 @@ export type {TGetSecretAccessLocationsResponse,TGetSecretAccessVolumeDTO,TGetSecretAccessVolumeResponse,+ TGetSecretsDuplicationDTO,+ TGetSecretsDuplicationResponse,TSecretAccessVolumeActor,TSecretAccessVolumeDay} from "./types";diff --git a/frontend/src/hooks/api/secretInsights/queries.tsx b/frontend/src/hooks/api/secretInsights/queries.tsxindex c0d72b1705..3a5b0172d5 100644--- a/frontend/src/hooks/api/secretInsights/queries.tsx+++ b/frontend/src/hooks/api/secretInsights/queries.tsx@@ -12,7 +12,9 @@ import {// TGetSecretAccessLocationsDTO,// TGetSecretAccessLocationsResponse,TGetSecretAccessVolumeDTO,- TGetSecretAccessVolumeResponse+ TGetSecretAccessVolumeResponse,+ TGetSecretsDuplicationDTO,+ TGetSecretsDuplicationResponse} from "./types";export const secretInsightsKeys = {@@ -26,7 +28,9 @@ export const secretInsightsKeys = {authMethodDistribution: (params: TGetAuthMethodDistributionDTO) =>[...secretInsightsKeys.all(), "auth-method-distribution", params] as const,summary: (params: TGetInsightsSummaryDTO) =>- [...secretInsightsKeys.all(), "summary", params] as const+ [...secretInsightsKeys.all(), "summary", params] as const,+ secretsDuplication: (params: TGetSecretsDuplicationDTO) =>+ [...secretInsightsKeys.all(), "secrets-duplication", params] as const};const INSIGHTS_STALE_TIME = 5 * 60 * 1000; // 5 minutes@@ -160,3 +164,29 @@ export const useGetInsightsSummary = (...options});};++export const useGetSecretsDuplication = (+ params: TGetSecretsDuplicationDTO,+ options?: Omit<+ UseQueryOptions<+ TGetSecretsDuplicationResponse,+ unknown,+ TGetSecretsDuplicationResponse,+ ReturnType<typeof secretInsightsKeys.secretsDuplication>+ >,+ "queryKey" | "queryFn"+ >+) => {+ return useQuery({+ queryKey: secretInsightsKeys.secretsDuplication(params),+ queryFn: async () => {+ const { data } = await apiRequest.get<TGetSecretsDuplicationResponse>(+ "/api/v1/insights/secrets/secrets-duplication",+ { params }+ );+ return data;+ },+ staleTime: INSIGHTS_STALE_TIME,+ ...options+ });+};diff --git a/frontend/src/hooks/api/secretInsights/types.ts b/frontend/src/hooks/api/secretInsights/types.tsindex 71f6909fa3..60cc65a9ba 100644--- a/frontend/src/hooks/api/secretInsights/types.ts+++ b/frontend/src/hooks/api/secretInsights/types.ts@@ -120,3 +120,24 @@ export type TGetAuthMethodDistributionDTO = {export type TGetAuthMethodDistributionResponse = {methods: TAuthMethodCount[];};++export type TGetSecretsDuplicationDTO = {+ projectId: string;+ offset?: number;+ limit?: number;+};++export type TDuplicatedSecretEntry = {+ key: string;+ environment: string;+ secretPath: string;+};++export type TDuplicatedSecretGroup = {+ secrets: TDuplicatedSecretEntry[];+};++export type TGetSecretsDuplicationResponse = {+ secretBlindIndexEnabled: boolean;+ groups: TDuplicatedSecretGroup[];+};diff --git a/frontend/src/pages/secret-manager/InsightsPage/components/DuplicatedSecretsCard.tsx b/frontend/src/pages/secret-manager/InsightsPage/components/DuplicatedSecretsCard.tsxindex 80bd025044..24246c8ddd 100644--- a/frontend/src/pages/secret-manager/InsightsPage/components/DuplicatedSecretsCard.tsx+++ b/frontend/src/pages/secret-manager/InsightsPage/components/DuplicatedSecretsCard.tsx@@ -5,7 +5,7 @@ import {AccordionContent,AccordionItem,AccordionTrigger,- Badge,+ Button,Card,CardContent,CardDescription,@@ -18,21 +18,8 @@ import {TooltipProvider,TooltipTrigger} from "@app/components/v3";--type DuplicatedSecretEntry = {- secretKey: string;- environment: string;- environmentSlug: string;- secretPath: string;-};--type DuplicatedSecretGroup = {- id: string;- hash: string;- count: number;- environmentCount: number;- entries: DuplicatedSecretEntry[];-};+import { useProject } from "@app/context";+import { useGetSecretsDuplication } from "@app/hooks/api/secretInsights";const ENVIRONMENT_COLOR_MAP: Record<string, string> = {production: "bg-green-500",@@ -45,58 +32,16 @@ const getEnvironmentDotColor = (slug: string) => {return ENVIRONMENT_COLOR_MAP[slug] || "bg-primary";};-const MOCK_DATA: DuplicatedSecretGroup[] = [- {- id: "1",- hash: "abc123",- count: 4,- environmentCount: 3,- entries: [- {- secretKey: "DATABASE_URL",- environment: "Production",- environmentSlug: "production",- secretPath: "/backend"- },- {- secretKey: "DB_CONNECTION_STRING",- environment: "Staging",- environmentSlug: "staging",- secretPath: "/backend"- },- {- secretKey: "POSTGRES_URL",- environment: "Development",- environmentSlug: "development",- secretPath: "/services/api"- },- {- secretKey: "DATABASE_URL",- environment: "Development",- environmentSlug: "development",- secretPath: "/services/worker"- }- ]- },- {- id: "2",- hash: "def456",- count: 3,- environmentCount: 2,- entries: []- },- {- id: "3",- hash: "ghi789",- count: 2,- environmentCount: 2,- entries: []- }-];-export const DuplicatedSecretsCard = () => {- const isPending = false;- const groups = MOCK_DATA;+ const { projectId } = useProject();++ const { data, isPending } = useGetSecretsDuplication(+ { projectId },+ { enabled: !!projectId }+ );++ const groups = data?.groups ?? [];+ const secretBlindIndexEnabled = data?.secretBlindIndexEnabled ?? true;return (<Card>@@ -109,46 +54,46 @@ export const DuplicatedSecretsCard = () => {</CardHeader><CardContent>{isPending && <Skeleton className="h-[280px] w-full" />}- {!isPending && groups.length === 0 && (+ {!isPending && !secretBlindIndexEnabled && (+ <div className="flex h-[200px] items-center justify-center">+ <Button variant="outline">Enable Secret Duplication Detection</Button>+ </div>+ )}+ {!isPending && secretBlindIndexEnabled && groups.length === 0 && (<div className="flex h-[200px] items-center justify-center"><p className="text-sm text-muted">No duplicated secrets found</p></div>)}- {!isPending && groups.length > 0 && (+ {!isPending && secretBlindIndexEnabled && groups.length > 0 && (<Accordion type="multiple">- {groups.map((group) => (- <AccordionItem key={group.id} value={group.id}>+ {groups.map((group, groupIdx) => (+ <AccordionItem key={`group-${String(groupIdx)}`} value={`group-${String(groupIdx)}`}><AccordionTrigger><div className="flex flex-1 items-center justify-between"><div className="flex items-center gap-2"><LockIcon className="size-3.5 text-muted" /><span className="text-sm text-foreground">- <span className="font-medium">{group.count} secrets</span> share an- identical value+ <span className="font-medium">{group.secrets.length} secrets</span> share+ an identical value</span></div>- <Badge variant="outline">- {group.environmentCount} Environment{group.environmentCount !== 1 && "s"}- </Badge></div></AccordionTrigger><AccordionContent>- {group.entries.length > 0 ? (+ {group.secrets.length > 0 ? (<div className="flex flex-col">- {group.entries.map((entry, idx) => (+ {group.secrets.map((entry, idx) => (<div- key={`${entry.secretKey}-${entry.environmentSlug}-${entry.secretPath}-${String(idx)}`}+ key={`${entry.key}-${entry.environment}-${entry.secretPath}-${String(idx)}`}className="group/row -mx-2 flex items-center gap-6 rounded-md px-2 py-1.5 text-sm hover:bg-container-hover"><div className="flex w-48 shrink-0 items-center gap-2"><LinkIcon className="size-3.5 text-muted" />- <span className="truncate font-mono text-foreground">- {entry.secretKey}- </span>+ <span className="truncate font-mono text-foreground">{entry.key}</span></div><div className="flex w-28 shrink-0 items-center gap-2"><span- className={`size-2 shrink-0 rounded-full ${getEnvironmentDotColor(entry.environmentSlug)}`}+ className={`size-2 shrink-0 rounded-full ${getEnvironmentDotColor(entry.environment)}`}/><span className="truncate text-foreground">{entry.environment}</span></div>