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
requested changes
Daniel3bc22e13f4df
diff --git a/backend/src/server/routes/v3/external-migration-router.ts b/backend/src/server/routes/v3/external-migration-router.tsindex 3784a6bfac..5240e57090 100644--- a/backend/src/server/routes/v3/external-migration-router.ts+++ b/backend/src/server/routes/v3/external-migration-router.ts@@ -742,7 +742,8 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProviderid: z.string(),slug: z.string(),name: z.string(),- project: z.string()+ project: z.string(),+ parentId: z.string().nullish()}).array()})@@ -759,6 +760,41 @@ export const registerExternalMigrationRouter = async (server: FastifyZodProvider}});+ server.route({+ method: "GET",+ url: "/doppler/doppler-configs",+ config: { rateLimit: readLimit },+ schema: {+ operationId: "getDopplerConfigsV3",+ querystring: z.object({+ configId: z.string().uuid(),+ projectSlug: z.string().min(1)+ }),+ response: {+ 200: z.object({+ configs: z+ .object({+ name: z.string(),+ root: z.boolean(),+ locked: z.boolean(),+ environment: z.string(),+ project: z.string()+ })+ .array()+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const configs = await server.services.migration.getDopplerConfigs({+ configId: req.query.configId,+ projectSlug: req.query.projectSlug,+ actor: req.permission+ });+ return { configs };+ }+ });+server.route({method: "POST",url: "/doppler/import-secrets",diff --git a/backend/src/services/app-connection/doppler/doppler-connection-fns.ts b/backend/src/services/app-connection/doppler/doppler-connection-fns.tsindex 3fae455534..4316f0b4d7 100644--- a/backend/src/services/app-connection/doppler/doppler-connection-fns.ts+++ b/backend/src/services/app-connection/doppler/doppler-connection-fns.ts@@ -6,6 +6,7 @@ import { BadRequestError } from "@app/lib/errors";import { AppConnection } from "../app-connection-enums";import { DopplerConnectionMethod } from "./doppler-connection-enums";import {+ TDopplerConfig,TDopplerConnection,TDopplerConnectionConfig,TDopplerEnvironment,@@ -110,6 +111,39 @@ export const listDopplerEnvironments = async (return environments;};+export const listDopplerConfigs = async (+ appConnection: TDopplerConnection,+ projectSlug: string+): Promise<TDopplerConfig[]> => {+ const {+ credentials: { apiToken }+ } = appConnection;++ const configs: TDopplerConfig[] = [];+ let page = 1;+ const perPage = 50;+ const maxPages = 20;+ let hasMore = true;++ while (hasMore && page <= maxPages) {+ // eslint-disable-next-line no-await-in-loop+ const res = await request.get<{ configs: TDopplerConfig[] }>(`${DOPPLER_API_URL}/v3/configs`, {+ params: { project: projectSlug, page, per_page: perPage },+ headers: { Authorization: `Bearer ${apiToken}` }+ });++ configs.push(...res.data.configs);++ if (res.data.configs.length < perPage) {+ hasMore = false;+ } else {+ page += 1;+ }+ }++ return configs;+};+export const getDopplerSecrets = async (appConnection: TDopplerConnection,projectSlug: string,diff --git a/backend/src/services/app-connection/doppler/doppler-connection-service.ts b/backend/src/services/app-connection/doppler/doppler-connection-service.tsindex 17837c5432..98c55a4935 100644--- a/backend/src/services/app-connection/doppler/doppler-connection-service.ts+++ b/backend/src/services/app-connection/doppler/doppler-connection-service.ts@@ -2,7 +2,12 @@ import { logger } from "@app/lib/logger";import { OrgServiceActor } from "@app/lib/types";import { AppConnection } from "../app-connection-enums";-import { getDopplerSecrets, listDopplerEnvironments, listDopplerProjects } from "./doppler-connection-fns";+import {+ getDopplerSecrets,+ listDopplerConfigs,+ listDopplerEnvironments,+ listDopplerProjects+} from "./doppler-connection-fns";import { TDopplerConnection } from "./doppler-connection-types";type TGetAppConnectionFunc = (@@ -32,6 +37,16 @@ export const dopplerConnectionService = (getAppConnection: TGetAppConnectionFunc}};+ const listConfigs = async (connectionId: string, projectSlug: string, actor: OrgServiceActor) => {+ const appConnection = await getAppConnection(AppConnection.Doppler, connectionId, actor);+ try {+ return await listDopplerConfigs(appConnection, projectSlug);+ } catch (error) {+ logger.error(error, "Failed to list configs for Doppler connection");+ return [];+ }+ };+const getSecrets = async (connectionId: string,projectSlug: string,@@ -42,5 +57,5 @@ export const dopplerConnectionService = (getAppConnection: TGetAppConnectionFuncreturn getDopplerSecrets(appConnection, projectSlug, environmentSlug);};- return { listProjects, listEnvironments, getSecrets };+ return { listProjects, listEnvironments, listConfigs, getSecrets };};diff --git a/backend/src/services/app-connection/doppler/doppler-connection-types.ts b/backend/src/services/app-connection/doppler/doppler-connection-types.tsindex 85b42675a8..e405d877d3 100644--- a/backend/src/services/app-connection/doppler/doppler-connection-types.ts+++ b/backend/src/services/app-connection/doppler/doppler-connection-types.ts@@ -37,6 +37,14 @@ export type TDopplerEnvironment = {createdAt: string;};+export type TDopplerConfig = {+ name: string;+ root: boolean;+ locked: boolean;+ environment: string;+ project: string;+};+export type TDopplerSecret = {raw: string | null;computed: string | null;diff --git a/backend/src/services/external-migration/external-migration-fns/doppler.ts b/backend/src/services/external-migration/external-migration-fns/doppler.tsindex 344fe69a67..4df2387879 100644--- a/backend/src/services/external-migration/external-migration-fns/doppler.ts+++ b/backend/src/services/external-migration/external-migration-fns/doppler.ts@@ -2,6 +2,7 @@// The actual implementation lives in the Doppler AppConnection package.export {getDopplerSecrets,+ listDopplerConfigs,listDopplerEnvironments,listDopplerProjects} from "@app/services/app-connection/doppler/doppler-connection-fns";diff --git a/backend/src/services/external-migration/external-migration-service.ts b/backend/src/services/external-migration/external-migration-service.tsindex 59b0997501..993fd035b9 100644--- a/backend/src/services/external-migration/external-migration-service.ts+++ b/backend/src/services/external-migration/external-migration-service.ts@@ -45,6 +45,7 @@ import {decryptEnvKeyDataFn,getDopplerSecrets,importVaultDataFn,+ listDopplerConfigs,listDopplerEnvironments,listDopplerProjects,parseEnvKeyDataFn,@@ -820,6 +821,19 @@ export const externalMigrationServiceFactory = ({return listDopplerEnvironments(appConnection, projectSlug);};+ const getDopplerConfigs = async ({+ configId,+ projectSlug,+ actor+ }: {+ configId: string;+ projectSlug: string;+ actor: OrgServiceActor;+ }) => {+ const appConnection = await getDopplerConnectionForConfig(configId, actor);+ return listDopplerConfigs(appConnection, projectSlug);+ };+const importDopplerSecrets = async ({configId,dopplerProject,@@ -903,6 +917,7 @@ export const externalMigrationServiceFactory = ({getDopplerProjects,getDopplerEnvironments,+ getDopplerConfigs,importDopplerSecrets};};diff --git a/docs/documentation/platform/external-migrations/doppler.mdx b/docs/documentation/platform/external-migrations/doppler.mdxindex cea2e75689..4f8f3b3e6d 100644--- a/docs/documentation/platform/external-migrations/doppler.mdx+++ b/docs/documentation/platform/external-migrations/doppler.mdx@@ -8,12 +8,12 @@ This guide helps you bring secrets from **Doppler** into Infisical. Register a D**What you can migrate:**-- **Secrets** — Key/value pairs from a Doppler **project** and **environment** are imported into a chosen Infisical **project**, **environment**, and **secret path** (folder).+- **Secrets** — Key/value pairs from a Doppler **project** and **config** (root or branch) are imported into a chosen Infisical **project**, **environment**, and **secret path** (folder). Both root configs and branched configs are supported.<Warning>- **Organization Admin Access Required:** Creating and managing Doppler migration+ Organization Admin Access Required: Creating and managing Doppler migrationconfigurations, listing Doppler projects and environments, and running- in-platform imports are limited to **organization administrators**, matching+ in-platform imports are limited to organization administrators, matchingthe Vault in-platform migration model.</Warning>@@ -54,29 +54,7 @@ This guide helps you bring secrets from **Doppler** into Infisical. Register a D</Step></Steps>-## Import Secrets--You can import in two places: **External Migrations** (pick any Infisical project and path) or the **Secret overview** for a single environment (current project, path, and environment).--<Tip>- **Migration strategy:** Start with a non-production Infisical environment, verify key names and values, then expand to other environments.-</Tip>--### Import from Organization Settings--1. Open **Organization Settings > External Migrations** and find your Doppler row.-2. Click **Import**.-3. Choose the **Doppler project** and **Doppler environment** to read from.-4. Choose the **Infisical project**, **environment**, and **secret path** where secrets should be created.-5. Confirm the import.----<Warning>- The import will fail if any secret key from Doppler already exists at the target path. Make sure the destination is empty or use a new secret path to avoid conflicts.-</Warning>--### Import from the Secret Overview+## Migrating Secrets from Doppler to InfisicalWhen you are already in a **Secret Manager** project and have **one** environment selected (not “all environments”):@@ -86,7 +64,7 @@ When you are already in a **Secret Manager** project and have **one** environmen-4. Select the **Doppler project** and **environment**; Infisical uses your linked migration configuration and imports into the **current** environment and path.+4. Select the **Doppler project** and **config**; Infisical lists all configs including root configs and branch configs. Root configs are labeled with **(root)** for clarity. Infisical uses your linked migration configuration and imports into the **current** environment and path.diff --git a/docs/images/platform/external-migrations/doppler-in-platform/doppler-import-modal-org-settings.png b/docs/images/platform/external-migrations/doppler-in-platform/doppler-import-modal-org-settings.pngdeleted file mode 100644index dfe0c47133..0000000000Binary files a/docs/images/platform/external-migrations/doppler-in-platform/doppler-import-modal-org-settings.png and /dev/null differdiff --git a/frontend/src/hooks/api/migration/queries.tsx b/frontend/src/hooks/api/migration/queries.tsxindex 2ae0f83ef0..a2007f17a3 100644--- a/frontend/src/hooks/api/migration/queries.tsx+++ b/frontend/src/hooks/api/migration/queries.tsx@@ -4,6 +4,7 @@ import { apiRequest } from "@app/config/request";import {ExternalMigrationProviders,+ TDopplerConfig,TDopplerEnvironment,TDopplerProject,TExternalMigrationConfig,@@ -57,6 +58,11 @@ export const externalMigrationQueryKeys = {"doppler-environments",configId,projectSlug+ ],+ dopplerConfigs: (configId?: string, projectSlug?: string) => [+ "doppler-configs",+ configId,+ projectSlug]};@@ -307,3 +313,19 @@ export const useGetDopplerEnvironments = (configId?: string, projectSlug?: strinenabled: !!configId && !!projectSlug});};++export const useGetDopplerConfigs = (configId?: string, projectSlug?: string) => {+ return useQuery({+ queryKey: externalMigrationQueryKeys.dopplerConfigs(configId, projectSlug),+ queryFn: async () => {+ const { data } = await apiRequest.get<{ configs: TDopplerConfig[] }>(+ "/api/v3/external-migration/doppler/doppler-configs",+ {+ params: { configId, projectSlug }+ }+ );+ return data.configs;+ },+ enabled: !!configId && !!projectSlug+ });+};diff --git a/frontend/src/hooks/api/migration/types.ts b/frontend/src/hooks/api/migration/types.tsindex 83be73b5f9..15af6ffcd0 100644--- a/frontend/src/hooks/api/migration/types.ts+++ b/frontend/src/hooks/api/migration/types.ts@@ -55,6 +55,14 @@ export type TDopplerEnvironment = {project: string;};+export type TDopplerConfig = {+ name: string;+ root: boolean;+ locked: boolean;+ environment: string;+ project: string;+};+export type TImportDopplerSecretsDTO = {configId: string;dopplerProject: string;diff --git a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsxindex c03a575678..80db503504 100644--- a/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx+++ b/frontend/src/pages/organization/SettingsPage/components/ExternalMigrationsTab/components/InPlatformMigrationSection.tsx@@ -4,7 +4,6 @@ import { Edit, MoreVertical, Plus, Trash2 } from "lucide-react";import { createNotification } from "@app/components/notifications";import {Button,- EmptyMedia,Skeleton,UnstableDropdownMenu,UnstableDropdownMenuContent,@@ -145,9 +144,6 @@ export const InPlatformMigrationSection = () => {return (<UnstableEmpty><UnstableEmptyHeader>- <EmptyMedia variant="icon">- <Plus />- </EmptyMedia><UnstableEmptyTitle>No migration configurations</UnstableEmptyTitle><UnstableEmptyDescription>Add a platform configuration to enable in-platform migration features.diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/DopplerSecretImportModal.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/DopplerSecretImportModal.tsxindex 27fcaf9568..1a6fdacf68 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/DopplerSecretImportModal.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/DopplerSecretImportModal.tsx@@ -2,9 +2,11 @@ import { useEffect, useMemo } from "react";import { Controller, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { InfoIcon } from "lucide-react";+import { components, GroupHeadingProps, OptionProps } from "react-select";import { z } from "zod";import {+ Badge,Button,Dialog,DialogContent,@@ -19,13 +21,13 @@ import {} from "@app/components/v3";import { FilterableSelect } from "@app/components/v3/generic/ReactSelect";import { useListAppConnections } from "@app/hooks/api/appConnections/queries";-import { useGetDopplerEnvironments, useGetDopplerProjects } from "@app/hooks/api/migration/queries";-import { TExternalMigrationConfig } from "@app/hooks/api/migration/types";+import { useGetDopplerConfigs, useGetDopplerProjects } from "@app/hooks/api/migration/queries";+import { TDopplerConfig, TExternalMigrationConfig } from "@app/hooks/api/migration/types";const schema = z.object({configId: z.string().min(1, "Doppler configuration is required"),dopplerProject: z.string().min(1, "Doppler project is required"),- dopplerEnvironment: z.string().min(1, "Doppler environment is required")+ dopplerEnvironment: z.string().min(1, "Doppler config is required")});type FormData = z.infer<typeof schema>;@@ -39,6 +41,37 @@ type Props = {onImport: (dopplerProject: string, dopplerEnvironment: string, configId: string) => Promise<void>;};+const DopplerConfigGroupHeading = (props: GroupHeadingProps<TDopplerConfig>) => (+ <components.GroupHeading+ {...props}+ className="px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-muted"+ />+);++const DopplerConfigOption = (props: OptionProps<TDopplerConfig>) => {+ const { data } = props;+ return (+ <components.Option {...props}>+ <div className="flex items-center gap-2">+ <span>{formatConfigLabel(data)}</span>+ {data.root && <Badge variant="project">Root</Badge>}+ </div>+ </components.Option>+ );+};++const formatConfigLabel = (config: TDopplerConfig) => {+ if (config.root) {+ return config.name;+ }+ // Branch configs are named like "env_branch" — show only the branch suffix+ const prefix = `${config.environment}_`;+ const branchName = config.name.startsWith(prefix)+ ? config.name.slice(prefix.length)+ : config.name;+ return branchName;+};+export const DopplerSecretImportModal = ({isOpen,onOpenChange,@@ -83,8 +116,24 @@ export const DopplerSecretImportModal = ({const { data: dopplerProjects = [], isPending: isLoadingProjects } = useGetDopplerProjects(selectedConfigId || undefined);- const { data: dopplerEnvironments = [], isPending: isLoadingEnvironments } =- useGetDopplerEnvironments(selectedConfigId || undefined, selectedDopplerProject || undefined);+ const { data: dopplerConfigs = [], isPending: isLoadingConfigs } = useGetDopplerConfigs(+ selectedConfigId || undefined,+ selectedDopplerProject || undefined+ );++ const sortedDopplerConfigs = useMemo(() => {+ return [...dopplerConfigs].sort((a, b) => {+ // Group by environment first+ if (a.environment !== b.environment) {+ return a.environment.localeCompare(b.environment);+ }+ // Root configs come first within each environment+ if (a.root !== b.root) {+ return a.root ? -1 : 1;+ }+ return a.name.localeCompare(b.name);+ });+ }, [dopplerConfigs]);const configOptions = useMemo(() =>@@ -117,8 +166,7 @@ export const DopplerSecretImportModal = ({<DialogHeader><DialogTitle>Import from Doppler</DialogTitle><DialogDescription>- Select a Doppler project and environment to import secrets into the current Infisical- folder.+ Select a Doppler project and config to import secrets into the current Infisical folder.</DialogDescription></DialogHeader>@@ -202,28 +250,33 @@ export const DopplerSecretImportModal = ({control={control}name="dopplerEnvironment"render={({ field }) => {- const selectedItem = dopplerEnvironments.find((e) => e.slug === field.value);+ const selectedItem = sortedDopplerConfigs.find((c) => c.name === field.value);return (<Field>- <FieldLabel>Source Environment</FieldLabel>+ <FieldLabel>Source Config</FieldLabel><FieldContent><FilterableSelectvalue={selectedItem || null}onChange={(newValue) => {const singleValue = Array.isArray(newValue) ? newValue[0] : newValue;- if (singleValue && "slug" in singleValue) {- field.onChange(singleValue.slug);+ if (singleValue && "name" in singleValue) {+ field.onChange(singleValue.name);} else {field.onChange("");}}}- isLoading={isLoadingEnvironments && Boolean(selectedDopplerProject)}+ isLoading={isLoadingConfigs && Boolean(selectedDopplerProject)}isDisabled={!selectedDopplerProject}- options={dopplerEnvironments}- placeholder="Select source environment..."- getOptionLabel={(option) => option.name}- getOptionValue={(option) => option.slug}+ options={sortedDopplerConfigs}+ placeholder="Select source config..."+ getOptionLabel={formatConfigLabel}+ getOptionValue={(option) => option.name}+ groupBy="environment"+ components={{+ GroupHeading: DopplerConfigGroupHeading,+ Option: DopplerConfigOption+ }}/></FieldContent><FieldError>{errors.dopplerEnvironment?.message}</FieldError>