Skip to content

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

feat: add new app connection for snowflake

adilsonc8e21b6e8cd3
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 9ac587178d..2631b15f04 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2807,6 +2807,11 @@ export const AppConnections = {
ANTHROPIC: {
apiKey: "The Anthropic API key used to authenticate with the Anthropic API."
},
+ SNOWFLAKE: {
+ account: "The Snowflake account identifier (e.g., xy12345.us-east-1).",
+ username: "The username (login name) used to authenticate with Snowflake.",
+ password: "The Programmatic Access Token used to authenticate with Snowflake."
+ },
VENAFI: {
apiKey: "The API key used to authenticate with Venafi TLS Protect Cloud.",
region: "The region of your Venafi TLS Protect Cloud instance (e.g., 'us', 'eu')."
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index 0971a57633..32324b511e 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -158,6 +158,10 @@ import {
SanitizedRenderConnectionSchema
} from "@app/services/app-connection/render/render-connection-schema";
import { SanitizedSmbConnectionSchema, SmbConnectionListItemSchema } from "@app/services/app-connection/smb";
+import {
+ SanitizedSnowflakeConnectionSchema,
+ SnowflakeConnectionListItemSchema
+} from "@app/services/app-connection/snowflake";
import { SanitizedSshConnectionSchema, SshConnectionListItemSchema } from "@app/services/app-connection/ssh";
import {
SanitizedSupabaseConnectionSchema,
@@ -250,7 +254,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedDopplerConnectionSchema.options,
...SanitizedOnaConnectionSchema.options,
...SanitizedDigiCertConnectionSchema.options,
- ...SanitizedTravisCIConnectionSchema.options
+ ...SanitizedTravisCIConnectionSchema.options,
+ ...SanitizedSnowflakeConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -314,7 +319,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
AnthropicConnectionListItemSchema,
OnaConnectionListItemSchema,
DigiCertConnectionListItemSchema,
- TravisCIConnectionListItemSchema
+ TravisCIConnectionListItemSchema,
+ SnowflakeConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index e6a9250160..fc663a71e2 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -51,6 +51,7 @@ import { registerRailwayConnectionRouter } from "./railway-connection-router";
import { registerRedisConnectionRouter } from "./redis-connection-router";
import { registerRenderConnectionRouter } from "./render-connection-router";
import { registerSmbConnectionRouter } from "./smb-connection-router";
+import { registerSnowflakeConnectionRouter } from "./snowflake-connection-router";
import { registerSshConnectionRouter } from "./ssh-connection-router";
import { registerSupabaseConnectionRouter } from "./supabase-connection-router";
import { registerTeamCityConnectionRouter } from "./teamcity-connection-router";
@@ -126,5 +127,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.Anthropic]: registerAnthropicConnectionRouter,
[AppConnection.Ona]: registerOnaConnectionRouter,
[AppConnection.DigiCert]: registerDigiCertConnectionRouter,
- [AppConnection.TravisCI]: registerTravisCIConnectionRouter
+ [AppConnection.TravisCI]: registerTravisCIConnectionRouter,
+ [AppConnection.Snowflake]: registerSnowflakeConnectionRouter
};
diff --git a/backend/src/server/routes/v1/app-connection-routers/snowflake-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/snowflake-connection-router.ts
new file mode 100644
index 0000000000..41141b77bc
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/snowflake-connection-router.ts
@@ -0,0 +1,18 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateSnowflakeConnectionSchema,
+ SanitizedSnowflakeConnectionSchema,
+ UpdateSnowflakeConnectionSchema
+} from "@app/services/app-connection/snowflake";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerSnowflakeConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.Snowflake,
+ server,
+ sanitizedResponseSchema: SanitizedSnowflakeConnectionSchema,
+ createSchema: CreateSnowflakeConnectionSchema,
+ updateSchema: UpdateSnowflakeConnectionSchema
+ });
+};
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 9699f93854..a6a22d0c6a 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -59,7 +59,8 @@ export enum AppConnection {
Anthropic = "anthropic",
Ona = "ona",
DigiCert = "digicert",
- TravisCI = "travis-ci"
+ TravisCI = "travis-ci",
+ Snowflake = "snowflake"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 359f8d4608..cdfa5547ba 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -191,6 +191,11 @@ import { getRedisConnectionListItem, RedisConnectionMethod, validateRedisConnect
import { RenderConnectionMethod } from "./render/render-connection-enums";
import { getRenderConnectionListItem, validateRenderConnectionCredentials } from "./render/render-connection-fns";
import { getSmbConnectionListItem, SmbConnectionMethod, validateSmbConnectionCredentials } from "./smb";
+import {
+ getSnowflakeConnectionListItem,
+ SnowflakeConnectionMethod,
+ validateSnowflakeConnectionCredentials
+} from "./snowflake";
import { getSshConnectionListItem, SshConnectionMethod, validateSshConnectionCredentials } from "./ssh";
import {
getSupabaseConnectionListItem,
@@ -317,7 +322,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getNetScalerConnectionListItem(),
getOnaConnectionListItem(),
getDigiCertConnectionListItem(),
- getTravisCIConnectionListItem()
+ getTravisCIConnectionListItem(),
+ getSnowflakeConnectionListItem()
]
.filter((option) => {
switch (projectType) {
@@ -477,7 +483,8 @@ export const validateAppConnectionCredentials = async (
deps.identityUaDAL
)) as TAppConnectionCredentialsValidator,
[AppConnection.Doppler]: validateDopplerConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.DigiCert]: validateDigiCertConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.DigiCert]: validateDigiCertConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.Snowflake]: validateSnowflakeConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);
@@ -541,6 +548,8 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
case RedisConnectionMethod.UsernameAndPassword:
case MongoDBConnectionMethod.UsernameAndPassword:
return "Username & Password";
+ case SnowflakeConnectionMethod.UsernameAndToken:
+ return "Username & Token";
case WindmillConnectionMethod.AccessToken:
case HCVaultConnectionMethod.AccessToken:
case TeamCityConnectionMethod.AccessToken:
@@ -691,7 +700,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.Doppler]: platformManagedCredentialsNotSupported,
[AppConnection.Ona]: platformManagedCredentialsNotSupported,
[AppConnection.DigiCert]: platformManagedCredentialsNotSupported,
- [AppConnection.TravisCI]: platformManagedCredentialsNotSupported
+ [AppConnection.TravisCI]: platformManagedCredentialsNotSupported,
+ [AppConnection.Snowflake]: platformManagedCredentialsNotSupported
};
export const enterpriseAppCheck = async (
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 645ad41cb1..a41727c6dc 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -61,7 +61,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Anthropic]: "Anthropic",
[AppConnection.Ona]: "Ona",
[AppConnection.DigiCert]: "DigiCert",
- [AppConnection.TravisCI]: "Travis CI"
+ [AppConnection.TravisCI]: "Travis CI",
+ [AppConnection.Snowflake]: "Snowflake"
};
export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {
@@ -125,5 +126,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.Anthropic]: AppConnectionPlanType.Regular,
[AppConnection.Ona]: AppConnectionPlanType.Regular,
[AppConnection.DigiCert]: AppConnectionPlanType.Regular,
- [AppConnection.TravisCI]: AppConnectionPlanType.Regular
+ [AppConnection.TravisCI]: AppConnectionPlanType.Regular,
+ [AppConnection.Snowflake]: AppConnectionPlanType.Regular
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index f0a3268c27..98492d9fc1 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -137,6 +137,7 @@ import { ValidateRedisConnectionCredentialsSchema } from "./redis";
import { ValidateRenderConnectionCredentialsSchema } from "./render/render-connection-schema";
import { renderConnectionService } from "./render/render-connection-service";
import { ValidateSmbConnectionCredentialsSchema } from "./smb";
+import { ValidateSnowflakeConnectionCredentialsSchema } from "./snowflake";
import { ValidateSshConnectionCredentialsSchema } from "./ssh";
import { ValidateSupabaseConnectionCredentialsSchema } from "./supabase";
import { supabaseConnectionService } from "./supabase/supabase-connection-service";
@@ -233,7 +234,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.Anthropic]: ValidateAnthropicConnectionCredentialsSchema,
[AppConnection.Ona]: ValidateOnaConnectionCredentialsSchema,
[AppConnection.DigiCert]: ValidateDigiCertConnectionCredentialsSchema,
- [AppConnection.TravisCI]: ValidateTravisCIConnectionCredentialsSchema
+ [AppConnection.TravisCI]: ValidateTravisCIConnectionCredentialsSchema,
+ [AppConnection.Snowflake]: ValidateSnowflakeConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index 82eb81c834..9516b03c35 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -299,6 +299,12 @@ import {
TSmbConnectionInput,
TValidateSmbConnectionCredentialsSchema
} from "./smb";
+import {
+ TSnowflakeConnection,
+ TSnowflakeConnectionConfig,
+ TSnowflakeConnectionInput,
+ TValidateSnowflakeConnectionCredentialsSchema
+} from "./snowflake";
import {
TSshConnection,
TSshConnectionConfig,
@@ -422,6 +428,7 @@ export type TAppConnection = { id: string } & (
| TOnaConnection
| TDigiCertConnection
| TTravisCIConnection
+ | TSnowflakeConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -494,6 +501,7 @@ export type TAppConnectionInput = { id: string } & (
| TOnaConnectionInput
| TDigiCertConnectionInput
| TTravisCIConnectionInput
+ | TSnowflakeConnectionInput
);
export type TSqlConnectionInput =
@@ -594,7 +602,8 @@ export type TAppConnectionConfig =
| TAnthropicConnectionConfig
| TOnaConnectionConfig
| TDigiCertConnectionConfig
- | TTravisCIConnectionConfig;
+ | TTravisCIConnectionConfig
+ | TSnowflakeConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -657,7 +666,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateAnthropicConnectionCredentialsSchema
| TValidateOnaConnectionCredentialsSchema
| TValidateDigiCertConnectionCredentialsSchema
- | TValidateTravisCIConnectionCredentialsSchema;
+ | TValidateTravisCIConnectionCredentialsSchema
+ | TValidateSnowflakeConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/snowflake/index.ts b/backend/src/services/app-connection/snowflake/index.ts
new file mode 100644
index 0000000000..3de04d812f
--- /dev/null
+++ b/backend/src/services/app-connection/snowflake/index.ts
@@ -0,0 +1,4 @@
+export * from "./snowflake-connection-enums";
+export * from "./snowflake-connection-fns";
+export * from "./snowflake-connection-schemas";
+export * from "./snowflake-connection-types";
diff --git a/backend/src/services/app-connection/snowflake/snowflake-connection-enums.ts b/backend/src/services/app-connection/snowflake/snowflake-connection-enums.ts
new file mode 100644
index 0000000000..c5a0db4810
--- /dev/null
+++ b/backend/src/services/app-connection/snowflake/snowflake-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum SnowflakeConnectionMethod {
+ UsernameAndToken = "username-and-token"
+}
diff --git a/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts b/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts
new file mode 100644
index 0000000000..6f868fc36a
--- /dev/null
+++ b/backend/src/services/app-connection/snowflake/snowflake-connection-fns.ts
@@ -0,0 +1,55 @@
+import snowflake from "snowflake-sdk";
+
+import { BadRequestError } from "@app/lib/errors";
+import { sanitizeString } from "@app/lib/fn";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { SnowflakeConnectionMethod } from "./snowflake-connection-enums";
+import { TSnowflakeConnectionConfig } from "./snowflake-connection-types";
+
+const noop = () => {};
+
+export const getSnowflakeConnectionListItem = () => {
+ return {
+ name: "Snowflake" as const,
+ app: AppConnection.Snowflake as const,
+ methods: Object.values(SnowflakeConnectionMethod) as [SnowflakeConnectionMethod.UsernameAndToken]
+ };
+};
+
+export const validateSnowflakeConnectionCredentials = async (config: TSnowflakeConnectionConfig) => {
+ const { account, username, password } = config.credentials;
+
+ let client: snowflake.Connection | undefined;
+ try {
+ client = snowflake.createConnection({
+ account,
+ username,
+ password,
+ application: "Infisical"
+ });
+
+ await client.connectAsync(noop);
+
+ await Promise.race([
+ client.isValidAsync(),
+ new Promise((resolve) => {
+ setTimeout(resolve, 10000);
+ }).then(() => {
+ throw new BadRequestError({ message: "Unable to establish connection - verify credentials" });
+ })
+ ]);
+
+ return config.credentials;
+ } catch (err) {
+ const sanitizedErrorMessage = sanitizeString({
+ unsanitizedString: (err as Error)?.message,
+ tokens: [password, username, account]
+ });
+ throw new BadRequestError({
+ message: `Unable to validate connection: ${sanitizedErrorMessage || "verify credentials"}`
+ });
+ } finally {
+ if (client) client.destroy(noop);
+ }
+};
diff --git a/backend/src/services/app-connection/snowflake/snowflake-connection-schemas.ts b/backend/src/services/app-connection/snowflake/snowflake-connection-schemas.ts
new file mode 100644
index 0000000000..bf7d67ad25
--- /dev/null
+++ b/backend/src/services/app-connection/snowflake/snowflake-connection-schemas.ts
@@ -0,0 +1,70 @@
+import z from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";
+import { SnowflakeConnectionMethod } from "./snowflake-connection-enums";
+
+export const SnowflakeConnectionAccessTokenCredentialsSchema = z.object({
+ account: z.string().trim().min(1, "Account required").describe(AppConnections.CREDENTIALS.SNOWFLAKE.account),
+ username: z.string().trim().min(1, "Username required").describe(AppConnections.CREDENTIALS.SNOWFLAKE.username),
+ password: z
+ .string()
+ .trim()
+ .min(1, "Programmatic Access Token required")
+ .describe(AppConnections.CREDENTIALS.SNOWFLAKE.password)
+});
+
+const BaseSnowflakeConnectionSchema = BaseAppConnectionSchema.extend({ app: z.literal(AppConnection.Snowflake) });
+
+export const SnowflakeConnectionSchema = BaseSnowflakeConnectionSchema.extend({
+ method: z.literal(SnowflakeConnectionMethod.UsernameAndToken),
+ credentials: SnowflakeConnectionAccessTokenCredentialsSchema
+});
+
+export const SanitizedSnowflakeConnectionSchema = z.discriminatedUnion("method", [
+ BaseSnowflakeConnectionSchema.extend({
+ method: z.literal(SnowflakeConnectionMethod.UsernameAndToken),
+ credentials: SnowflakeConnectionAccessTokenCredentialsSchema.pick({
+ account: true,
+ username: true
+ })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.Snowflake]} (Username and Token)` }))
+]);
+
+export const ValidateSnowflakeConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z
+ .literal(SnowflakeConnectionMethod.UsernameAndToken)
+ .describe(AppConnections.CREATE(AppConnection.Snowflake).method),
+ credentials: SnowflakeConnectionAccessTokenCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.Snowflake).credentials
+ )
+ })
+]);
+
+export const CreateSnowflakeConnectionSchema = ValidateSnowflakeConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.Snowflake)
+);
+
+export const UpdateSnowflakeConnectionSchema = z
+ .object({
+ credentials: SnowflakeConnectionAccessTokenCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.Snowflake).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.Snowflake));
+
+export const SnowflakeConnectionListItemSchema = z
+ .object({
+ name: z.literal("Snowflake"),
+ app: z.literal(AppConnection.Snowflake),
+ methods: z.nativeEnum(SnowflakeConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.Snowflake] }));
diff --git a/backend/src/services/app-connection/snowflake/snowflake-connection-types.ts b/backend/src/services/app-connection/snowflake/snowflake-connection-types.ts
new file mode 100644
index 0000000000..adf1dcad46
--- /dev/null
+++ b/backend/src/services/app-connection/snowflake/snowflake-connection-types.ts
@@ -0,0 +1,25 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ CreateSnowflakeConnectionSchema,
+ SnowflakeConnectionSchema,
+ ValidateSnowflakeConnectionCredentialsSchema
+} from "./snowflake-connection-schemas";
+
+export type TSnowflakeConnection = z.infer<typeof SnowflakeConnectionSchema>;
+
+export type TSnowflakeConnectionInput = z.infer<typeof CreateSnowflakeConnectionSchema> & {
+ app: AppConnection.Snowflake;
+};
+
+export type TValidateSnowflakeConnectionCredentialsSchema = typeof ValidateSnowflakeConnectionCredentialsSchema;
+
+export type TSnowflakeConnectionConfig = DiscriminativePick<
+ TSnowflakeConnectionInput,
+ "method" | "app" | "credentials"
+> & {
+ orgId: string;
+};
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index 4d5fdbc2ec..1cedd4cc45 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -71,6 +71,7 @@ import { OpenRouterConnectionMethod } from "@app/hooks/api/appConnections/types/
import { RailwayConnectionMethod } from "@app/hooks/api/appConnections/types/railway-connection";
import { RenderConnectionMethod } from "@app/hooks/api/appConnections/types/render-connection";
import { SmbConnectionMethod } from "@app/hooks/api/appConnections/types/smb-connection";
+import { SnowflakeConnectionMethod } from "@app/hooks/api/appConnections/types/snowflake-connection";
import { SshConnectionMethod } from "@app/hooks/api/appConnections/types/ssh-connection";
import { SupabaseConnectionMethod } from "@app/hooks/api/appConnections/types/supabase-connection";
import { TravisCIConnectionMethod } from "@app/hooks/api/appConnections/types/travis-ci-connection";
@@ -171,7 +172,8 @@ export const APP_CONNECTION_MAP: Record<
[AppConnection.Anthropic]: { name: "Anthropic", image: "Anthropic.png" },
[AppConnection.Ona]: { name: "Ona", image: "Ona.png", aliases: ["gitpod"] },
[AppConnection.DigiCert]: { name: "DigiCert", image: "DigiCert.png" },
- [AppConnection.TravisCI]: { name: "Travis CI", image: "Travis CI.png" }
+ [AppConnection.TravisCI]: { name: "Travis CI", image: "Travis CI.png" },
+ [AppConnection.Snowflake]: { name: "Snowflake", image: "Snowflake.png" }
};
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
@@ -228,6 +230,8 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
case RedisConnectionMethod.UsernameAndPassword:
case MongoDBConnectionMethod.UsernameAndPassword:
return { name: "Username & Password", icon: faLock };
+ case SnowflakeConnectionMethod.UsernameAndToken:
+ return { name: "Username & Token", icon: faKey };
case HCVaultConnectionMethod.AccessToken:
case TeamCityConnectionMethod.AccessToken:
case AzureDevOpsConnectionMethod.AccessToken:
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 149ac8a3c2..fbca4f125a 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -59,5 +59,6 @@ export enum AppConnection {
Anthropic = "anthropic",
Ona = "ona",
DigiCert = "digicert",
- TravisCI = "travis-ci"
+ TravisCI = "travis-ci",
+ Snowflake = "snowflake"
}
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index 6a56e5e3e6..082603bee9 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -259,6 +259,10 @@ export type TTravisCIConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.TravisCI;
};
+export type TSnowflakeConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.Snowflake;
+};
+
export type TAppConnectionOption =
| TAwsConnectionOption
| TGitHubConnectionOption
@@ -320,7 +324,8 @@ export type TAppConnectionOption =
| TAnthropicConnectionOption
| TOnaConnectionOption
| TDigiCertConnectionOption
- | TTravisCIConnectionOption;
+ | TTravisCIConnectionOption
+ | TSnowflakeConnectionOption;
export type TAppConnectionOptionMap = {
[AppConnection.AWS]: TAwsConnectionOption;
@@ -384,4 +389,5 @@ export type TAppConnectionOptionMap = {
[AppConnection.Ona]: TOnaConnectionOption;
[AppConnection.DigiCert]: TDigiCertConnectionOption;
[AppConnection.TravisCI]: TTravisCIConnectionOption;
+ [AppConnection.Snowflake]: TSnowflakeConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index e798d35b2f..8d98fbcfdb 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -51,6 +51,7 @@ import { TRailwayConnection } from "./railway-connection";
import { TRedisConnection } from "./redis-connection";
import { TRenderConnection } from "./render-connection";
import { TSmbConnection } from "./smb-connection";
+import { TSnowflakeConnection } from "./snowflake-connection";
import { TSshConnection } from "./ssh-connection";
import { TSupabaseConnection } from "./supabase-connection";
import { TTeamCityConnection } from "./teamcity-connection";
@@ -111,6 +112,7 @@ export * from "./railway-connection";
export * from "./redis-connection";
export * from "./render-connection";
export * from "./smb-connection";
+export * from "./snowflake-connection";
export * from "./ssh-connection";
export * from "./supabase-connection";
export * from "./teamcity-connection";
@@ -183,7 +185,8 @@ export type TAppConnection =
| TDopplerConnection
| TOnaConnection
| TDigiCertConnection
- | TTravisCIConnection;
+ | TTravisCIConnection
+ | TSnowflakeConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;
diff --git a/frontend/src/hooks/api/appConnections/types/snowflake-connection.ts b/frontend/src/hooks/api/appConnections/types/snowflake-connection.ts
new file mode 100644
index 0000000000..ed3d5257a0
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/snowflake-connection.ts
@@ -0,0 +1,15 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum SnowflakeConnectionMethod {
+ UsernameAndToken = "username-and-token"
+}
+
+export type TSnowflakeConnection = TRootAppConnection & { app: AppConnection.Snowflake } & {
+ method: SnowflakeConnectionMethod.UsernameAndToken;
+ credentials: {
+ account: string;
+ username: string;
+ password: string;
+ };
+};
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index b4f6336347..4a7b911e91 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -65,6 +65,7 @@ import { RailwayConnectionForm } from "./RailwayConnectionForm";
import { RedisConnectionForm } from "./RedisConnectionForm";
import { RenderConnectionForm } from "./RenderConnectionForm";
import { SmbConnectionForm } from "./SmbConnectionForm";
+import { SnowflakeConnectionForm } from "./SnowflakeConnectionForm";
import { SshConnectionForm } from "./SshConnectionForm";
import { SupabaseConnectionForm } from "./SupabaseConnectionForm";
import { TeamCityConnectionForm } from "./TeamCityConnectionForm";
@@ -291,6 +292,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <DigiCertConnectionForm onSubmit={onSubmit} />;
case AppConnection.TravisCI:
return <TravisCIConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.Snowflake:
+ return <SnowflakeConnectionForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled App ${app}`);
}
@@ -510,6 +513,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <DigiCertConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.TravisCI:
return <TravisCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.Snowflake:
+ return <SnowflakeConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Venafi:
return <VenafiConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.VenafiTpp:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SnowflakeConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SnowflakeConnectionForm.tsx
new file mode 100644
index 0000000000..0f7d79b44f
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/SnowflakeConnectionForm.tsx
@@ -0,0 +1,181 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import {
+ Button,
+ FormControl,
+ Input,
+ ModalClose,
+ SecretInput,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import {
+ SnowflakeConnectionMethod,
+ TSnowflakeConnection
+} from "@app/hooks/api/appConnections/types/snowflake-connection";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TSnowflakeConnection;
+ onSubmit: (formData: FormData) => void;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.Snowflake)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(SnowflakeConnectionMethod.UsernameAndToken),
+ credentials: z.object({
+ account: z.string().trim().min(1, "Account required"),
+ username: z.string().trim().min(1, "Username required"),
+ password: z.string().trim().min(1, "Programmatic Access Token required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const SnowflakeConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.Snowflake,
+ method: SnowflakeConnectionMethod.UsernameAndToken,
+ credentials: {
+ account: "",
+ username: "",
+ password: ""
+ }
+ }
+ });
+
+ const {
+ handleSubmit,
+ control,
+ formState: { isSubmitting, isDirty }
+ } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+
+ <Controller
+ name="credentials.account"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Account"
+ tooltipText="Your Snowflake account identifier (e.g., xy12345.us-east-1)."
+ >
+ <Input
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="xy12345.us-east-1"
+ />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipText={`The method you would like to use to connect with ${
+ APP_CONNECTION_MAP[AppConnection.Snowflake].name
+ }. This field cannot be changed after creation.`}
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Method"
+ >
+ <Select
+ isDisabled={isUpdate}
+ value={value}
+ onValueChange={(val) => onChange(val)}
+ className="w-full border border-mineshaft-500"
+ position="popper"
+ dropdownContainerClassName="max-w-none"
+ >
+ {Object.values(SnowflakeConnectionMethod).map((method) => (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="credentials.username"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Username"
+ tooltipText="The login name used to authenticate with Snowflake."
+ >
+ <Input value={value} onChange={(e) => onChange(e.target.value)} />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="credentials.password"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Programmatic Access Token"
+ tooltipText="The Programmatic Access Token (PAT) used to authenticate with Snowflake."
+ >
+ <SecretInput
+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </FormControl>
+ )}
+ />
+
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || !isDirty}
+ >
+ {isUpdate ? "Update Credentials" : "Connect to Snowflake"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};