Skip to content

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

fix(secret-rotation): Stripe copy-from-key control edge cases

Calvin11321064e8f4
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/StripeApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/StripeApiKeyRotationParametersFields.tsx
index 1bb064e3aa..c8d7355419 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/StripeApiKeyRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/StripeApiKeyRotationParametersFields.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { Controller, useFormContext, useWatch } from "react-hook-form";
import { createNotification } from "@app/components/notifications";
@@ -29,6 +29,12 @@ export const StripeApiKeyRotationParametersFields = () => {
// read on its own as "loading".
const isApiKeysLoading = isApiKeysPending && Boolean(connectionId);
+ // A stale selection from a previous connection is not just visually wrong: the Combobox
+ // would keep offering a key that belongs to a different Stripe account.
+ useEffect(() => {
+ setCopiedFromKey(null);
+ }, [connectionId]);
+
const permissions = useMemo(() => rotationOption?.template.permissions ?? [], [rotationOption]);
// Only keys still usable as a source: an expired or revoked key's permissions are not a
@@ -60,7 +66,7 @@ export const StripeApiKeyRotationParametersFields = () => {
if (droppedCount > 0) {
createNotification({
type: "warning",
- text: `${droppedCount} permission${droppedCount === 1 ? "" : "s"} on ${apiKey.name || apiKey.id} ${droppedCount === 1 ? "isn't" : "aren't"} recognized by Infisical and were not copied.`
+ text: `${droppedCount} permission${droppedCount === 1 ? "" : "s"} on ${apiKey.name || apiKey.id} ${droppedCount === 1 ? "isn't" : "aren't"} recognized by Infisical and ${droppedCount === 1 ? "was" : "were"} not copied.`
});
}
};
@@ -114,6 +120,7 @@ export const StripeApiKeyRotationParametersFields = () => {
searchPlaceholder="Search keys..."
searchAriaLabel="Search Stripe API keys"
isLoading={isApiKeysLoading}
+ isDisabled={isRotationOptionLoading}
/>
<FieldDescription>
Applies that key&apos;s permissions to the fields above. It does not link the rotation