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
refactor(secret-sync): check move warnings in the frontend
Calvin8c82b2b94350
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 358832fee8..032de566fe 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -1506,23 +1506,6 @@ export const SECRET_IMPORTS = {} as const;export const DASHBOARD = {- MOVE_WARNINGS: {- projectId: "The ID of the project containing the items being moved or copied.",- sourceEnvironment: "The slug of the environment the items are moved or copied from.",- sourceSecretPath: "The folder the items are moved or copied from.",- destinationEnvironment: "The slug of the environment the items are moved or copied to.",- destinationSecretPath: "The folder the items are moved or copied into.",- secretSyncs:- "The secret syncs you can read that cover the destination folder or a folder beneath it, but not the source folder, so may start sending the items to their destination.",- hasHiddenSecretSyncs:- "Whether secret syncs you cannot read would also start sending the items to their destination.",- syncId: "The ID of the secret sync.",- syncName: "The name of the secret sync.",- syncDestination: "The external service the secret sync sends secrets to.",- syncSecretPath: "The folder the secret sync reads secrets from.",- includeAllSubFolders: "Whether the secret sync also reads the folders beneath its path.",- isAutoSyncEnabled: "Whether the secret sync runs automatically when secrets change."- },SECRET_METADATA_LIST: {projectId: "The ID of the project containing the secrets.",environment: "The slug of the environment containing the secrets.",diff --git a/backend/src/server/routes/v1/dashboard-router.ts b/backend/src/server/routes/v1/dashboard-router.tsindex 5676ccef38..badc66e507 100644--- a/backend/src/server/routes/v1/dashboard-router.ts+++ b/backend/src/server/routes/v1/dashboard-router.ts@@ -12,7 +12,6 @@ import { BadRequestError, NotFoundError } from "@app/lib/errors";import { prefixWithSlash, removeTrailingSlash } from "@app/lib/fn";import { OrderByDirection } from "@app/lib/types";import { readLimit, secretsLimit } from "@app/server/config/rateLimiter";-import { slugSchema } from "@app/server/lib/schemas";import { getTelemetryDistinctId } from "@app/server/lib/telemetry";import { getUserAgentType } from "@app/server/plugins/audit-log";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";@@ -36,7 +35,6 @@ import {SecretImportReferencesBehavior,SecretsOrderBy} from "@app/services/secret/secret-types";-import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";import { SecretMetadataQuerySchema, SecretMetadataResponseSchema } from "./dashboard-secret-metadata-schemas";@@ -2172,69 +2170,6 @@ export const registerDashboardRouter = async (server: FastifyZodProvider) => {}});- server.route({- method: "GET",- url: "/move-warnings",- config: {- rateLimit: readLimit- },- schema: {- operationId: "listMoveWarnings",- description:- "List what a user should know before moving or copying items from one path to another, such as secret syncs that would start sending them to an external service",- security: [- {- bearerAuth: []- }- ],- querystring: z.object({- projectId: z.string().trim().uuid().describe(DASHBOARD.MOVE_WARNINGS.projectId),- sourceEnvironment: slugSchema({ field: "Source environment" }).describe(- DASHBOARD.MOVE_WARNINGS.sourceEnvironment- ),- sourceSecretPath: z- .string()- .trim()- .max(1000)- .default("/")- .transform(prefixWithSlash)- .transform(removeTrailingSlash)- .describe(DASHBOARD.MOVE_WARNINGS.sourceSecretPath),- destinationEnvironment: slugSchema({ field: "Destination environment" }).describe(- DASHBOARD.MOVE_WARNINGS.destinationEnvironment- ),- destinationSecretPath: z- .string()- .trim()- .max(1000)- .default("/")- .transform(prefixWithSlash)- .transform(removeTrailingSlash)- .describe(DASHBOARD.MOVE_WARNINGS.destinationSecretPath)- }),- response: {- 200: z.object({- secretSyncs: z- .object({- id: z.string().describe(DASHBOARD.MOVE_WARNINGS.syncId),- name: z.string().describe(DASHBOARD.MOVE_WARNINGS.syncName),- destination: z.nativeEnum(SecretSync).describe(DASHBOARD.MOVE_WARNINGS.syncDestination),- secretPath: z.string().nullable().describe(DASHBOARD.MOVE_WARNINGS.syncSecretPath),- includeAllSubFolders: z.boolean().describe(DASHBOARD.MOVE_WARNINGS.includeAllSubFolders),- isAutoSyncEnabled: z.boolean().describe(DASHBOARD.MOVE_WARNINGS.isAutoSyncEnabled)- })- .array()- .describe(DASHBOARD.MOVE_WARNINGS.secretSyncs),- hasHiddenSecretSyncs: z.boolean().describe(DASHBOARD.MOVE_WARNINGS.hasHiddenSecretSyncs)- })- }- },- onRequest: verifyAuth([AuthMode.JWT, AuthMode.OAUTH]),- handler: async (req) => {- return server.services.secretSync.listSecretSyncsNewlyCoveringPath(req.query, req.permission);- }- });-server.route({method: "GET",url: "/folder/move-check/:folderId",diff --git a/backend/src/services/secret-sync/secret-sync-queue.ts b/backend/src/services/secret-sync/secret-sync-queue.tsindex d1234b5560..8b39ccc344 100644--- a/backend/src/services/secret-sync/secret-sync-queue.ts+++ b/backend/src/services/secret-sync/secret-sync-queue.ts@@ -44,7 +44,7 @@ import {import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";import { enterpriseSyncCheck, parseSyncErrorMessage, SecretSyncFns } from "@app/services/secret-sync/secret-sync-fns";import { SECRET_SYNC_DAILY_RETRY_DESTINATIONS, SECRET_SYNC_NAME_MAP } from "@app/services/secret-sync/secret-sync-maps";-import { buildSyncPayload, isPathCoveredBySecretSync } from "@app/services/secret-sync/secret-sync-recursive-fns";+import { buildSyncPayload, getAncestorPaths } from "@app/services/secret-sync/secret-sync-recursive-fns";import {SecretSyncAction,SecretSyncStatus,@@ -1052,8 +1052,27 @@ export const secretSyncQueueFactory = ({const environment = await projectEnvDAL.findOne({ projectId, slug: environmentSlug });if (!environment) return;- const secretSyncs = (await secretSyncDAL.find({ projectId, isAutoSyncEnabled: true })).filter((sync) =>- isPathCoveredBySecretSync(sync, { envId: environment.id, secretPath })+ const folder = await folderDAL.findBySecretPath(projectId, environmentSlug, secretPath);++ const ancestorFolders = (+ await folderDAL.findByManySecretPath(+ getAncestorPaths(secretPath).map((path) => ({ envId: environment.id, secretPath: path }))+ )+ ).filter((entry): entry is NonNullable<typeof entry> => Boolean(entry));++ const candidateSyncs = await secretSyncDAL.find({+ $in: { folderId: [...ancestorFolders.map((entry) => entry.id), ...(folder ? [folder.id] : [])] },+ isAutoSyncEnabled: true+ });++ // A sync on the path itself always matches, whether or not it includes subfolders. A sync on an+ // ancestor folder only matches when it includes them, so a sync rooted above this path that does+ // not is never triggered by a change it was never configured to cover.+ // The move and copy warnings in frontend/src/helpers/secretSyncCoverage.ts mirror this rule.+ const secretSyncs = candidateSyncs.filter(+ (sync) =>+ (folder && sync.folderId === folder.id) ||+ Boolean((sync.syncOptions as TSecretSync["syncOptions"])?.includeAllSubFolders));await secretSyncDAL.update(diff --git a/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts b/backend/src/services/secret-sync/secret-sync-recursive-fns.test.tsindex 7f5d4e3e06..6ef305a268 100644--- a/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts+++ b/backend/src/services/secret-sync/secret-sync-recursive-fns.test.ts@@ -1,10 +1,8 @@import {buildSyncPayload,+ getAncestorPaths,getSyncedFolders,- isPathCoveredBySecretSync,- isPathOrDescendantCoveredBySecretSync,- mergeImportedSecrets,- toSyncsNewlyCoveringPath+ mergeImportedSecrets} from "./secret-sync-recursive-fns";const deps = {@@ -45,160 +43,58 @@ describe("getSyncedFolders", () => {});});-describe("isPathCoveredBySecretSync", () => {- const sync = (path: string, includeAllSubFolders?: boolean, envId = "env-1") => ({- environment: { id: envId },- folder: { path },- syncOptions: includeAllSubFolders === undefined ? {} : { includeAllSubFolders }+describe("getAncestorPaths", () => {+ test("returns the root for a top-level path", () => {+ expect(getAncestorPaths("/")).toEqual([]);});- const covers = (entry: ReturnType<typeof sync>, secretPath: string, envId = "env-1") =>- isPathCoveredBySecretSync(entry, { envId, secretPath });-- test("covers its own path whether or not it includes subfolders", () => {- expect(covers(sync("/apps", false), "/apps")).toBe(true);- expect(covers(sync("/apps", true), "/apps")).toBe(true);- expect(covers(sync("/apps"), "/apps")).toBe(true);- });-- test("covers a descendant path only when it includes subfolders", () => {- expect(covers(sync("/apps", true), "/apps/payments/new")).toBe(true);- expect(covers(sync("/apps", false), "/apps/payments")).toBe(false);- expect(covers(sync("/apps"), "/apps/payments")).toBe(false);- });-- test("covers everything from the root when it includes subfolders", () => {- expect(covers(sync("/", true), "/apps/payments")).toBe(true);- expect(covers(sync("/", false), "/apps")).toBe(false);- expect(covers(sync("/", false), "/")).toBe(true);- });-- test("never covers an ancestor or a sibling sharing a name prefix", () => {- expect(covers(sync("/apps/payments", true), "/apps")).toBe(false);- expect(covers(sync("/apps", true), "/apps-legacy")).toBe(false);- });-- test("never covers a path in another environment", () => {- expect(covers(sync("/apps", true, "env-2"), "/apps")).toBe(false);- });-- test("never covers anything without a folder", () => {- expect(- isPathCoveredBySecretSync({ environment: { id: "env-1" }, folder: null }, { envId: "env-1", secretPath: "/" })- ).toBe(false);- });-- test("treats trailing and repeated slashes as the same path", () => {- expect(covers(sync("/apps"), "/apps/")).toBe(true);- expect(covers(sync("/apps/payments"), "/apps//payments")).toBe(true);- });-});--describe("isPathOrDescendantCoveredBySecretSync", () => {- const sync = (path: string, includeAllSubFolders = false, envId = "env-1") => ({- environment: { id: envId },- folder: { path },- syncOptions: { includeAllSubFolders }- });-- const covers = (entry: ReturnType<typeof sync>, secretPath: string, envId = "env-1") =>- isPathOrDescendantCoveredBySecretSync(entry, { envId, secretPath });-- test("covers whatever the path itself is covered by", () => {- expect(covers(sync("/apps"), "/apps")).toBe(true);- expect(covers(sync("/", true), "/apps")).toBe(true);+ test("returns every ancestor, closest last", () => {+ expect(getAncestorPaths("/backend/api/v2")).toEqual(["/", "/backend", "/backend/api"]);});- test("covers a sync rooted anywhere beneath the path, recursive or not", () => {- expect(covers(sync("/apps/payments"), "/apps")).toBe(true);- expect(covers(sync("/apps/payments/api", true), "/apps")).toBe(true);- expect(covers(sync("/apps"), "/")).toBe(true);+ test("never includes the path itself", () => {+ for (const path of ["/", "/backend", "/backend/api", "/backend/api/v2"]) {+ expect(getAncestorPaths(path)).not.toContain(path);+ }});- test("never covers a non-recursive ancestor, a sibling, or another environment", () => {- expect(covers(sync("/"), "/apps")).toBe(false);- expect(covers(sync("/apps-legacy/api"), "/apps")).toBe(false);- expect(covers(sync("/apps/payments", false, "env-2"), "/apps")).toBe(false);- });-});--describe("toSyncsNewlyCoveringPath", () => {- const sync = (id: string, overrides: Record<string, unknown> = {}) => ({- id,- name: id,- destination: "aws-parameter-store",- folder: { path: "/apps" },- syncOptions: { includeAllSubFolders: true },- isAutoSyncEnabled: true,- ...overrides+ test("returns one fewer entry than the path has segments", () => {+ expect(getAncestorPaths("/a")).toHaveLength(1);+ expect(getAncestorPaths("/a/b")).toHaveLength(2);+ expect(getAncestorPaths("/a/b/c")).toHaveLength(3);+ expect(getAncestorPaths("/a/b/c/d")).toHaveLength(4);});- const canReadAll = () => true;-- test("leaves out a sync that already covers the source", () => {- const result = toSyncsNewlyCoveringPath({- sourceSyncs: [sync("shared")],- destinationSyncs: [sync("shared"), sync("new")],- canRead: canReadAll- });-- expect(result.secretSyncs.map((entry) => entry.id)).toEqual(["new"]);+ test("treats a trailing slash as the same path", () => {+ expect(getAncestorPaths("/backend/api/")).toEqual(getAncestorPaths("/backend/api"));});- test("returns nothing when the destination is covered only by the source's syncs", () => {- expect(- toSyncsNewlyCoveringPath({ sourceSyncs: [sync("a")], destinationSyncs: [sync("a")], canRead: canReadAll })- ).toEqual({ secretSyncs: [], hasHiddenSecretSyncs: false });+ test("tolerates repeated separators", () => {+ expect(getAncestorPaths("/backend//api")).toEqual(getAncestorPaths("/backend/api"));});- test("orders syncs by name", () => {- const result = toSyncsNewlyCoveringPath({- sourceSyncs: [],- destinationSyncs: [sync("b", { name: "zeta" }), sync("a", { name: "alpha" })],- canRead: canReadAll- });-- expect(result.secretSyncs.map((entry) => entry.name)).toEqual(["alpha", "zeta"]);+ test("returns an empty list for inputs that name no folder", () => {+ // The queue passes whatever path the write carried. An empty result must mean+ // "no ancestors to consider", never a lookup for a folder that cannot exist.+ expect(getAncestorPaths("")).toEqual([]);+ expect(getAncestorPaths("//")).toEqual([]);});- test("returns the details of a sync the actor can read", () => {- const { secretSyncs } = toSyncsNewlyCoveringPath({- sourceSyncs: [],- destinationSyncs: [sync("a", { folder: { path: "/flat" }, syncOptions: {}, isAutoSyncEnabled: false })],- canRead: canReadAll- });-- expect(secretSyncs).toEqual([- {- id: "a",- name: "a",- destination: "aws-parameter-store",- secretPath: "/flat",- includeAllSubFolders: false,- isAutoSyncEnabled: false- }- ]);+ test("every returned path is absolute and free of a trailing slash", () => {+ for (const ancestor of getAncestorPaths("/a/b/c/d")) {+ expect(ancestor.startsWith("/")).toBe(true);+ if (ancestor !== "/") expect(ancestor.endsWith("/")).toBe(false);+ }});- test("reports syncs the actor cannot read only as a flag, however many there are", () => {- const result = toSyncsNewlyCoveringPath({- sourceSyncs: [],- destinationSyncs: [sync("visible"), sync("hidden-1"), sync("hidden-2")],- canRead: (entry) => entry.id === "visible"- });-- expect(result.secretSyncs.map((entry) => entry.id)).toEqual(["visible"]);- expect(result.hasHiddenSecretSyncs).toBe(true);+ test("returns the root exactly once, and only as the first entry", () => {+ const ancestors = getAncestorPaths("/a/b/c");+ expect(ancestors.filter((entry) => entry === "/")).toHaveLength(1);+ expect(ancestors[0]).toBe("/");});- test("does not flag a hidden sync that already covers the source", () => {- const result = toSyncsNewlyCoveringPath({- sourceSyncs: [sync("hidden")],- destinationSyncs: [sync("hidden")],- canRead: () => false- });-- expect(result.hasHiddenSecretSyncs).toBe(false);+ test("returns the root for a single-segment path", () => {+ expect(getAncestorPaths("/backend")).toEqual(["/"]);});});diff --git a/backend/src/services/secret-sync/secret-sync-recursive-fns.ts b/backend/src/services/secret-sync/secret-sync-recursive-fns.tsindex 00a7550a5c..7fe27f10e7 100644--- a/backend/src/services/secret-sync/secret-sync-recursive-fns.ts+++ b/backend/src/services/secret-sync/secret-sync-recursive-fns.ts@@ -6,7 +6,6 @@ import { TProjectFolderGrantDALFactory } from "@app/services/project-folder-granimport { TSecretFolderDALFactory } from "@app/services/secret-folder/secret-folder-dal";import { TSecretImportDALFactory } from "@app/services/secret-import/secret-import-dal";import { fnSecretsV2FromImports } from "@app/services/secret-import/secret-import-fns";-import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";import {createSecretSyncPayload,@@ -29,87 +28,10 @@ export type TFnSecretsV2FromImportsDeps = {kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;};-const toPathSegments = (path: string) => path.split("/").filter(Boolean);+export const getAncestorPaths = (path: string): string[] => {+ const segments = path.split("/").filter(Boolean);-// A sync on the path itself always covers it, whether or not it includes subfolders. A sync on an-// ancestor folder only covers it when it includes them. The path need not exist yet: a folder being-// moved has no folder at its landing path, and only the recursive syncs above it can cover it there.-export const isPathCoveredBySecretSync = (- sync: {- environment?: { id: string } | null;- folder?: { path: string } | null;- syncOptions?: unknown;- },- { envId, secretPath }: { envId: string; secretPath: string }-) => {- if (!sync.folder || sync.environment?.id !== envId) return false;-- const syncSegments = toPathSegments(sync.folder.path);- const pathSegments = toPathSegments(secretPath);-- if (syncSegments.length > pathSegments.length) return false;- if (syncSegments.some((segment, index) => segment !== pathSegments[index])) return false;-- return (- syncSegments.length === pathSegments.length ||- Boolean((sync.syncOptions as TSecretSync["syncOptions"])?.includeAllSubFolders)- );-};--// A move or copy can land items anywhere beneath its destination, so a sync rooted below the destination-// counts as well as one covering it. This can warn about a sync that nothing ends up under, which is-// safer for a warning than missing one.-export const isPathOrDescendantCoveredBySecretSync = (- sync: Parameters<typeof isPathCoveredBySecretSync>[0],- { envId, secretPath }: { envId: string; secretPath: string }-) => {- if (isPathCoveredBySecretSync(sync, { envId, secretPath })) return true;- if (!sync.folder || sync.environment?.id !== envId) return false;-- const syncSegments = toPathSegments(sync.folder.path);- const pathSegments = toPathSegments(secretPath);-- return pathSegments.every((segment, index) => syncSegments[index] === segment);-};--type TCoveringSync = {- id: string;- name: string;- destination: string;- folder?: { path: string } | null;- syncOptions?: unknown;- isAutoSyncEnabled: boolean;-};--// A sync that already covers the source is left out, since the items already reach it. Syncs the actor-// cannot read collapse into one flag, so the warning still reaches them without revealing how many-// there are or what they cover.-export const toSyncsNewlyCoveringPath = <T extends TCoveringSync>({- sourceSyncs,- destinationSyncs,- canRead-}: {- sourceSyncs: T[];- destinationSyncs: T[];- canRead: (sync: T) => boolean;-}) => {- const sourceSyncIds = new Set(sourceSyncs.map((sync) => sync.id));- const newSyncs = destinationSyncs.filter((sync) => !sourceSyncIds.has(sync.id));- const readableSyncs = newSyncs.filter(canRead);-- return {- secretSyncs: readableSyncs- .sort((a, b) => a.name.localeCompare(b.name))- .map((sync) => ({- id: sync.id,- name: sync.name,- destination: sync.destination as SecretSync,- secretPath: sync.folder?.path ?? null,- includeAllSubFolders: Boolean((sync.syncOptions as TSecretSync["syncOptions"])?.includeAllSubFolders),- isAutoSyncEnabled: sync.isAutoSyncEnabled- })),- hasHiddenSecretSyncs: readableSyncs.length < newSyncs.length- };+ return segments.map((_, index) => (index === 0 ? "/" : `/${segments.slice(0, index).join("/")}`));};export const getSyncedFolders = async ({diff --git a/backend/src/services/secret-sync/secret-sync-service.ts b/backend/src/services/secret-sync/secret-sync-service.tsindex f93b4d6438..95f8ae126e 100644--- a/backend/src/services/secret-sync/secret-sync-service.ts+++ b/backend/src/services/secret-sync/secret-sync-service.ts@@ -34,13 +34,7 @@ import {preSaveTransformDestinationConfig,preSaveTransformSyncOptions} from "@app/services/secret-sync/secret-sync-fns";-import {- buildSyncPayload,- getSyncedFolders,- isPathCoveredBySecretSync,- isPathOrDescendantCoveredBySecretSync,- toSyncsNewlyCoveringPath-} from "@app/services/secret-sync/secret-sync-recursive-fns";+import { buildSyncPayload, getSyncedFolders } from "@app/services/secret-sync/secret-sync-recursive-fns";import {SecretSyncStatus,TCheckDuplicateDestinationDTO,@@ -51,7 +45,6 @@ import {TFindSecretSyncByNameDTO,TListSecretSyncsByFolderId,TListSecretSyncsByProjectId,- TListSecretSyncsNewlyCoveringPathDTO,TSecretSync,TTriggerSecretSyncImportSecretsByIdDTO,TTriggerSecretSyncRemoveSecretsByIdDTO,@@ -438,53 +431,6 @@ export const secretSyncServiceFactory = ({) as TSecretSync[];};- // The syncs that would start sending items to their destination if they were moved or copied from the- // source path to the destination path. Any project member gets the warning, so it still reaches an actor- // who cannot read the syncs themselves.- const listSecretSyncsNewlyCoveringPath = async (- {- projectId,- sourceEnvironment,- sourceSecretPath,- destinationEnvironment,- destinationSecretPath- }: TListSecretSyncsNewlyCoveringPathDTO,- actor: OrgServiceActor- ) => {- const { permission } = await permissionService.getProjectPermission({- actor: actor.type,- actorId: actor.id,- actorAuthMethod: actor.authMethod,- actorOrgId: actor.orgId,- actionProjectType: ActionProjectType.SecretManager,- projectId- });-- const [sourceEnv, destinationEnv] = await Promise.all([- projectEnvDAL.findOne({ projectId, slug: sourceEnvironment }),- projectEnvDAL.findOne({ projectId, slug: destinationEnvironment })- ]);-- if (!sourceEnv) throw new NotFoundError({ message: `Could not find environment with slug "${sourceEnvironment}"` });- if (!destinationEnv)- throw new NotFoundError({ message: `Could not find environment with slug "${destinationEnvironment}"` });-- const projectSyncs = await secretSyncDAL.find({ projectId });-- const sourceSyncs = projectSyncs.filter((sync) =>- isPathCoveredBySecretSync(sync, { envId: sourceEnv.id, secretPath: sourceSecretPath })- );- const destinationSyncs = projectSyncs.filter((sync) =>- isPathOrDescendantCoveredBySecretSync(sync, { envId: destinationEnv.id, secretPath: destinationSecretPath })- );-- return toSyncsNewlyCoveringPath({- sourceSyncs,- destinationSyncs,- canRead: (sync) => permission.can(ProjectPermissionSecretSyncActions.Read, getSecretSyncSubject(sync))- });- };-const findSecretSyncById = async ({ destination, syncId }: TFindSecretSyncByIdDTO, actor: OrgServiceActor) => {const secretSync = await secretSyncDAL.findById(syncId);@@ -1291,7 +1237,6 @@ export const secretSyncServiceFactory = ({triggerSecretSyncImportSecretsById,triggerSecretSyncRemoveSecretsById,checkDuplicateDestination,- findRecursiveConflicts,- listSecretSyncsNewlyCoveringPath+ findRecursiveConflicts};};diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.tsindex e071337508..a878de7147 100644--- a/backend/src/services/secret-sync/secret-sync-types.ts+++ b/backend/src/services/secret-sync/secret-sync-types.ts@@ -506,14 +506,6 @@ export type TFindRecursiveSyncConflictsDTO = {keySchema?: string;};-export type TListSecretSyncsNewlyCoveringPathDTO = {- projectId: string;- sourceEnvironment: string;- sourceSecretPath: string;- destinationEnvironment: string;- destinationSecretPath: string;-};-export enum SecretSyncStatus {Pending = "pending",Running = "running",diff --git a/frontend/src/components/secret-syncs/SecretSyncMoveWarning.tsx b/frontend/src/components/secret-syncs/SecretSyncMoveWarning.tsxindex 7f03783c1f..baca4993d0 100644--- a/frontend/src/components/secret-syncs/SecretSyncMoveWarning.tsx+++ b/frontend/src/components/secret-syncs/SecretSyncMoveWarning.tsx@@ -1,23 +1,50 @@-import { useEffect, useState } from "react";+import { useEffect, useMemo, useState } from "react";import { Link } from "@tanstack/react-router";import { ExternalLinkIcon, TriangleAlertIcon } from "lucide-react";import { Alert, AlertDescription, AlertTitle, Checkbox, Label } from "@app/components/v3";import { ROUTE_PATHS } from "@app/const/routes";-import { useOrganization } from "@app/context";+import { ProjectPermissionSub, useOrganization, useProjectPermission } from "@app/context";+import { ProjectPermissionSecretSyncActions } from "@app/context/ProjectPermissionContext/types";+import {+ getSecretSyncsNewlyCoveringPaths,+ TMoveWarningsCheck+} from "@app/helpers/secretSyncCoverage";import { SECRET_SYNC_MAP } from "@app/helpers/secretSyncs";-import { useGetMoveWarnings } from "@app/hooks/api/dashboard/queries";-import { TMoveWarningsCheck } from "@app/hooks/api/dashboard/types";+import { useListSecretSyncs } from "@app/hooks/api/secretSyncs";// the acknowledgement is tied to the checks and the warning it was given for, and cleared whenever// either changes, so a yes never carries over to a destination or a set of syncs the user has not seen.-export const useSecretSyncMoveWarning = (checks: TMoveWarningsCheck[]) => {- const warnings = useGetMoveWarnings(checks);+// like the synced indicator on the dashboard, syncs the user cannot read are left out entirely.+export const useSecretSyncMoveWarning = (projectId: string, checks: TMoveWarningsCheck[]) => {+ const { permission } = useProjectPermission();+ const canReadSecretSyncs = permission.can(+ ProjectPermissionSecretSyncActions.Read,+ ProjectPermissionSub.SecretSyncs+ );+ const isEnabled = canReadSecretSyncs && checks.length > 0;++ // never served from cache, so a sync created since the list was last loaded is not missed+ const {+ data: projectSyncs,+ isLoading,+ isError+ } = useListSecretSyncs(projectId, {+ enabled: isEnabled,+ staleTime: 0+ });++ const secretSyncs = useMemo(+ () => (isEnabled && projectSyncs ? getSecretSyncsNewlyCoveringPaths(projectSyncs, checks) : []),+ [isEnabled, projectSyncs, checks]+ );+ const isChecking = isEnabled && isLoading;+ const hasError = isEnabled && isError;+const warningKey = JSON.stringify({checks,- syncIds: warnings.secretSyncs.map(({ id }) => id),- hasHiddenSecretSyncs: warnings.hasHiddenSecretSyncs,- hasError: warnings.hasError+ syncIds: secretSyncs.map(({ id }) => id),+ hasError});const [acknowledgedWarningKey, setAcknowledgedWarningKey] = useState<string | null>(null);@@ -26,15 +53,16 @@ export const useSecretSyncMoveWarning = (checks: TMoveWarningsCheck[]) => {}, [warningKey]);const isAcknowledged = acknowledgedWarningKey === warningKey;- const needsAcknowledgement =- warnings.hasError || warnings.hasHiddenSecretSyncs || warnings.secretSyncs.length > 0;+ const needsAcknowledgement = hasError || secretSyncs.length > 0;return {- ...warnings,+ secretSyncs,+ isChecking,+ hasError,needsAcknowledgement,isAcknowledged,setIsAcknowledged: (value: boolean) => setAcknowledgedWarningKey(value ? warningKey : null),- isBlockingSubmit: warnings.isChecking || (needsAcknowledgement && !isAcknowledged)+ isBlockingSubmit: isChecking || (needsAcknowledgement && !isAcknowledged)};};@@ -47,23 +75,20 @@ type Props = {const getTitle = ({subject,- visibleCount,- hasHidden,+ count,hasError}: {subject: string;- visibleCount: number;- hasHidden: boolean;+ count: number;hasError: boolean;}) => {if (hasError) return "Could not check the destination for secret syncs";- if (hasHidden) return `${subject} here will be synced to external destinations`;- return `${subject} here will be synced to ${visibleCount} external destination${visibleCount === 1 ? "" : "s"}`;+ return `${subject} here will be synced to ${count} external destination${count === 1 ? "" : "s"}`;};export const SecretSyncMoveWarning = ({ warning, projectId, noun, verb }: Props) => {const { currentOrg } = useOrganization();- const { needsAcknowledgement, isChecking, hasError, hasHiddenSecretSyncs, secretSyncs } = warning;+ const { needsAcknowledgement, isChecking, hasError, secretSyncs } = warning;if (isChecking || !needsAcknowledgement) return null;@@ -73,8 +98,7 @@ export const SecretSyncMoveWarning = ({ warning, projectId, noun, verb }: Props)<AlertTitle>{getTitle({subject: `${noun.charAt(0).toUpperCase()}${noun.slice(1)} ${verb}`,- visibleCount: secretSyncs.length,- hasHidden: hasHiddenSecretSyncs,+ count: secretSyncs.length,hasError})}</AlertTitle>@@ -86,8 +110,8 @@ export const SecretSyncMoveWarning = ({ warning, projectId, noun, verb }: Props)<li key={sync.id}><span className="font-medium text-foreground">{sync.name}</span>{` (${SECRET_SYNC_MAP[sync.destination].name}) syncs `}- <code>{sync.secretPath ?? "/"}</code>- {sync.includeAllSubFolders ? " and all its subfolders." : "."}+ <code>{sync.folder?.path ?? "/"}</code>+ {sync.syncOptions.includeAllSubFolders ? " and all its subfolders." : "."}{!sync.isAutoSyncEnabled &&" Auto-sync is off, so it sends them on its next manual sync."}{" "}<Link@@ -109,13 +133,6 @@ export const SecretSyncMoveWarning = ({ warning, projectId, noun, verb }: Props)))}</ul>)}- {hasHiddenSecretSyncs && (- <p>- {secretSyncs.length- ? "Other secret syncs you don't have access to also cover the destination."- : "Secret syncs you don't have access to cover the destination."}- </p>- )}<div className="mt-2 flex items-center gap-2"><Checkboxid="secret-sync-move-warning-acknowledgement"diff --git a/frontend/src/helpers/secretSyncCoverage.test.ts b/frontend/src/helpers/secretSyncCoverage.test.tsnew file mode 100644index 0000000000..ed8cb7e51a--- /dev/null+++ b/frontend/src/helpers/secretSyncCoverage.test.ts@@ -0,0 +1,134 @@+import { describe, expect, test } from "vitest";++import {+ getSecretSyncsNewlyCoveringPaths,+ isPathCoveredBySecretSync,+ isPathOrDescendantCoveredBySecretSync+} from "./secretSyncCoverage";++describe("isPathCoveredBySecretSync", () => {+ const sync = (path: string, includeAllSubFolders?: boolean, environment = "dev") => ({+ environment: { slug: environment },+ folder: { path },+ syncOptions: includeAllSubFolders === undefined ? {} : { includeAllSubFolders }+ });++ const covers = (entry: ReturnType<typeof sync>, secretPath: string, environment = "dev") =>+ isPathCoveredBySecretSync(entry, { environment, secretPath });++ test("covers its own path whether or not it includes subfolders", () => {+ expect(covers(sync("/apps", false), "/apps")).toBe(true);+ expect(covers(sync("/apps", true), "/apps")).toBe(true);+ expect(covers(sync("/apps"), "/apps")).toBe(true);+ });++ test("covers a descendant path only when it includes subfolders", () => {+ expect(covers(sync("/apps", true), "/apps/payments/new")).toBe(true);+ expect(covers(sync("/apps", false), "/apps/payments")).toBe(false);+ expect(covers(sync("/apps"), "/apps/payments")).toBe(false);+ });++ test("covers everything from the root when it includes subfolders", () => {+ expect(covers(sync("/", true), "/apps/payments")).toBe(true);+ expect(covers(sync("/", false), "/apps")).toBe(false);+ expect(covers(sync("/", false), "/")).toBe(true);+ });++ test("never covers an ancestor or a sibling sharing a name prefix", () => {+ expect(covers(sync("/apps/payments", true), "/apps")).toBe(false);+ expect(covers(sync("/apps", true), "/apps-legacy")).toBe(false);+ });++ test("never covers a path in another environment", () => {+ expect(covers(sync("/apps", true, "prod"), "/apps")).toBe(false);+ });++ test("never covers anything without a folder", () => {+ expect(+ isPathCoveredBySecretSync(+ { environment: { slug: "dev" }, folder: null },+ { environment: "dev", secretPath: "/" }+ )+ ).toBe(false);+ });++ test("treats trailing and repeated slashes as the same path", () => {+ expect(covers(sync("/apps"), "/apps/")).toBe(true);+ expect(covers(sync("/apps/payments"), "/apps//payments")).toBe(true);+ });+});++describe("isPathOrDescendantCoveredBySecretSync", () => {+ const sync = (path: string, includeAllSubFolders = false, environment = "dev") => ({+ environment: { slug: environment },+ folder: { path },+ syncOptions: { includeAllSubFolders }+ });++ const covers = (entry: ReturnType<typeof sync>, secretPath: string, environment = "dev") =>+ isPathOrDescendantCoveredBySecretSync(entry, { environment, secretPath });++ test("covers whatever the path itself is covered by", () => {+ expect(covers(sync("/apps"), "/apps")).toBe(true);+ expect(covers(sync("/", true), "/apps")).toBe(true);+ });++ test("covers a sync rooted anywhere beneath the path, recursive or not", () => {+ expect(covers(sync("/apps/payments"), "/apps")).toBe(true);+ expect(covers(sync("/apps/payments/api", true), "/apps")).toBe(true);+ expect(covers(sync("/apps"), "/")).toBe(true);+ });++ test("never covers a non-recursive ancestor, a sibling, or another environment", () => {+ expect(covers(sync("/"), "/apps")).toBe(false);+ expect(covers(sync("/apps-legacy/api"), "/apps")).toBe(false);+ expect(covers(sync("/apps/payments", false, "prod"), "/apps")).toBe(false);+ });+});++describe("getSecretSyncsNewlyCoveringPaths", () => {+ const sync = (id: string, overrides: Record<string, unknown> = {}) => ({+ id,+ name: id,+ environment: { slug: "dev" },+ folder: { path: "/apps" },+ syncOptions: { includeAllSubFolders: true },+ ...overrides+ });++ const check = (sourceSecretPath: string, destinationSecretPath: string, environment = "dev") => ({+ sourceEnvironment: environment,+ sourceSecretPath,+ destinationEnvironment: environment,+ destinationSecretPath+ });++ const ids = (syncs: { id: string }[]) => syncs.map(({ id }) => id);++ test("leaves out a sync that already covers the source", () => {+ const syncs = [sync("shared", { folder: { path: "/" } }), sync("new")];++ expect(ids(getSecretSyncsNewlyCoveringPaths(syncs, [check("/other", "/apps")]))).toEqual([+ "new"+ ]);+ });++ test("returns nothing when no check lands under a sync", () => {+ expect(getSecretSyncsNewlyCoveringPaths([sync("a")], [check("/", "/other")])).toEqual([]);+ expect(getSecretSyncsNewlyCoveringPaths([sync("a")], [])).toEqual([]);+ });++ test("returns a sync once even when several checks land under it", () => {+ const checks = [check("/x", "/apps"), { ...check("/y", "/apps"), sourceEnvironment: "prod" }];++ expect(ids(getSecretSyncsNewlyCoveringPaths([sync("a")], checks))).toEqual(["a"]);+ });++ test("orders syncs by name", () => {+ const syncs = [sync("b", { name: "zeta" }), sync("a", { name: "alpha" })];++ expect(+ getSecretSyncsNewlyCoveringPaths(syncs, [check("/other", "/apps")]).map(({ name }) => name)+ ).toEqual(["alpha", "zeta"]);+ });+});diff --git a/frontend/src/helpers/secretSyncCoverage.ts b/frontend/src/helpers/secretSyncCoverage.tsnew file mode 100644index 0000000000..1a0614c175--- /dev/null+++ b/frontend/src/helpers/secretSyncCoverage.ts@@ -0,0 +1,79 @@+// These rules mirror how the backend picks which syncs a secret change triggers (see+// queueSecretSyncsSyncSecretsByPath in backend/src/services/secret-sync/secret-sync-queue.ts).+// Change both together, or this warning stops matching what actually syncs.++type TCoverageSync = {+ environment?: { slug: string } | null;+ folder?: { path: string } | null;+ syncOptions?: { includeAllSubFolders?: boolean } | null;+};++export type TMoveWarningsCheck = {+ sourceEnvironment: string;+ sourceSecretPath: string;+ destinationEnvironment: string;+ destinationSecretPath: string;+};++const toPathSegments = (path: string) => path.split("/").filter(Boolean);++// A sync on the path itself always covers it, whether or not it includes subfolders. A sync on an+// ancestor folder only covers it when it includes them. The path need not exist yet: a folder being+// moved has no folder at its landing path, and only the recursive syncs above it can cover it there.+export const isPathCoveredBySecretSync = (+ sync: TCoverageSync,+ { environment, secretPath }: { environment: string; secretPath: string }+) => {+ if (!sync.folder || sync.environment?.slug !== environment) return false;++ const syncSegments = toPathSegments(sync.folder.path);+ const pathSegments = toPathSegments(secretPath);++ if (syncSegments.length > pathSegments.length) return false;+ if (syncSegments.some((segment, index) => segment !== pathSegments[index])) return false;++ return (+ syncSegments.length === pathSegments.length || Boolean(sync.syncOptions?.includeAllSubFolders)+ );+};++// A move or copy can land items anywhere beneath its destination, so a sync rooted below the destination+// counts as well as one covering it. This can warn about a sync that nothing ends up under, which is+// safer for a warning than missing one.+export const isPathOrDescendantCoveredBySecretSync = (+ sync: TCoverageSync,+ { environment, secretPath }: { environment: string; secretPath: string }+) => {+ if (isPathCoveredBySecretSync(sync, { environment, secretPath })) return true;+ if (!sync.folder || sync.environment?.slug !== environment) return false;++ const syncSegments = toPathSegments(sync.folder.path);+ const pathSegments = toPathSegments(secretPath);++ return pathSegments.every((segment, index) => syncSegments[index] === segment);+};++// The syncs that would start sending items to their destination if they were moved or copied as the checks+// describe. A sync that already covers a check's source is left out for that check, since the items+// already reach it.+export const getSecretSyncsNewlyCoveringPaths = <+ T extends TCoverageSync & { id: string; name: string }+>(+ syncs: T[],+ checks: TMoveWarningsCheck[]+) =>+ syncs+ .filter((sync) =>+ checks.some(+ (check) =>+ isPathOrDescendantCoveredBySecretSync(sync, {+ environment: check.destinationEnvironment,+ secretPath: check.destinationSecretPath+ }) &&+ !isPathCoveredBySecretSync(sync, {+ environment: check.sourceEnvironment,+ secretPath: check.sourceSecretPath+ })+ )+ )+ .sort((a, b) => a.name.localeCompare(b.name));diff --git a/frontend/src/hooks/api/dashboard/queries.tsx b/frontend/src/hooks/api/dashboard/queries.tsxindex fc735c02e8..4b896c03da 100644--- a/frontend/src/hooks/api/dashboard/queries.tsx+++ b/frontend/src/hooks/api/dashboard/queries.tsx@@ -23,9 +23,6 @@ import {TGetDashboardProjectSecretsQuickSearchDTO,TGetSecretMetadataDTO,TGetSecretValueDTO,- TMoveWarningsCheck,- TMoveWarningSecretSync,- TMoveWarningsResponse,TSearchSecretsByMetadataDTO,TSearchSecretsByMetadataResponse,TSecretMetadataPage@@ -117,9 +114,7 @@ export const dashboardKeys = {folderId,destinationEnvironment,destinationPath- ] as const,- getMoveWarnings: (check: TMoveWarningsCheck) =>- [...dashboardKeys.all(), "move-warnings", check] as const+ ] as const};export const fetchSecretMetadata = async (params: TGetSecretMetadataDTO, signal?: AbortSignal) => {@@ -778,36 +773,3 @@ export const useGetFoldersMoveDestinationEligibility = (checks: TFolderMoveDestireturn { isChecking, isDestinationBlocked, blockedDestinations, hasError };}});--// one check per environment pair, since a sync covers one path in one environment. the result is never-// served from cache, so a sync created since the last check is not missed when the dialog reopens.-export const useGetMoveWarnings = (checks: TMoveWarningsCheck[]) =>- useQueries({- queries: checks.map((check) => ({- queryKey: dashboardKeys.getMoveWarnings(check),- queryFn: async () => {- const { data } = await apiRequest.get<TMoveWarningsResponse>(- "/api/v1/dashboard/move-warnings",- { params: check }- );- return data;- },- enabled: Boolean(check.projectId && check.sourceEnvironment && check.destinationEnvironment),- staleTime: 0,- gcTime: 0- })),- combine: (results) => {- const secretSyncs = new Map<string, TMoveWarningSecretSync>();-- results.forEach(({ data }) =>- data?.secretSyncs.forEach((sync) => secretSyncs.set(sync.id, sync))- );-- return {- isChecking: results.some((result) => result.isLoading),- hasError: results.some((result) => result.isError),- secretSyncs: [...secretSyncs.values()],- hasHiddenSecretSyncs: results.some(({ data }) => data?.hasHiddenSecretSyncs)- };- }- });diff --git a/frontend/src/hooks/api/dashboard/types.ts b/frontend/src/hooks/api/dashboard/types.tsindex e757eca0c0..90b7dd64f2 100644--- a/frontend/src/hooks/api/dashboard/types.ts+++ b/frontend/src/hooks/api/dashboard/types.ts@@ -7,7 +7,6 @@ import { TSecretFolder } from "@app/hooks/api/secretFolders/types";import { TSecretImport } from "@app/hooks/api/secretImports/types";import { TSecretRotationV2 } from "@app/hooks/api/secretRotationsV2";import { SecretV3Raw, SecretV3RawSanitized } from "@app/hooks/api/secrets/types";-import { SecretSync } from "@app/hooks/api/secretSyncs/enums";export type DashboardProjectSecretsOverviewResponse = {folders?: (TSecretFolder & { environment: string })[];@@ -286,28 +285,6 @@ export type FolderMoveEligibilityResponse = {hasRbacPolicies?: boolean;};-export type TMoveWarningsCheck = {- projectId: string;- sourceEnvironment: string;- sourceSecretPath: string;- destinationEnvironment: string;- destinationSecretPath: string;-};--export type TMoveWarningSecretSync = {- id: string;- name: string;- destination: SecretSync;- secretPath: string | null;- includeAllSubFolders: boolean;- isAutoSyncEnabled: boolean;-};--export type TMoveWarningsResponse = {- secretSyncs: TMoveWarningSecretSync[];- hasHiddenSecretSyncs: boolean;-};-export type TFolderMoveDestinationCheck = {folderId: string;folderName: string;diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/CopySecretsSheet/CopySecretsSheet.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/CopySecretsSheet/CopySecretsSheet.tsxindex 6ff82b983e..5e119422e8 100644--- a/frontend/src/pages/secret-manager/OverviewPage/components/CopySecretsSheet/CopySecretsSheet.tsx+++ b/frontend/src/pages/secret-manager/OverviewPage/components/CopySecretsSheet/CopySecretsSheet.tsx@@ -198,6 +198,7 @@ const CopySecretsSession = ({includeValues});const secretSyncWarning = useSecretSyncMoveWarning(+ projectId,sourceEnvironmentSlug &&destinationEnvironmentSlug &&isSourcePathSettled &&@@ -205,7 +206,6 @@ const CopySecretsSession = ({(requestGroups.length || selectedFolderPaths.length)? [{- projectId,sourceEnvironment: sourceEnvironmentSlug,sourceSecretPath: normalizedSourcePath,destinationEnvironment: destinationEnvironmentSlug,diff --git a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsxindex b1b294a9d9..d47413d758 100644--- a/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx+++ b/frontend/src/pages/secret-manager/OverviewPage/components/SelectionPanel/components/MoveSecretsDialog/MoveSecretsDialog.tsx@@ -56,6 +56,7 @@ import {ProjectPermissionSecretActions,ProjectPermissionSecretRotationActions} from "@app/context/ProjectPermissionContext/types";+import { TMoveWarningsCheck } from "@app/helpers/secretSyncCoverage";import { removeTrailingSlash } from "@app/helpers/string";import { useMoveSecrets } from "@app/hooks/api";import {@@ -66,8 +67,7 @@ import {} from "@app/hooks/api/dashboard/queries";import {FolderMoveBlockingType,- TFolderMoveDestinationCheck,- TMoveWarningsCheck+ TFolderMoveDestinationCheck} from "@app/hooks/api/dashboard/types";import { ProjectEnv } from "@app/hooks/api/projects/types";import {@@ -545,16 +545,14 @@ const buildDestinationTargets = ({return { checks: isSelfMove ? [] : checks, isSelfMove };};-// one check per environment pair that has something to move. the backend counts syncs beneath the-// destination too, so a moved folder needs no check of its own.+// one check per environment pair that has something to move. syncs beneath the destination count too,+// so a moved folder needs no check of its own.const buildMoveWarningChecks = ({- projectId,sourceSecretPath,destinationPath,secretEnvironments,movedFolders}: {- projectId: string;sourceSecretPath: string;destinationPath?: string;secretEnvironments: { sourceEnv: string; destinationEnvironment: string }[];@@ -570,7 +568,6 @@ const buildMoveWarningChecks = ({);return [...environmentPairs.values()].map(({ sourceEnv, destinationEnvironment }) => ({- projectId,sourceEnvironment: sourceEnv,sourceSecretPath: removeTrailingSlash(sourceSecretPath),destinationEnvironment,@@ -923,7 +920,6 @@ const SingleEnvContent = ({const moveWarningChecks = useMemo(() =>buildMoveWarningChecks({- projectId,sourceSecretPath,destinationPath: destinationSelected && !isSelfMove ? selectedPath?.secretPath : undefined,secretEnvironments: hasSecretsToMove@@ -932,7 +928,6 @@ const SingleEnvContent = ({movedFolders}),[- projectId,sourceSecretPath,destinationSelected,isSelfMove,@@ -943,7 +938,7 @@ const SingleEnvContent = ({movedFolders]);- const secretSyncWarning = useSecretSyncMoveWarning(moveWarningChecks);+ const secretSyncWarning = useSecretSyncMoveWarning(projectId, moveWarningChecks);const handleFormSubmit = async (data: TSingleEnvFormSchema) => {if (!selectedPath) {@@ -1338,7 +1333,6 @@ const MultiEnvContent = ({const moveWarningChecks = useMemo(() =>buildMoveWarningChecks({- projectId,sourceSecretPath,destinationPath: destinationSelected && !isSelfMove ? selectedPath?.secretPath : undefined,secretEnvironments: environments@@ -1353,7 +1347,6 @@ const MultiEnvContent = ({movedFolders}),[- projectId,sourceSecretPath,destinationSelected,isSelfMove,@@ -1365,7 +1358,7 @@ const MultiEnvContent = ({movedFolders]);- const secretSyncWarning = useSecretSyncMoveWarning(moveWarningChecks);+ const secretSyncWarning = useSecretSyncMoveWarning(projectId, moveWarningChecks);const environmentsToBeSkipped = useMemo(() => {if (!destinationSelected) return [];