Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add new vercel sync feature Added new vercel sync feature

Maidul Islam97cdd12b7512
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 50a771fab0..7cc06bd9fa 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2956,7 +2956,9 @@ export const SecretSyncs = {
teamName:
"The name of the team to sync the secrets to. This is an optional field only intended for display purposes.",
targetEnvironments: "An optional array of Vercel environments to add shared environment variables to.",
- targetProjects: "An optional array of Vercel projects to add shared environment variables to."
+ targetProjects: "An optional array of Vercel projects to add shared environment variables to.",
+ sensitive:
+ "Whether to create Vercel environment variables as Sensitive (cannot be read back). Not allowed when targeting the Development environment."
},
LARAVEL_FORGE: {
orgSlug: "The slug of the Laravel Forge org to sync secrets to.",
diff --git a/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts b/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
index 730270f74d..d86be82ebc 100644
--- a/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
+++ b/backend/src/services/secret-sync/vercel/vercel-sync-fns.ts
@@ -228,7 +228,7 @@ const createSecret = async (
{
key,
value: secretMap[key].value,
- type: "encrypted",
+ type: destinationConfig.sensitive ? "sensitive" : "encrypted",
target: isVercelDefaultEnvType(destinationConfig.env) ? [destinationConfig.env] : [],
customEnvironmentIds: !isVercelDefaultEnvType(destinationConfig.env) ? [destinationConfig.env] : [],
...(destinationConfig.env === VercelEnvironmentType.Preview && destinationConfig.branch
@@ -451,6 +451,21 @@ const createTeamSharedEnvVar = async (
});
}
+ // Vercel does not support sensitive env vars in the Development environment, so strip it
+ // from the target list when sensitive is enabled.
+ const effectiveTargetEnvironments = destinationConfig.sensitive
+ ? destinationConfig.targetEnvironments?.filter((env) => env !== VercelEnvironmentType.Development)
+ : destinationConfig.targetEnvironments;
+
+ if (destinationConfig.sensitive && (!effectiveTargetEnvironments || effectiveTargetEnvironments.length === 0)) {
+ throw new SecretSyncError({
+ message:
+ "Marking secrets as sensitive in Vercel is not supported for development environments. Add another target environment or disable Sensitive.",
+ secretKey: key,
+ shouldRetry: false
+ });
+ }
+
try {
const { data: createResponse } = await request.post<{
created: VercelSharedEnvVar[];
@@ -459,8 +474,8 @@ const createTeamSharedEnvVar = async (
`${IntegrationUrls.VERCEL_API_URL}/v1/env?teamId=${destinationConfig.teamId}`,
{
evs: [{ key, value }],
- type: "encrypted",
- ...(destinationConfig.targetEnvironments?.length ? { target: destinationConfig.targetEnvironments } : {}),
+ type: destinationConfig.sensitive ? "sensitive" : "encrypted",
+ ...(effectiveTargetEnvironments?.length ? { target: effectiveTargetEnvironments } : {}),
...(destinationConfig.targetProjects !== undefined ? { projectId: destinationConfig.targetProjects } : {})
},
{
@@ -508,6 +523,24 @@ const updateTeamSharedEnvVar = async (
});
}
+ const isExistingSensitive = envVar.type === "sensitive";
+ const effectiveTargetEnvironments =
+ destinationConfig.sensitive || isExistingSensitive
+ ? destinationConfig.targetEnvironments?.filter((env) => env !== VercelEnvironmentType.Development)
+ : destinationConfig.targetEnvironments;
+
+ if (
+ (destinationConfig.sensitive || isExistingSensitive) &&
+ (!effectiveTargetEnvironments || effectiveTargetEnvironments.length === 0)
+ ) {
+ throw new SecretSyncError({
+ message:
+ "Marking secrets as sensitive in Vercel is not supported for development environments. Add another target environment or disable Sensitive.",
+ secretKey: envVar.key,
+ shouldRetry: false
+ });
+ }
+
try {
const { data: updateResponse } = await request.patch<{
updated: VercelSharedEnvVar[];
@@ -518,7 +551,7 @@ const updateTeamSharedEnvVar = async (
updates: {
[envVar.id]: {
value,
- ...(destinationConfig.targetEnvironments?.length ? { target: destinationConfig.targetEnvironments } : {}),
+ ...(effectiveTargetEnvironments?.length ? { target: effectiveTargetEnvironments } : {}),
...(destinationConfig.targetProjects !== undefined ? { projectId: destinationConfig.targetProjects } : {})
}
}
@@ -602,7 +635,7 @@ export const VercelSyncFns = {
const sharedEnvVars = await getTeamSharedEnvVars(secretSync);
const sharedEnvVarsMap = new Map(sharedEnvVars.map((s) => [s.key, s]));
- const { targetEnvironments, targetProjects } = secretSync.destinationConfig;
+ const { targetEnvironments, targetProjects, sensitive } = secretSync.destinationConfig;
for await (const key of Object.keys(secretMap)) {
const existingVar = sharedEnvVarsMap.get(key);
@@ -612,9 +645,16 @@ export const VercelSyncFns = {
} else {
const hasValueChanged = existingVar.value !== secretMap[key].value;
- const hasTargetChanged = targetEnvironments?.length
- ? existingVar.target.length !== targetEnvironments.length ||
- !targetEnvironments.every((env) => existingVar.target.includes(env))
+ // Sensitive secrets cannot target Development in Vercel, so compare against
+ // the effective targets that will actually be sent.
+ const isSensitive = sensitive || existingVar.type === "sensitive";
+ const effectiveTargets = isSensitive
+ ? targetEnvironments?.filter((env) => env !== VercelEnvironmentType.Development)
+ : targetEnvironments;
+
+ const hasTargetChanged = effectiveTargets?.length
+ ? existingVar.target.length !== effectiveTargets.length ||
+ !effectiveTargets.every((env) => existingVar.target.includes(env))
: false;
const hasProjectsChanged = targetProjects
diff --git a/backend/src/services/secret-sync/vercel/vercel-sync-schemas.ts b/backend/src/services/secret-sync/vercel/vercel-sync-schemas.ts
index 36f60f463c..dd16915534 100644
--- a/backend/src/services/secret-sync/vercel/vercel-sync-schemas.ts
+++ b/backend/src/services/secret-sync/vercel/vercel-sync-schemas.ts
@@ -13,26 +13,40 @@ import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types"
import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
import { VercelEnvironmentType, VercelSyncScope } from "./vercel-sync-enums";
-const VercelSyncDestinationConfigSchema = z.discriminatedUnion("scope", [
- z.object({
- scope: z.literal(VercelSyncScope.Project),
- app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
- appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
- env: z.nativeEnum(VercelEnvironmentType).or(z.string()).describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
- branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch),
- teamId: z.string().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamId)
- }),
- z.object({
- scope: z.literal(VercelSyncScope.Team),
- teamId: z.string().min(1, "Team ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamId),
- teamName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamName),
- targetEnvironments: z
- .array(z.nativeEnum(VercelEnvironmentType))
- .min(1, "At least one environment is required")
- .describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.targetEnvironments),
- targetProjects: z.array(z.string()).optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.targetProjects)
- })
-]);
+const VercelSyncDestinationConfigSchema = z
+ .discriminatedUnion("scope", [
+ z.object({
+ scope: z.literal(VercelSyncScope.Project),
+ app: z.string().min(1, "App ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.app),
+ appName: z.string().min(1, "App Name is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.appName),
+ env: z.nativeEnum(VercelEnvironmentType).or(z.string()).describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.env),
+ branch: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.branch),
+ teamId: z.string().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamId),
+ sensitive: z.boolean().default(false).describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.sensitive)
+ }),
+ z.object({
+ scope: z.literal(VercelSyncScope.Team),
+ teamId: z.string().min(1, "Team ID is required").describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamId),
+ teamName: z.string().optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.teamName),
+ targetEnvironments: z
+ .array(z.nativeEnum(VercelEnvironmentType))
+ .min(1, "At least one environment is required")
+ .describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.targetEnvironments),
+ targetProjects: z.array(z.string()).optional().describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.targetProjects),
+ sensitive: z.boolean().default(false).describe(SecretSyncs.DESTINATION_CONFIG.VERCEL.sensitive)
+ })
+ ])
+ .superRefine((config, ctx) => {
+ if (!config.sensitive) return;
+
+ if (config.scope === VercelSyncScope.Project && config.env === VercelEnvironmentType.Development) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Marking secrets as sensitive in Vercel is not supported for development environments.",
+ path: ["sensitive"]
+ });
+ }
+ });
const VercelSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: true };
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/VercelSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/VercelSyncFields.tsx
index dd9b10cf55..636952a0a4 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/VercelSyncFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/VercelSyncFields.tsx
@@ -1,11 +1,11 @@
import { useMemo, useState } from "react";
import { Controller, useFormContext, useWatch } from "react-hook-form";
import { MultiValue, SingleValue } from "react-select";
-import { faCircleInfo } from "@fortawesome/free-solid-svg-icons";
+import { faCircleInfo, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
-import { FilterableSelect, FormControl, Tooltip } from "@app/components/v2";
+import { FilterableSelect, FormControl, Switch, Tooltip } from "@app/components/v2";
import { CreatableSelect } from "@app/components/v2/CreatableSelect";
import { useDebounce } from "@app/hooks";
import {
@@ -13,7 +13,10 @@ import {
useVercelConnectionListOrganizations
} from "@app/hooks/api/appConnections/vercel";
import { SecretSync } from "@app/hooks/api/secretSyncs";
-import { VercelSyncScope } from "@app/hooks/api/secretSyncs/types/vercel-sync";
+import {
+ VercelEnvironmentType,
+ VercelSyncScope
+} from "@app/hooks/api/secretSyncs/types/vercel-sync";
import { TSecretSyncForm } from "../schemas";
@@ -36,6 +39,13 @@ export const VercelSyncFields = () => {
const currentEnv = watch("destinationConfig.env");
const scope = watch("destinationConfig.scope");
const teamId = watch("destinationConfig.teamId");
+ const targetEnvironments = watch("destinationConfig.targetEnvironments");
+
+ const isProjectDevTargeted =
+ scope !== VercelSyncScope.Team && currentEnv === VercelEnvironmentType.Development;
+ const isTeamDevTargeted =
+ scope === VercelSyncScope.Team &&
+ Boolean(targetEnvironments?.includes(VercelEnvironmentType.Development));
const { data: teams, isLoading: isTeamsLoading } = useVercelConnectionListOrganizations(
connectionId,
@@ -101,6 +111,7 @@ export const VercelSyncFields = () => {
setValue("destinationConfig.teamId", "");
setValue("destinationConfig.teamName", "");
setValue("destinationConfig.scope", VercelSyncScope.Project);
+ setValue("destinationConfig.sensitive", false);
}}
/>
@@ -130,6 +141,7 @@ export const VercelSyncFields = () => {
setValue("destinationConfig.branch", "");
setValue("destinationConfig.teamId", "");
}
+ setValue("destinationConfig.sensitive", false);
}}
options={scopeOptions}
placeholder="Select a scope..."
@@ -307,6 +319,10 @@ export const VercelSyncFields = () => {
onChange(envKey);
setValue("destinationConfig.branch", "");
+
+ if (envKey === VercelEnvironmentType.Development) {
+ setValue("destinationConfig.sensitive", false);
+ }
}}
options={environmentOptions}
placeholder="Select an environment..."
@@ -367,6 +383,64 @@ export const VercelSyncFields = () => {
)}
</>
)}
+
+ <Controller
+ name="destinationConfig.sensitive"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => {
+ const showTeamDevWarning = isTeamDevTargeted && Boolean(value);
+
+ return (
+ <FormControl isError={Boolean(error?.message)} errorText={error?.message}>
+ <div className="flex w-fit items-center gap-2">
+ <Tooltip
+ className="max-w-md"
+ content="Marking secrets as sensitive in Vercel is not supported for development environments."
+ isDisabled={!isProjectDevTargeted}
+ >
+ <div className="w-fit">
+ <Switch
+ className="bg-mineshaft-400/50 shadow-inner data-[state=checked]:bg-green/80"
+ id="vercel-sync-sensitive"
+ thumbClassName="bg-mineshaft-800"
+ isChecked={Boolean(value) && !isProjectDevTargeted}
+ isDisabled={isProjectDevTargeted}
+ onCheckedChange={(isChecked) => {
+ if (isProjectDevTargeted) return;
+ onChange(isChecked);
+ }}
+ >
+ <p className="w-fit">
+ Secrets as Sensitive in Vercel{" "}
+ <Tooltip
+ className="max-w-md"
+ content={
+ <span>
+ When enabled, secrets will be created in Vercel as Sensitive.
+ Sensitive environment variables cannot be read back via the Vercel API
+ after creation.
+ </span>
+ }
+ >
+ <FontAwesomeIcon icon={faCircleInfo} className="text-mineshaft-400" />
+ </Tooltip>
+ </p>
+ </Switch>
+ </div>
+ </Tooltip>
+ {showTeamDevWarning && (
+ <Tooltip
+ className="max-w-md"
+ content="Marking secrets as sensitive in Vercel is not supported for development environments. Sensitive secrets will only be applied to your other selected environments."
+ >
+ <FontAwesomeIcon icon={faTriangleExclamation} className="text-yellow" />
+ </Tooltip>
+ )}
+ </div>
+ </FormControl>
+ );
+ }}
+ />
</>
);
};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index 43cb522a20..827aebbb5d 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -1,4 +1,4 @@
-import { ReactNode } from "react";
+import { ReactNode, useEffect } from "react";
import { Controller, useFormContext } from "react-hook-form";
import {
faCircleInfo,
@@ -27,15 +27,37 @@ type Props = {
};
export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
- const { control, watch } = useFormContext<TSecretSyncForm>();
+ const { control, watch, setValue } = useFormContext<TSecretSyncForm>();
const destination = watch("destination");
const currentSyncOption = watch("syncOptions");
+ const vercelSensitive =
+ destination === SecretSync.Vercel
+ ? Boolean(watch("destinationConfig.sensitive" as never))
+ : false;
const destinationName = SECRET_SYNC_MAP[destination].name;
const { syncOption } = useSecretSyncOption(destination);
+ // Vercel "sensitive" secrets cannot be read back, so importing destination secrets is impossible.
+ // Force the initial sync behavior to OverwriteDestination whenever sensitive is enabled.
+ useEffect(() => {
+ if (
+ vercelSensitive &&
+ currentSyncOption.initialSyncBehavior !== SecretSyncInitialSyncBehavior.OverwriteDestination
+ ) {
+ setValue(
+ "syncOptions.initialSyncBehavior",
+ SecretSyncInitialSyncBehavior.OverwriteDestination
+ );
+ }
+ }, [vercelSensitive, currentSyncOption.initialSyncBehavior, setValue]);
+
+ const initialSyncBehaviorEntries = Object.entries(SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP).filter(
+ ([key]) => !vercelSensitive || key === SecretSyncInitialSyncBehavior.OverwriteDestination
+ );
+
let AdditionalSyncOptionsFieldsComponent: ReactNode;
switch (destination) {
@@ -132,7 +154,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
label="Initial Sync Behavior"
>
<Select
- isDisabled={!syncOption?.canImportSecrets}
+ isDisabled={!syncOption?.canImportSecrets || vercelSensitive}
value={value}
onValueChange={(val) => onChange(val)}
className="w-full border border-mineshaft-500"
@@ -140,7 +162,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
placeholder="Select an option..."
dropdownContainerClassName="max-w-none"
>
- {Object.entries(SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP).map(([key, details]) => {
+ {initialSyncBehaviorEntries.map(([key, details]) => {
const { name } = details(destinationName);
return (
@@ -153,7 +175,14 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
</FormControl>
)}
/>
- {!syncOption?.canImportSecrets ? (
+ {vercelSensitive && (
+ <p className="-mt-2.5 mb-2.5 text-xs text-yellow">
+ <FontAwesomeIcon className="mr-1" size="xs" icon={faTriangleExclamation} />
+ When secrets are marked as sensitive, Vercel does not allow them to be read back, so
+ only Overwrite Destination Secrets is supported.
+ </p>
+ )}
+ {!vercelSensitive && !syncOption?.canImportSecrets && (
<p className="-mt-2.5 mb-2.5 text-xs text-yellow">
<FontAwesomeIcon className="mr-1" size="xs" icon={faTriangleExclamation} />
{destinationName} only supports overwriting destination secrets.{" "}
@@ -162,7 +191,9 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
syncOption?.supportsDisableSecretDeletion !== false) &&
`Secrets not present in Infisical will be removed from the destination. Consider adding a key schema or disabling secret deletion if you do not want existing secrets to be removed from ${destinationName}.`}
</p>
- ) : (
+ )}
+ {!vercelSensitive &&
+ syncOption?.canImportSecrets &&
currentSyncOption.initialSyncBehavior ===
SecretSyncInitialSyncBehavior.OverwriteDestination &&
!currentSyncOption.disableSecretDeletion && (
@@ -173,8 +204,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
sync behavior to import destination secrets. Alternatively, configure a key schema
or disable secret deletion below to have Infisical ignore these secrets.
</p>
- )
- )}
+ )}
</>
)}
{syncOption?.supportsKeySchema !== false && (
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
index fc981a9093..a82686c1f1 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/VercelSyncReviewFields.tsx
@@ -20,6 +20,7 @@ export const VercelSyncReviewFields = () => {
const teamId = watch("destinationConfig.teamId");
const targetEnvironments = watch("destinationConfig.targetEnvironments");
const targetProjects = watch("destinationConfig.targetProjects");
+ const sensitive = watch("destinationConfig.sensitive");
const connectionId = watch("connection.id");
const { data: teams } = useVercelConnectionListOrganizations(connectionId, undefined, {
@@ -52,6 +53,7 @@ export const VercelSyncReviewFields = () => {
<GenericFieldLabel label="Target Projects">
{selectedProjects?.map((project) => project?.name).join(", ")}
</GenericFieldLabel>
+ <GenericFieldLabel label="Sensitive">{sensitive ? "Yes" : "No"}</GenericFieldLabel>
</>
) : (
<>
@@ -61,6 +63,7 @@ export const VercelSyncReviewFields = () => {
{envId === VercelEnvironmentType.Preview && branchId && (
<GenericFieldLabel label="Preview Branch">{branchId}</GenericFieldLabel>
)}
+ <GenericFieldLabel label="Sensitive">{sensitive ? "Yes" : "No"}</GenericFieldLabel>
</>
)}
</>
diff --git a/frontend/src/components/secret-syncs/forms/schemas/vercel-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/vercel-sync-destination-schema.ts
index 02691644ca..48f03e260f 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/vercel-sync-destination-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/vercel-sync-destination-schema.ts
@@ -10,26 +10,44 @@ import {
export const VercelSyncDestinationSchema = BaseSecretSyncSchema().merge(
z.object({
destination: z.literal(SecretSync.Vercel),
- destinationConfig: z.discriminatedUnion("scope", [
- z.object({
- scope: z.literal(VercelSyncScope.Project),
- app: z.string().trim().min(1, "Project required"),
- appName: z.string().trim().min(1, "Project required"),
- env: z.nativeEnum(VercelEnvironmentType).or(z.string()),
- branch: z.string().trim().optional(),
- teamId: z.string().trim()
- }),
- z.object({
- scope: z.literal(VercelSyncScope.Team),
- teamId: z.string().trim().min(1, "Team required"),
- teamName: z.string().trim().optional(),
- targetEnvironments: z
- .array(z.nativeEnum(VercelEnvironmentType), {
- message: "At least one environment is required"
- })
- .min(1, "At least one environment is required"),
- targetProjects: z.array(z.string()).optional()
+ destinationConfig: z
+ .discriminatedUnion("scope", [
+ z.object({
+ scope: z.literal(VercelSyncScope.Project),
+ app: z.string().trim().min(1, "Project required"),
+ appName: z.string().trim().min(1, "Project required"),
+ env: z.nativeEnum(VercelEnvironmentType).or(z.string()),
+ branch: z.string().trim().optional(),
+ teamId: z.string().trim(),
+ sensitive: z.boolean().default(false)
+ }),
+ z.object({
+ scope: z.literal(VercelSyncScope.Team),
+ teamId: z.string().trim().min(1, "Team required"),
+ teamName: z.string().trim().optional(),
+ targetEnvironments: z
+ .array(z.nativeEnum(VercelEnvironmentType), {
+ message: "At least one environment is required"
+ })
+ .min(1, "At least one environment is required"),
+ targetProjects: z.array(z.string()).optional(),
+ sensitive: z.boolean().default(false)
+ })
+ ])
+ .superRefine((config, ctx) => {
+ if (!config.sensitive) return;
+
+ if (
+ config.scope === VercelSyncScope.Project &&
+ config.env === VercelEnvironmentType.Development
+ ) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message:
+ "Marking secrets as sensitive in Vercel is not supported for development environments.",
+ path: ["sensitive"]
+ });
+ }
})
- ])
})
);
diff --git a/frontend/src/hooks/api/secretSyncs/types/vercel-sync.ts b/frontend/src/hooks/api/secretSyncs/types/vercel-sync.ts
index e35fafaaac..2655d547b1 100644
--- a/frontend/src/hooks/api/secretSyncs/types/vercel-sync.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/vercel-sync.ts
@@ -25,6 +25,7 @@ export type TVercelSync = TRootSecretSync & {
branch?: string;
appName?: string;
teamId: string;
+ sensitive: boolean;
}
| {
scope: VercelSyncScope.Team;
@@ -32,6 +33,7 @@ export type TVercelSync = TRootSecretSync & {
teamName?: string;
targetEnvironments: string[];
targetProjects?: string[];
+ sensitive: boolean;
};
connection: {
app: AppConnection.Vercel;
diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
index d6b9d7d3fc..1365c06d7a 100644
--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/VercelSyncDestinationSection.tsx
@@ -48,6 +48,9 @@ export const VercelSyncDestinationSection = ({ secretSync }: Props) => {
<GenericFieldLabel label="Target Projects">
{selectedProjects?.map((project) => project?.name).join(", ")}
</GenericFieldLabel>
+ <GenericFieldLabel label="Sensitive">
+ {destinationConfig.sensitive ? "Yes" : "No"}
+ </GenericFieldLabel>
</>
);
}
@@ -62,6 +65,9 @@ export const VercelSyncDestinationSection = ({ secretSync }: Props) => {
</GenericFieldLabel>
<GenericFieldLabel label="Environment">{destinationConfig.env}</GenericFieldLabel>
<GenericFieldLabel label="Preview Branch">{destinationConfig.branch}</GenericFieldLabel>
+ <GenericFieldLabel label="Sensitive">
+ {destinationConfig.sensitive ? "Yes" : "No"}
+ </GenericFieldLabel>
</>
);
} else {
@@ -72,6 +78,9 @@ export const VercelSyncDestinationSection = ({ secretSync }: Props) => {
{destinationConfig.appName || destinationConfig.app}
</GenericFieldLabel>
<GenericFieldLabel label="Environment">{destinationConfig.env}</GenericFieldLabel>
+ <GenericFieldLabel label="Sensitive">
+ {destinationConfig.sensitive ? "Yes" : "No"}
+ </GenericFieldLabel>
</>
);
}