Skip to content

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

fix(secret-rotation): address review on the Stripe rotation and connection

Calvin413788355be3
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.test.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.test.ts
index 97b63de42b..d8f3b64da3 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.test.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.test.ts
@@ -52,22 +52,18 @@ describe("decryptStripeJwe", () => {
it("rejects a JWE without exactly five segments", async () => {
const { privateKey } = await generateStripeEncryptionKeyPair();
- expect(() => decryptStripeJwe("a.b.c", privateKey)).toThrow(/5 segments, got 3/);
+ expect(() => decryptStripeJwe("a.b.c", privateKey)).toThrow(/5 JWE segments, got 3/);
});
- it("names an unsupported key algorithm rather than guessing", async () => {
- const { publicKey, privateKey } = await generateStripeEncryptionKeyPair();
- const jwe = encryptJwe("rk_live_secret", publicKey, { alg: "RSA1_5" });
-
- expect(() => decryptStripeJwe(jwe, privateKey)).toThrow(/RSA1_5/);
- });
-
- it("rejects an unsupported content encryption algorithm", async () => {
- const { publicKey, privateKey } = await generateStripeEncryptionKeyPair();
- const jwe = encryptJwe("rk_live_secret", publicKey, { enc: "A128GCM" });
+ it.each([{ alg: "RSA1_5" }, { enc: "A128GCM" }])(
+ "names an unsupported algorithm rather than guessing (%o)",
+ async (header) => {
+ const { publicKey, privateKey } = await generateStripeEncryptionKeyPair();
+ const jwe = encryptJwe("rk_live_secret", publicKey, header);
- expect(() => decryptStripeJwe(jwe, privateKey)).toThrow(/A128GCM/);
- });
+ expect(() => decryptStripeJwe(jwe, privateKey)).toThrow(/RSA1_5|A128GCM/);
+ }
+ );
it("rejects an authentication tag that is not the 16 bytes A256GCM requires", async () => {
const { publicKey, privateKey } = await generateStripeEncryptionKeyPair();
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.ts
index b8c20b5276..97cb3f40a6 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-jwe.ts
@@ -8,8 +8,8 @@ export type TStripeSecretKeyField = {
encrypted_secret?: { ciphertext?: string | null } | null;
};
-// Stripe names OAEP with SHA-1 `RSA-OAEP`, which is the JOSE spelling. Both are accepted by the
-// FIPS provider for key transport, so neither needs a fallback.
+// The header's `alg` picks the OAEP hash, so this map is how the unwrap is parameterised. Stripe
+// spells OAEP with SHA-1 `RSA-OAEP`, the JOSE name.
const SUPPORTED_KEY_ALGORITHMS: Record<string, "sha1" | "sha256"> = {
"RSA-OAEP": "sha1",
"RSA-OAEP-256": "sha256"
@@ -17,9 +17,8 @@ const SUPPORTED_KEY_ALGORITHMS: Record<string, "sha1" | "sha256"> = {
const SUPPORTED_CONTENT_ALGORITHM = "A256GCM";
-// A256GCM fixes the authentication tag at 16 bytes. Node accepts any tag length OpenSSL supports
-// unless it is told otherwise, so a truncated tag would authenticate against fewer bits than the
-// algorithm promises.
+// Node accepts any tag length OpenSSL supports unless told otherwise, so a truncated tag would
+// authenticate against fewer bits than A256GCM promises.
const GCM_AUTH_TAG_LENGTH = 16;
export const generateStripeEncryptionKeyPair = async () =>
@@ -40,7 +39,7 @@ export const decryptStripeJwe = (jwe: string, privateKeyPem: string): string =>
if (segments.length !== 5) {
throw new BadRequestError({
- message: `Stripe returned a malformed encrypted secret: expected a compact JWE with 5 segments, got ${segments.length}.`
+ message: `Stripe returned a malformed encrypted secret: expected 5 JWE segments, got ${segments.length}.`
});
}
@@ -51,22 +50,20 @@ export const decryptStripeJwe = (jwe: string, privateKeyPem: string): string =>
try {
header = JSON.parse(Buffer.from(protectedHeader, "base64url").toString()) as typeof header;
} catch {
- throw new BadRequestError({
- message: "Stripe returned an encrypted secret whose JWE header could not be parsed."
- });
+ throw new BadRequestError({ message: "Stripe returned an encrypted secret with an unreadable JWE header." });
}
const oaepHash = header.alg ? SUPPORTED_KEY_ALGORITHMS[header.alg] : undefined;
if (!oaepHash) {
throw new BadRequestError({
- message: `Stripe encrypted the secret with an unsupported key algorithm '${header.alg ?? "none"}'. Infisical supports RSA-OAEP and RSA-OAEP-256.`
+ message: `Stripe encrypted the secret with an unsupported algorithm '${header.alg ?? "none"}'. Infisical supports RSA-OAEP and RSA-OAEP-256.`
});
}
if (header.enc !== SUPPORTED_CONTENT_ALGORITHM) {
throw new BadRequestError({
- message: `Stripe encrypted the secret with an unsupported content algorithm '${header.enc ?? "none"}'. Infisical supports ${SUPPORTED_CONTENT_ALGORITHM}.`
+ message: `Stripe encrypted the secret with an unsupported algorithm '${header.enc ?? "none"}'. Infisical supports ${SUPPORTED_CONTENT_ALGORITHM}.`
});
}
@@ -92,9 +89,8 @@ export const decryptStripeJwe = (jwe: string, privateKeyPem: string): string =>
return Buffer.concat([decipher.update(Buffer.from(ciphertext, "base64url")), decipher.final()]).toString();
} catch (error) {
- // The underlying OpenSSL error (unpad failure, auth tag mismatch) carries no plaintext or key
- // material, but it is an implementation detail that must never reach a user, and its wording is
- // not a stable contract, so it is logged here rather than thrown.
+ // The OpenSSL error (unpad failure, auth tag mismatch) is an implementation detail whose wording
+ // is not a stable contract, so it is logged rather than thrown.
logger.error(error, "decryptStripeJwe: failed to decrypt a Stripe-returned secret");
throw new BadRequestError({
message: "Infisical could not decrypt the secret Stripe returned. Try creating the API key again."
@@ -103,10 +99,8 @@ export const decryptStripeJwe = (jwe: string, privateKeyPem: string): string =>
};
/**
- * Stripe returns both shapes when a public key is supplied: a JWE, and the plaintext token beside
- * it. The JWE is preferred rather than the token, so the path live mode depends on is the one every
- * sandbox rotation exercises. Reading the token first would leave decryption unexercised outside
- * this module's own tests, which decrypt only what they themselves encrypted.
+ * Stripe returns a JWE and the plaintext token together when a public key is supplied. The JWE is
+ * preferred so the path live mode depends on is the one every sandbox rotation exercises.
*/
export const readStripeSecret = (secretKey: TStripeSecretKeyField | undefined, privateKeyPem: string): string => {
const ciphertext = secretKey?.encrypted_secret?.ciphertext;
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-constants.ts
index 7dcfe8bd31..8471d5863e 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-constants.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-constants.ts
@@ -176,8 +176,6 @@ export const STRIPE_API_KEY_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {
secretsMapping: {
apiKey: "STRIPE_API_KEY"
},
- // The frontend picker reads the permission names from here. It cannot import this file, since
- // the frontend is a separate package, and Stripe has no endpoint that lists them.
permissions: [...STRIPE_API_KEY_PERMISSIONS]
}
};
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.test.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.test.ts
index ad35de8635..24bbbea442 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.test.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.test.ts
@@ -9,7 +9,7 @@ const { getMock, postMock } = vi.hoisted(() => ({
}));
vi.mock("@app/lib/config/env", () => ({
- getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_platform" })
+ getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_app" })
}));
vi.mock("@app/lib/config/request", () => ({
request: { get: getMock, post: postMock }
@@ -159,24 +159,27 @@ describe("stripeApiKeyRotationFactory", () => {
expect(createBody?.public_key.pem_key.data).toContain("BEGIN PUBLIC KEY");
});
- it("expires the new key when the commit fails", async () => {
- mockStripe();
-
- await expect(
- makeFactory().issueCredentials(async () => {
+ // The key exists in Stripe before the row does, so both failure points after create have to
+ // take it with them.
+ it.each([
+ {
+ failure: "the commit fails",
+ omitSecret: false,
+ callback: async () => {
throw new Error("conflicting secret");
- })
- ).rejects.toThrow("conflicting secret");
-
- expect(calls).toEqual(["create", "expire:mk_new"]);
- });
-
- it("expires the new key when reading the returned secret fails", async () => {
- mockStripe({ omitSecret: true });
-
- await expect(makeFactory().issueCredentials(commit)).rejects.toThrow(
- "Stripe returned an API key without a secret"
- );
+ },
+ message: "conflicting secret"
+ },
+ {
+ failure: "reading the returned secret fails",
+ omitSecret: true,
+ callback: commit,
+ message: "Stripe returned an API key without a secret"
+ }
+ ])("expires the new key when $failure", async ({ omitSecret, callback, message }) => {
+ mockStripe({ omitSecret });
+
+ await expect(makeFactory().issueCredentials(callback)).rejects.toThrow(message);
expect(calls).toEqual(["create", "expire:mk_new"]);
expect(commit).not.toHaveBeenCalled();
@@ -204,17 +207,6 @@ describe("stripeApiKeyRotationFactory", () => {
expect(commit).not.toHaveBeenCalled();
});
- it("names both stranded keys when the cleanup also fails", async () => {
- mockStripe({
- expire: async () => {
- throw httpError(500, "Stripe is down");
- }
- });
- mockKeyLookup(async () => {});
-
- await expect(makeFactory().rotateCredentials(OLD_KEY, commit, OLD_KEY)).rejects.toThrow(/mk_old.*mk_new/s);
- });
-
it("treats a 404 on expire as already gone", async () => {
mockStripe({ expire: failsWith(404, "No such key", "mk_old") });
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.ts
index 7ff73946f1..a6b5dbc044 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-fns.ts
@@ -9,10 +9,10 @@ import {
import { request } from "@app/lib/config/request";
import { BadRequestError } from "@app/lib/errors";
import {
+ getStripeAppRequestConfig,
getStripeErrorMessage,
getStripeErrorStatus,
getStripeMerchantRequestConfig,
- getStripePlatformRequestConfig,
STRIPE_API_KEYS_URL,
throwStripeApiKeyManagementError,
withIdempotencyKey
@@ -52,7 +52,7 @@ export const stripeApiKeyRotationFactory: TRotationFactory<
*/
const $keyExists = async (keyId: string): Promise<boolean> => {
try {
- await request.get(`${STRIPE_API_KEYS_URL}/${keyId}`, getStripePlatformRequestConfig(accountId));
+ await request.get(`${STRIPE_API_KEYS_URL}/${keyId}`, getStripeAppRequestConfig(accountId));
return true;
} catch (error) {
if (getStripeErrorStatus(error) === 404) return false;
@@ -66,7 +66,7 @@ export const stripeApiKeyRotationFactory: TRotationFactory<
await request.post(
`${STRIPE_API_KEYS_URL}/${keyId}/expire`,
{},
- withIdempotencyKey(getStripePlatformRequestConfig(accountId))
+ withIdempotencyKey(getStripeAppRequestConfig(accountId))
);
return { retired: true };
} catch (expireError) {
@@ -129,11 +129,11 @@ export const stripeApiKeyRotationFactory: TRotationFactory<
{
type: "secret_key",
name: $keyName(),
- permissions,
+ ...(permissions?.length ? { permissions } : {}),
...(connectPermissions?.length ? { connect_permissions: connectPermissions } : {}),
public_key: { pem_key: { data: publicKey, algorithm: "RSA" } }
},
- withIdempotencyKey(getStripePlatformRequestConfig(accountId))
+ withIdempotencyKey(getStripeAppRequestConfig(accountId))
));
} catch (error) {
return throwStripeApiKeyManagementError(accountId, error);
diff --git a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-schemas.ts
index 9c1649fea2..f77c660cc4 100644
--- a/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-schemas.ts
+++ b/backend/src/ee/services/secret-rotation-v2/stripe-api-key/stripe-api-key-rotation-schemas.ts
@@ -23,16 +23,28 @@ export const StripeApiKeyRotationGeneratedCredentialsSchema = z
.min(1)
.max(2);
-const StripeApiKeyRotationParametersSchema = z.object({
- permissions: StripeApiKeyPermissionSchema.array()
- .min(1, "At least one permission is required")
- .max(STRIPE_API_KEY_PERMISSIONS.length)
- .describe(SecretRotations.PARAMETERS.STRIPE_API_KEY.permissions),
- connectPermissions: StripeApiKeyPermissionSchema.array()
- .max(STRIPE_API_KEY_PERMISSIONS.length)
- .optional()
- .describe(SecretRotations.PARAMETERS.STRIPE_API_KEY.connectPermissions)
-});
+const StripeApiKeyPermissionListSchema = StripeApiKeyPermissionSchema.array()
+ .max(STRIPE_API_KEY_PERMISSIONS.length)
+ .transform((permissions) => [...new Set(permissions)]);
+
+const StripeApiKeyRotationParametersSchema = z
+ .object({
+ permissions: StripeApiKeyPermissionListSchema.optional().describe(
+ SecretRotations.PARAMETERS.STRIPE_API_KEY.permissions
+ ),
+ connectPermissions: StripeApiKeyPermissionListSchema.optional().describe(
+ SecretRotations.PARAMETERS.STRIPE_API_KEY.connectPermissions
+ )
+ })
+ .superRefine((parameters, ctx) => {
+ if (parameters.permissions?.length || parameters.connectPermissions?.length) return;
+
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["permissions"],
+ message: "At least one permission or Connect permission is required"
+ });
+ });
const StripeApiKeyRotationSecretsMappingSchema = z.object({
apiKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.STRIPE_API_KEY.apiKey)
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index a4a5e8ab3e..c2be2a427e 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -3653,7 +3653,7 @@ export const SecretRotations = {
permissions:
"The permissions granted to the generated Stripe API key. Stripe has no wildcard permission, so this is the full list of what the key may do.",
connectPermissions:
- "The permissions the generated Stripe API key has over connected accounts. Only meaningful when the account is a Connect platform."
+ "The permissions that the generated Stripe API key has over connected accounts. If your Stripe account is not a Connect platform account, you cannot configure Connect permissions for the key."
}
},
SECRETS_MAPPING: {
diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.ts
index 1de333ddcd..038d0f7323 100644
--- a/backend/src/lib/config/env.ts
+++ b/backend/src/lib/config/env.ts
@@ -1141,7 +1141,7 @@ export const overwriteSchema: {
{
key: "INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL",
description:
- "The OAuth install link for your Stripe app, copied from the Stripe dashboard. Stripe issues a different link per mode, and the link must match the mode of the secret key below."
+ "Optional. Overrides the Stripe App Marketplace install link, which is otherwise derived from the Client ID above. Set it to the test-mode or sandbox link from the Stripe dashboard when the secret key below is not a live-mode key."
},
{
key: "INF_APP_CONNECTION_STRIPE_SECRET_KEY",
diff --git a/backend/src/server/routes/v1/app-connection-routers/stripe-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/stripe-connection-router.ts
index ab1b270292..8df2bf4849 100644
--- a/backend/src/server/routes/v1/app-connection-routers/stripe-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/stripe-connection-router.ts
@@ -35,8 +35,6 @@ export const registerStripeConnectionRouter = async (server: FastifyZodProvider)
}),
response: {
200: z.object({
- // An allowlist, deliberately. Stripe's own list response carries every key's plaintext
- // secret, so a passthrough schema here would ship them to the browser.
apiKeys: z
.object({
id: z.string(),
diff --git a/backend/src/services/app-connection/stripe/stripe-connection-fns.ts b/backend/src/services/app-connection/stripe/stripe-connection-fns.ts
index fd84a3853b..c1343700e0 100644
--- a/backend/src/services/app-connection/stripe/stripe-connection-fns.ts
+++ b/backend/src/services/app-connection/stripe/stripe-connection-fns.ts
@@ -8,7 +8,7 @@ import { IntegrationUrls } from "@app/services/integration-auth/integration-list
import { StripeConnectionMethod } from "./stripe-connection-enums";
import {
- getStripePlatformRequestConfig,
+ getStripeAppRequestConfig,
getStripeSecretKey,
STRIPE_API_KEYS_URL,
throwStripeApiKeyManagementError
@@ -29,9 +29,10 @@ export const getStripeConnectionListItem = () => {
app: AppConnection.Stripe as const,
methods: Object.values(StripeConnectionMethod) as [StripeConnectionMethod.OAuth],
oauthClientId: INF_APP_CONNECTION_STRIPE_OAUTH_CLIENT_ID,
- // Stripe embeds a per-app, per-mode channel link ID in the install URL path, so it cannot be
- // derived from the client ID and has to be copied out of the Stripe dashboard.
- oauthAuthorizeUrl: INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL
+ // A published app's install link is the marketplace URL plus the client ID, which the frontend
+ // appends along with the redirect URI it is actually on. Only the test-mode and sandbox links
+ // are per-app strings out of the Stripe dashboard, so those are the override.
+ oauthAuthorizeUrl: INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL || IntegrationUrls.STRIPE_APP_AUTHORIZE_URL
};
};
@@ -81,7 +82,7 @@ const exchangeStripeOAuthCode = async (code: string): Promise<string> => {
*/
const assertCanManageApiKeys = async (accountId: string) => {
try {
- await request.get(STRIPE_API_KEYS_URL, getStripePlatformRequestConfig(accountId));
+ await request.get(STRIPE_API_KEYS_URL, getStripeAppRequestConfig(accountId));
} catch (error) {
throwStripeApiKeyManagementError(accountId, error);
}
diff --git a/backend/src/services/app-connection/stripe/stripe-connection-public-client.test.ts b/backend/src/services/app-connection/stripe/stripe-connection-public-client.test.ts
index 6427918a5e..9aed4df7b6 100644
--- a/backend/src/services/app-connection/stripe/stripe-connection-public-client.test.ts
+++ b/backend/src/services/app-connection/stripe/stripe-connection-public-client.test.ts
@@ -3,7 +3,7 @@ import RE2 from "re2";
import { describe, expect, it, vi } from "vitest";
vi.mock("@app/lib/config/env", () => ({
- getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_platform" })
+ getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_app" })
}));
// eslint-disable-next-line import/first
@@ -11,10 +11,10 @@ import { InternalServerError } from "@app/lib/errors";
// eslint-disable-next-line import/first
import {
+ getStripeAppRequestConfig,
getStripeErrorMessage,
getStripeErrorStatus,
getStripeMerchantRequestConfig,
- getStripePlatformRequestConfig,
STRIPE_PREVIEW_API_VERSION,
throwStripeApiKeyManagementError,
withIdempotencyKey
@@ -33,11 +33,11 @@ const axiosErrorWith = (status: number, data: unknown) =>
});
describe("stripe public client", () => {
- it("authenticates as the platform and names the account", () => {
- const config = getStripePlatformRequestConfig("acct_123");
+ it("authenticates as the app and names the account", () => {
+ const config = getStripeAppRequestConfig("acct_123");
- expect(config.auth).toEqual({ username: "sk_test_platform", password: "" });
expect(config.headers).toEqual({
+ Authorization: "Bearer sk_test_app",
"Stripe-Version": STRIPE_PREVIEW_API_VERSION,
"Stripe-Context": "acct_123"
});
@@ -46,12 +46,11 @@ describe("stripe public client", () => {
it("authenticates as a merchant key without context or preview version", () => {
const config = getStripeMerchantRequestConfig("rk_test_merchant");
- expect(config.auth).toEqual({ username: "rk_test_merchant", password: "" });
- expect(config.headers).toBeUndefined();
+ expect(config.headers).toEqual({ Authorization: "Bearer rk_test_merchant" });
});
it("adds an idempotency key without dropping existing headers", () => {
- const config = withIdempotencyKey(getStripePlatformRequestConfig("acct_123"));
+ const config = withIdempotencyKey(getStripeAppRequestConfig("acct_123"));
const idempotencyKey = config.headers?.["Idempotency-Key"] as string;
expect(config.headers?.["Stripe-Context"]).toBe("acct_123");
diff --git a/backend/src/services/app-connection/stripe/stripe-connection-public-client.ts b/backend/src/services/app-connection/stripe/stripe-connection-public-client.ts
index 93dedc7e32..d4f541dc63 100644
--- a/backend/src/services/app-connection/stripe/stripe-connection-public-client.ts
+++ b/backend/src/services/app-connection/stripe/stripe-connection-public-client.ts
@@ -26,18 +26,18 @@ export const getStripeSecretKey = () => {
return INF_APP_CONNECTION_STRIPE_SECRET_KEY;
};
-/** Infisical acting on a customer's account: our own key, with Stripe-Context naming the account. */
-export const getStripePlatformRequestConfig = (accountId: string): AxiosRequestConfig => ({
- auth: { username: getStripeSecretKey(), password: "" },
+/** The Infisical Stripe App acting on a customer's account, named by Stripe-Context. */
+export const getStripeAppRequestConfig = (accountId: string): AxiosRequestConfig => ({
headers: {
+ Authorization: `Bearer ${getStripeSecretKey()}`,
"Stripe-Version": STRIPE_PREVIEW_API_VERSION,
"Stripe-Context": accountId
}
});
-/** A rotated merchant key acting as itself. It is not the platform, so it carries neither header. */
+/** A rotated merchant key acting as itself, so it carries neither of the app's headers. */
export const getStripeMerchantRequestConfig = (apiKey: string): AxiosRequestConfig => ({
- auth: { username: apiKey, password: "" }
+ headers: { Authorization: `Bearer ${apiKey}` }
});
export const withIdempotencyKey = (config: AxiosRequestConfig): AxiosRequestConfig => ({
@@ -63,7 +63,7 @@ export const getStripeErrorStatus = (error: unknown): number | undefined =>
* tokens, so it arrives here as a 403. The remedy is offered conditionally rather than asserted.
*
* Only an Axios error is actually a response from Stripe. Anything else, eg a local
- * misconfiguration like a missing platform key, gets rethrown as itself rather than reworded into
+ * misconfiguration like a missing app key, gets rethrown as itself rather than reworded into
* a message that blames Stripe or the installed app for something neither caused.
*/
export const throwStripeApiKeyManagementError = (accountId: string, error: unknown): never => {
@@ -109,7 +109,7 @@ const sanitizeApiKeyListItem = (item: TStripeApiKeyListItem): TStripeApiKeyListI
});
export const listStripeApiKeys = async (accountId: string): Promise<TStripeApiKeyListItem[]> => {
- const config = getStripePlatformRequestConfig(accountId);
+ const config = getStripeAppRequestConfig(accountId);
const keys: TStripeApiKeyListItem[] = [];
let url: string | undefined = `${STRIPE_API_KEYS_URL}?limit=${STRIPE_LIST_PAGE_SIZE}`;
@@ -127,9 +127,9 @@ export const listStripeApiKeys = async (accountId: string): Promise<TStripeApiKe
const nextPageUrl = response.data?.next_page_url ?? undefined;
- // config.auth carries our platform key, which can act on every connected Stripe account, not a
- // per-connection token. This must be checked before that credential goes out on the next request,
- // never after, since next_page_url comes from the response body Stripe controls.
+ // config carries the app's own key, which can act on every account the app is installed on, not
+ // a per-connection token. This must be checked before that credential goes out on the next
+ // request, never after, since next_page_url comes from the response body Stripe controls.
if (nextPageUrl && !nextPageUrl.startsWith(STRIPE_API_KEYS_URL)) {
logger.error(
`listStripeApiKeys: next_page_url for account ${accountId} did not point at the Stripe API keys endpoint, stopped paginating`
diff --git a/backend/src/services/app-connection/stripe/stripe-connection-service.test.ts b/backend/src/services/app-connection/stripe/stripe-connection-service.test.ts
index 9bcffa3548..aa7543cc90 100644
--- a/backend/src/services/app-connection/stripe/stripe-connection-service.test.ts
+++ b/backend/src/services/app-connection/stripe/stripe-connection-service.test.ts
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest";
const { getMock } = vi.hoisted(() => ({ getMock: vi.fn() }));
vi.mock("@app/lib/config/env", () => ({
- getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_platform" })
+ getConfig: () => ({ INF_APP_CONNECTION_STRIPE_SECRET_KEY: "sk_test_app" })
}));
vi.mock("@app/lib/config/request", () => ({
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call
@@ -13,9 +13,6 @@ vi.mock("@app/lib/logger", () => ({
logger: { error: vi.fn(), info: vi.fn(), warn: vi.fn(), debug: vi.fn() }
}));
-// eslint-disable-next-line import/first
-import { AppConnection } from "@app/services/app-connection/app-connection-enums";
-
// eslint-disable-next-line import/first
import { stripeConnectionService } from "./stripe-connection-service";
@@ -78,7 +75,7 @@ describe("stripeConnectionService.listApiKeys", () => {
expect(getMock.mock.calls[1][0]).toBe("https://api.stripe.com/v2/iam/api_keys?page=2");
});
- it("never sends the platform credential to a next_page_url outside the Stripe API keys endpoint", async () => {
+ it("never sends the app credential to a next_page_url outside the Stripe API keys endpoint", async () => {
getMock.mockResolvedValueOnce(keyPage("mk_1", "https://evil.example.com/v2/iam/api_keys?page=2"));
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
@@ -87,15 +84,4 @@ describe("stripeConnectionService.listApiKeys", () => {
expect(keys.map((key) => key.id)).toEqual(["mk_1"]);
expect(getMock).toHaveBeenCalledTimes(1);
});
-
- it("authorizes the caller for this connection before reaching Stripe", async () => {
- getMock.mockResolvedValueOnce(keyPage("mk_1"));
- const getAppConnection = vi.fn(async () => ({ credentials: { accountId: "acct_123" } }));
- const actor = { type: "user", id: "user-1", authMethod: "email", orgId: "org-1" };
-
- // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-argument
- await stripeConnectionService(getAppConnection as any).listApiKeys("connection-id", actor as any);
-
- expect(getAppConnection).toHaveBeenCalledWith(AppConnection.Stripe, "connection-id", actor);
- });
});
diff --git a/backend/src/services/integration-auth/integration-list.ts b/backend/src/services/integration-auth/integration-list.ts
index e3c0aaeaa2..07c337c6ec 100644
--- a/backend/src/services/integration-auth/integration-list.ts
+++ b/backend/src/services/integration-auth/integration-list.ts
@@ -65,6 +65,7 @@ export enum IntegrationUrls {
BITBUCKET_TOKEN_URL = "https://bitbucket.org/site/oauth2/access_token",
CAMUNDA_TOKEN_URL = "https://login.cloud.camunda.io/oauth/token",
STRIPE_TOKEN_URL = "https://api.stripe.com/v1/oauth/token",
+ STRIPE_APP_AUTHORIZE_URL = "https://marketplace.stripe.com/oauth/v2/authorize",
// integration apps endpoints
GCP_API_URL = "https://cloudresourcemanager.googleapis.com",
diff --git a/docs/api-reference/endpoints/app-connections/stripe/available.mdx b/docs/api-reference/endpoints/app-connections/stripe/available.mdx
new file mode 100644
index 0000000000..ab2b937132
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/available.mdx
@@ -0,0 +1,4 @@
+---
+title: "Available"
+openapi: "GET /api/v1/app-connections/stripe/available"
+---
diff --git a/docs/api-reference/endpoints/app-connections/stripe/create.mdx b/docs/api-reference/endpoints/app-connections/stripe/create.mdx
new file mode 100644
index 0000000000..67bdcb6ab3
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/create.mdx
@@ -0,0 +1,10 @@
+---
+title: "Create"
+openapi: "POST /api/v1/app-connections/stripe"
+---
+
+<Note>
+ Stripe Connections must be created through the Infisical UI.
+ Check out the configuration docs for [Stripe Connections](/integrations/app-connections/stripe) for a step-by-step
+ guide.
+</Note>
diff --git a/docs/api-reference/endpoints/app-connections/stripe/delete.mdx b/docs/api-reference/endpoints/app-connections/stripe/delete.mdx
new file mode 100644
index 0000000000..87c65b669d
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/delete.mdx
@@ -0,0 +1,4 @@
+---
+title: "Delete"
+openapi: "DELETE /api/v1/app-connections/stripe/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/stripe/get-by-id.mdx b/docs/api-reference/endpoints/app-connections/stripe/get-by-id.mdx
new file mode 100644
index 0000000000..cfcbefe9c4
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/get-by-id.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by ID"
+openapi: "GET /api/v1/app-connections/stripe/{connectionId}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/stripe/get-by-name.mdx b/docs/api-reference/endpoints/app-connections/stripe/get-by-name.mdx
new file mode 100644
index 0000000000..7ed0453a6d
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/get-by-name.mdx
@@ -0,0 +1,4 @@
+---
+title: "Get by name"
+openapi: "GET /api/v1/app-connections/stripe/connection-name/{connectionName}"
+---
diff --git a/docs/api-reference/endpoints/app-connections/stripe/list.mdx b/docs/api-reference/endpoints/app-connections/stripe/list.mdx
new file mode 100644
index 0000000000..02314c6950
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/list.mdx
@@ -0,0 +1,4 @@
+---
+title: "List"
+openapi: "GET /api/v1/app-connections/stripe"
+---
diff --git a/docs/api-reference/endpoints/app-connections/stripe/update.mdx b/docs/api-reference/endpoints/app-connections/stripe/update.mdx
new file mode 100644
index 0000000000..286c153b06
--- /dev/null
+++ b/docs/api-reference/endpoints/app-connections/stripe/update.mdx
@@ -0,0 +1,10 @@
+---
+title: "Update"
+openapi: "PATCH /api/v1/app-connections/stripe/{connectionId}"
+---
+
+<Note>
+ Stripe Connections must be updated through the Infisical UI.
+ Check out the configuration docs for [Stripe Connections](/integrations/app-connections/stripe) for a step-by-step
+ guide.
+</Note>
diff --git a/docs/api-reference/endpoints/secret-rotations/stripe-api-key/create.mdx b/docs/api-reference/endpoints/secret-rotations/stripe-api-key/create.mdx
index b25db1bbca..1f902ab5d1 100644
--- a/docs/api-reference/endpoints/secret-rotations/stripe-api-key/create.mdx
+++ b/docs/api-reference/endpoints/secret-rotations/stripe-api-key/create.mdx
@@ -4,74 +4,6 @@ openapi: "POST /api/v2/secret-rotations/stripe-api-key"
---
<Note>
- Check out the configuration docs for [Stripe API Key Rotations](/documentation/platform/secret-rotation/stripe-api-key) to learn how to obtain the required parameters.
+ Check out the configuration docs for [Stripe API Key Rotations](/documentation/platform/secret-rotation/stripe-api-key) to learn how to obtain the
+ required parameters.
</Note>
-
-Creates a Stripe API key secret rotation. Infisical will create and expire restricted API keys via your [Stripe connection](/integrations/app-connections/stripe) and write them to the specified secret path.
-
-## Request body
-
-| Field | Type | Required | Description |
-|-------|------|----------|-------------|
-| `name` | string | Yes | A unique name for the rotation (max 100 characters). |
-| `projectId` | string (UUID) | Yes | The project ID. |
-| `connectionId` | string (UUID) | Yes | ID of the Stripe app connection. |
-| `environment` | string | Yes | Environment slug (e.g. `dev`, `prod`). |
-| `secretPath` | string | Yes | Path where the generated API key secret will be stored. |
-| `isAutoRotationEnabled` | boolean | No | Whether to rotate automatically on the schedule. Defaults to `true`. |
-| `rotationInterval` | number | Yes | Days between rotations (minimum `1`). |
-| `rotateAtUtc` | object | No | Time of day (UTC) to run rotation: `{ "hours", "minutes" }`. Defaults to `{ "hours": 0, "minutes": 0 }`. |
-| `parameters.permissions` | string[] | Yes | The permissions granted to the generated restricted key. At least one is required. Stripe has no wildcard for full access, so granting every permission means listing all of them. |
-| `parameters.connectPermissions` | string[] | No | The permissions the generated key holds when acting on behalf of a connected account. Only relevant if your Stripe account is a Connect platform. |
-| `secretsMapping.apiKey` | string | Yes | Secret key name to store the generated restricted key's value (e.g. `STRIPE_API_KEY`). |
-| `description` | string | No | Optional description. |
-
-## Sample request
-
-```bash
-curl --request POST \
- --url https://us.infisical.com/api/v2/secret-rotations/stripe-api-key \
- --header 'Content-Type: application/json' \
- --header 'Authorization: Bearer <ACCESS_TOKEN>' \
- --data '{
- "name": "my-stripe-rotation",
- "projectId": "<project-id>",
- "description": "Stripe API key rotation",
- "connectionId": "<stripe-connection-id>",
- "environment": "dev",
- "secretPath": "/",
- "isAutoRotationEnabled": true,
- "rotationInterval": 30,
- "rotateAtUtc": { "hours": 0, "minutes": 0 },
- "parameters": {
- "permissions": ["charge_read", "charge_write", "customer_read", "customer_write"]
- },
- "secretsMapping": {
- "apiKey": "STRIPE_API_KEY"
- }
- }'
-```
-
-## Sample response
-
-```json
-{
- "secretRotation": {
- "id": "<rotation-id>",
- "name": "my-stripe-rotation",
- "description": "Stripe API key rotation",
- "secretsMapping": {
- "apiKey": "STRIPE_API_KEY"
- },
- "isAutoRotationEnabled": true,
- "activeIndex": 0,
- "connectionId": "<stripe-connection-id>",
- "rotationInterval": 30,
- "rotateAtUtc": { "hours": 0, "minutes": 0 },
- "type": "stripe-api-key",
- "parameters": {
- "permissions": ["charge_read", "charge_write", "customer_read", "customer_write"]
- }
- }
-}
-```
diff --git a/docs/docs.json b/docs/docs.json
index c349f612a0..ae0e70a7a9 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -2392,6 +2392,18 @@
"api-reference/endpoints/app-connections/salesforce/delete"
]
},
+ {
+ "group": "Stripe",
+ "pages": [
+ "api-reference/endpoints/app-connections/stripe/list",
+ "api-reference/endpoints/app-connections/stripe/available",
+ "api-reference/endpoints/app-connections/stripe/get-by-id",
+ "api-reference/endpoints/app-connections/stripe/get-by-name",
+ "api-reference/endpoints/app-connections/stripe/create",
+ "api-reference/endpoints/app-connections/stripe/update",
+ "api-reference/endpoints/app-connections/stripe/delete"
+ ]
+ },
{
"group": "Supabase",
"pages": [
diff --git a/docs/documentation/platform/secret-rotation/stripe-api-key.mdx b/docs/documentation/platform/secret-rotation/stripe-api-key.mdx
index 1f7e3ffec6..06875cbe24 100644
--- a/docs/documentation/platform/secret-rotation/stripe-api-key.mdx
+++ b/docs/documentation/platform/secret-rotation/stripe-api-key.mdx
@@ -11,7 +11,6 @@ description: "Learn how to automatically rotate Stripe restricted API keys."
Stripe API key rotation mints a new [restricted key](https://docs.stripe.com/keys#limit-access-with-restricted-api-keys) on the interval you set, so your applications always have a working credential without a manual key swap. A few things about how it behaves are worth knowing before you set it up.
-- **The minted key's mode follows your Stripe account's own key.** If your Stripe account is in test mode, every key this rotation generates is a test-mode key. Your account decides the mode; the rotation doesn't, and there's no setting to override it.
- **The generated value is a restricted key (`rk_...`), never a secret key (`sk_...`).** If anything downstream checks the credential's prefix, check it against `rk_`.
- **Infisical never touches the key you already have.** Rotation only creates and retires the keys it generates itself. Your original Stripe key keeps working until you manually delete it in the Stripe dashboard, once you've confirmed your applications are reading the rotated secret.
- **Retiring a key doesn't kill it instantly.** When a key is due for retirement, Infisical expires it through Stripe, but Stripe decides when that expiration takes effect. A retired key can keep authenticating requests for a short window afterward, so don't build anything that assumes the old key stops working the moment rotation runs.
diff --git a/docs/integrations/app-connections/stripe.mdx b/docs/integrations/app-connections/stripe.mdx
index 774b989135..fcc7394d12 100644
--- a/docs/integrations/app-connections/stripe.mdx
+++ b/docs/integrations/app-connections/stripe.mdx
@@ -36,14 +36,15 @@ Infisical supports connecting to Stripe through an installed Stripe App, so it c
</Note>
</Step>
<Step title="Add your Stripe App credentials to Infisical">
- From the Stripe dashboard, collect your app's **Client ID** and its **OAuth install link**, and the **secret key** of the Stripe account that owns the app.
+ From the Stripe dashboard, collect your app's **Client ID** and the **secret key** of the Stripe account that owns the app.
Set the following environment variables on your Infisical instance:
- `INF_APP_CONNECTION_STRIPE_OAUTH_CLIENT_ID`: The Client ID of your Stripe App.
- - `INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL`: The OAuth install link for your Stripe App, copied from the Stripe dashboard. Stripe issues a different link per mode, and it must match the mode of the secret key below.
- `INF_APP_CONNECTION_STRIPE_SECRET_KEY`: The secret key of the Stripe account that owns your Stripe App. Infisical authenticates as this account when it manages keys on a connected account's behalf.
+ Infisical builds the install link from the Client ID, so a published app needs nothing further. If your secret key is a test-mode or sandbox key, copy that mode's install link from the Stripe dashboard and set it as `INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL`.
+
Restart your instance once these are set.
</Step>
</Steps>
diff --git a/docs/self-hosting/configuration/envars.mdx b/docs/self-hosting/configuration/envars.mdx
index 8a1356d11b..182639bf7e 100644
--- a/docs/self-hosting/configuration/envars.mdx
+++ b/docs/self-hosting/configuration/envars.mdx
@@ -130,12 +130,14 @@ Example values:
Defaults to `false` so an operator-configured forward proxy keeps working.
+{/* vale Infisical.Contractions = NO */}
<Note>
- Enable this only if your instance **doesn't** rely on an outbound
+ Enable this only if your instance does **not** rely on an outbound
`HTTP_PROXY` / `HTTPS_PROXY` for egress. When a proxy is in use, the IP pin
can't extend past the proxy (the proxy resolves the target itself), so
leaving this off is the correct choice for proxied deployments.
</Note>
+{/* vale Infisical.Contractions = YES */}
</ParamField>
<ParamField
@@ -280,12 +282,14 @@ your own `psql` sessions. If you're close to the limit, **lower `DB_POOL_MAX`**
connections wastes it. If instead you see queries queueing while your database is idle, the pool is too small
and raising it is the right move.
+{/* vale Infisical.Contractions = NO */}
<Tip>
Prefer scaling reads with `DB_READ_REPLICAS` over enlarging the primary pool. A connection pooler such as
PgBouncer or RDS Proxy is only worth the extra hop and failure domain once instance count alone pushes you
- near `max_connections`, and note that a pooler in transaction mode **doesn't** reclaim connections held
+ near `max_connections`, and note that a pooler in transaction mode does **not** reclaim connections held
open inside a transaction.
</Tip>
+{/* vale Infisical.Contractions = YES */}
<ParamField query="DB_POOL_MIN" type="int" default="0" optional>
Minimum connections kept open in the primary database pool. `0` lets idle connections close, which is
@@ -966,7 +970,7 @@ You can configure third-party app connections for re-use across Infisical Projec
</ParamField>
<ParamField query="INF_APP_CONNECTION_STRIPE_OAUTH_AUTHORIZE_URL" type="string" default="none" optional>
- The OAuth install link for your Stripe App, copied from the Stripe dashboard. Stripe issues a different link per mode, so make sure it matches the mode of the secret key below.
+ Overrides the install link, which is otherwise derived from the Client ID above. Set it to the test-mode or sandbox link from the Stripe dashboard when the secret key below is not a live-mode key.
</ParamField>
<ParamField query="INF_APP_CONNECTION_STRIPE_SECRET_KEY" type="string" default="none" optional>
diff --git a/docs/snippets/AppConnectionsBrowser.jsx b/docs/snippets/AppConnectionsBrowser.jsx
index 96557c813c..55ba688397 100644
--- a/docs/snippets/AppConnectionsBrowser.jsx
+++ b/docs/snippets/AppConnectionsBrowser.jsx
@@ -650,6 +650,14 @@ export const AppConnectionsBrowser = () => {
description: "Learn how to connect OpenAI to manage and rotate API keys with Infisical.",
category: "AI & LLM",
},
+ {
+ name: "Stripe",
+ slug: "stripe",
+ path: "/integrations/app-connections/stripe",
+ description:
+ "Learn how to connect Stripe to manage and rotate API keys with Infisical.",
+ category: "SaaS",
+ },
{
name: "Spacelift",
slug: "spacelift",
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/StripeApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/StripeApiKeyRotationReviewFields.tsx
index 985fd35772..f43bec0d54 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/StripeApiKeyRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/StripeApiKeyRotationReviewFields.tsx
@@ -31,9 +31,11 @@ export const StripeApiKeyRotationReviewFields = () => {
return (
<>
<SecretRotationReviewSection label="Parameters">
- <ReviewField label="Permissions">
- {summarizePermissions(parameters.permissions)}
- </ReviewField>
+ {Boolean(parameters.permissions?.length) && (
+ <ReviewField label="Permissions">
+ {summarizePermissions(parameters.permissions ?? [])}
+ </ReviewField>
+ )}
{Boolean(parameters.connectPermissions?.length) && (
<ReviewField label="Connect Permissions">
{summarizePermissions(parameters.connectPermissions ?? [])}
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/stripe-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/stripe-api-key-rotation-schema.ts
index afbd82114f..af4d703c4d 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/stripe-api-key-rotation-schema.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/stripe-api-key-rotation-schema.ts
@@ -6,10 +6,20 @@ import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
export const StripeApiKeyRotationSchema = z
.object({
type: z.literal(SecretRotation.StripeApiKey),
- parameters: z.object({
- permissions: z.string().trim().array().min(1, "At least one permission is required"),
- connectPermissions: z.string().trim().array().optional()
- }),
+ parameters: z
+ .object({
+ permissions: z.string().trim().array().optional(),
+ connectPermissions: z.string().trim().array().optional()
+ })
+ .superRefine((parameters, ctx) => {
+ if (parameters.permissions?.length || parameters.connectPermissions?.length) return;
+
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ path: ["permissions"],
+ message: "At least one permission or Connect permission is required"
+ });
+ }),
secretsMapping: z.object({
apiKey: z.string().trim().min(1, "API Key secret name required")
})
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/stripe-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/stripe-api-key-rotation.ts
index 44ae0eb8d9..a7d6d1a190 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/stripe-api-key-rotation.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/stripe-api-key-rotation.ts
@@ -8,7 +8,7 @@ import {
export type TStripeApiKeyRotation = TSecretRotationV2Base & {
type: SecretRotation.StripeApiKey;
parameters: {
- permissions: string[];
+ permissions?: string[];
connectPermissions?: string[];
};
secretsMapping: {
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/StripeConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/StripeConnectionForm.tsx
index 2a3fa98740..2c5ffc72f0 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/StripeConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/StripeConnectionForm.tsx
@@ -71,7 +71,7 @@ export const StripeConnectionForm = ({ appConnection, projectId }: Props) => {
useAppConnectionFormDirtyState(isDirty);
- const isMissingConfig = !oauthClientId || !oauthAuthorizeUrl;
+ const isMissingConfig = !oauthClientId;
let submitLabel = "Connect to Stripe";
if (isRedirecting) submitLabel = "Redirecting to Stripe...";
@@ -95,9 +95,8 @@ export const StripeConnectionForm = ({ appConnection, projectId }: Props) => {
})
);
- // Stripe's install link already carries client_id and redirect_uri, so the whole link can be
- // pasted into config as-is. Setting them again keeps the redirect in step with the origin the
- // user is actually on.
+ // The redirect URI is taken from the origin the user is actually on rather than from config,
+ // so one Stripe app serves every deployment listing that origin in its manifest.
const oauthUrl = new URL(oauthAuthorizeUrl);
oauthUrl.searchParams.set("client_id", oauthClientId);
oauthUrl.searchParams.set(