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
chore: stripe whitelisting
varonix389bcca56adf
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex a68193b527..cbdf41e139 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -687,7 +687,10 @@ const envSchema = zGO_SIDECAR_SPAWN_ENABLED: zodStrBool.default("false"),/* INTERNAL ----------------------------------------------------------------------------- */- INTERNAL_REGION: zpStr(z.enum(["us", "eu"]).optional())+ INTERNAL_REGION: zpStr(z.enum(["us", "eu"]).optional()),++ /* Temporary Stripe Whitelisting ----------------------------------------------------------------------------- */+ WHITELISTED_STRIPE_APP_CONNECTION_ORG_IDS: zpStr(z.string().optional())}).refine((data) => Boolean(data.REDIS_URL) || Boolean(data.REDIS_SENTINEL_HOSTS) || Boolean(data.REDIS_CLUSTER_HOSTS),@@ -790,7 +793,10 @@ const envSchema = zdata.INF_APP_CONNECTION_AZURE_APP_CONFIGURATION_CLIENT_SECRET || data.INF_APP_CONNECTION_AZURE_CLIENT_SECRET,INF_APP_CONNECTION_HEROKU_OAUTH_CLIENT_ID: data.INF_APP_CONNECTION_HEROKU_OAUTH_CLIENT_ID || data.CLIENT_ID_HEROKU,INF_APP_CONNECTION_HEROKU_OAUTH_CLIENT_SECRET:- data.INF_APP_CONNECTION_HEROKU_OAUTH_CLIENT_SECRET || data.CLIENT_SECRET_HEROKU+ data.INF_APP_CONNECTION_HEROKU_OAUTH_CLIENT_SECRET || data.CLIENT_SECRET_HEROKU,+ WHITELISTED_STRIPE_APP_CONNECTION_ORG_IDS: data.WHITELISTED_STRIPE_APP_CONNECTION_ORG_IDS?.split(",").map((id) =>+ id.trim()+ )}));export type TEnvConfig = Readonly<z.infer<typeof envSchema>>;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.tsindex 3ba62f659a..6b5240a643 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@@ -472,7 +472,10 @@ export const registerAppConnectionRouter = async (server: FastifyZodProvider) =>},onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN, AuthMode.OAUTH]),handler: (req) => {- const appConnectionOptions = server.services.appConnection.listAppConnectionOptions(req.query.projectType);+ const appConnectionOptions = server.services.appConnection.listAppConnectionOptions(+ req.permission.orgId,+ req.query.projectType+ );return { appConnectionOptions };}});diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex c7fb7ff12e..fdc2bf859d 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -310,6 +310,7 @@ import {} from "./windmill";import { getWinRMConnectionListItem, validateWinRMConnectionCredentials, WinRMConnectionMethod } from "./winrm";import { getZabbixConnectionListItem, validateZabbixConnectionCredentials, ZabbixConnectionMethod } from "./zabbix";+import { getConfig } from "@app/lib/config/env";const SECRET_SYNC_APP_CONNECTION_MAP = Object.fromEntries(Object.entries(SECRET_SYNC_CONNECTION_MAP).map(([key, value]) => [value, key])@@ -349,7 +350,7 @@ const PKI_APP_CONNECTIONS = [AppConnection.MicrosoftIntune];-export const listAppConnectionOptions = (projectType?: ProjectType) => {+export const listAppConnectionOptions = (orgId: string, projectType?: ProjectType) => {return [getAwsConnectionListItem(),getGitHubConnectionListItem(),@@ -439,6 +440,12 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {getStripeConnectionListItem()].filter((option) => {+ if (option.app == AppConnection.Stripe) {+ if (!getConfig().WHITELISTED_STRIPE_APP_CONNECTION_ORG_IDS?.includes(orgId)) {+ return false;+ }+ }+switch (projectType) {case ProjectType.SecretManager:return (diff --git a/backend/src/services/app-connection/stripe/stripe-connection-fns.ts b/backend/src/services/app-connection/stripe/stripe-connection-fns.tsindex 37e35e6c3b..576ab86d1f 100644--- a/backend/src/services/app-connection/stripe/stripe-connection-fns.ts+++ b/backend/src/services/app-connection/stripe/stripe-connection-fns.ts@@ -133,6 +133,10 @@ const assertCanManageApiKeys = async (accountId: string) => {};export const validateStripeConnectionCredentials = async (config: TStripeConnectionConfig) => {+ if (!getConfig().WHITELISTED_STRIPE_APP_CONNECTION_ORG_IDS?.includes(config.orgId)) {+ throw new BadRequestError({ message: `Your organization does not support Stripe app connections yet.` });+ }+const credentials = await exchangeStripeOAuthCode(config.credentials.code);await assertCanManageApiKeys(credentials.accountId);