Skip to content

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

UI: add support for r2 rotation

adilson79cfe20cad20
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewCloudflareR2AccessKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewCloudflareR2AccessKeyRotationGeneratedCredentials.tsx
new file mode 100644
index 0000000000..e30dbb3124
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewCloudflareR2AccessKeyRotationGeneratedCredentials.tsx
@@ -0,0 +1,48 @@
+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";
+import { TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/cloudflare-r2-access-key-rotation";
+
+import { ViewRotationGeneratedCredentialsDisplay } from "./shared";
+
+type Props = {
+ generatedCredentialsResponse: TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse;
+};
+
+export const ViewCloudflareR2AccessKeyRotationGeneratedCredentials = ({
+ generatedCredentialsResponse: { generatedCredentials, activeIndex }
+}: Props) => {
+ const inactiveIndex = activeIndex === 0 ? 1 : 0;
+
+ const activeCredentials = generatedCredentials[activeIndex];
+ const inactiveCredentials = generatedCredentials[inactiveIndex];
+
+ return (
+ <ViewRotationGeneratedCredentialsDisplay
+ activeCredentials={
+ <>
+ <CredentialDisplay label="Access Key ID">
+ {activeCredentials?.accessKeyId}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="Secret Access Key">
+ {activeCredentials?.secretAccessKey}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="API Token">
+ {activeCredentials?.apiToken}
+ </CredentialDisplay>
+ </>
+ }
+ inactiveCredentials={
+ <>
+ <CredentialDisplay label="Access Key ID">
+ {inactiveCredentials?.accessKeyId}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="Secret Access Key">
+ {inactiveCredentials?.secretAccessKey}
+ </CredentialDisplay>
+ <CredentialDisplay isSensitive label="API Token">
+ {inactiveCredentials?.apiToken}
+ </CredentialDisplay>
+ </>
+ }
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
index 642cf657bb..6132be087e 100644
--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx
@@ -25,6 +25,7 @@ import {
import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";
import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUserSecretRotationGeneratedCredentials";
import { ViewCloudflareApiTokenRotationGeneratedCredentials } from "./ViewCloudflareApiTokenRotationGeneratedCredentials";
+import { ViewCloudflareR2AccessKeyRotationGeneratedCredentials } from "./ViewCloudflareR2AccessKeyRotationGeneratedCredentials";
import { ViewDatadogApiKeyRotationGeneratedCredentials } from "./ViewDatadogApiKeyRotationGeneratedCredentials";
import { ViewDatadogApplicationKeySecretRotationGeneratedCredentials } from "./ViewDatadogApplicationKeySecretRotationGeneratedCredentials";
import { ViewDbtServiceTokenRotationGeneratedCredentials } from "./ViewDbtSeviceTokenRotationGeneratedCredentials";
@@ -244,6 +245,13 @@ const Content = ({ secretRotation }: ContentProps) => {
/>
);
break;
+ case SecretRotation.CloudflareR2AccessKey:
+ Component = (
+ <ViewCloudflareR2AccessKeyRotationGeneratedCredentials
+ generatedCredentialsResponse={generatedCredentialsResponse}
+ />
+ );
+ break;
default:
throw new Error("Unhandled View Generated Credential Rotation Type");
}
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
index b07de99e40..82625f95f2 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareApiTokenRotationParametersFields.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useMemo, useState } from "react";
+import { useEffect, useMemo } from "react";
import { Control, Controller, useFieldArray, useFormContext } from "react-hook-form";
import { MultiValue, SingleValue } from "react-select";
import { faPlus, faTrash } from "@fortawesome/free-solid-svg-icons";
@@ -18,8 +18,7 @@ import {
Tab,
TabList,
TabPanel,
- Tabs,
- TextArea
+ Tabs
} from "@app/components/v2";
import {
TCloudflarePermissionGroup,
@@ -29,7 +28,6 @@ import {
} from "@app/hooks/api/appConnections/cloudflare";
import {
- CLOUDFLARE_API_TOKEN_NAME_MAX_LENGTH,
CLOUDFLARE_POLICY_EFFECT_MAP,
CLOUDFLARE_POLICY_SCOPE_MAP,
CLOUDFLARE_POLICY_SCOPE_RESOURCE_MAP,
@@ -39,6 +37,8 @@ import {
explodePolicies,
isStoredPolicy
} from "../schemas/cloudflare-api-token-rotation-schema";
+import { CLOUDFLARE_TOKEN_NAME_MAX_LENGTH } from "../schemas/shared";
+import { CloudflareIpListInput } from "./shared";
// The schema merges policy rows into the stored shape on submit, so `TSecretRotationV2Form` (the
// schema's *output* type) describes merged policies. The fields here edit rows, which is the input side.
@@ -56,39 +56,6 @@ enum ParameterTab {
Restrictions = "restrictions"
}
-/**
- * Textarea-backed editor for a list of IPs/CIDRs. The raw text lives in local state so partially
- * typed entries and blank lines survive re-renders, while the form only ever holds the parsed list.
- */
-const IpListInput = ({
- value,
- onChange
-}: {
- value?: string[];
- onChange: (value: string[]) => void;
-}) => {
- const [rawValue, setRawValue] = useState((value ?? []).join("\n"));
-
- return (
- <TextArea
- reSize="none"
- rows={4}
- value={rawValue}
- onChange={(e) => {
- setRawValue(e.target.value);
- onChange(
- e.target.value
- .split(/[\n,]/)
- .map((entry) => entry.trim())
- .filter(Boolean)
- );
- }}
- placeholder={"199.27.128.0/21\n2400:cb00::/32"}
- className="border-mineshaft-600 bg-mineshaft-900 font-mono text-sm"
- />
- );
-};
-
const IpListField = ({
control,
name,
@@ -111,7 +78,7 @@ const IpListField = ({
label={label}
tooltipText={tooltipText}
>
- <IpListInput value={value} onChange={onChange} />
+ <CloudflareIpListInput value={value} onChange={onChange} />
</FormControl>
)}
/>
@@ -196,7 +163,7 @@ export const CloudflareApiTokenRotationParametersFields = () => {
<Input
{...field}
placeholder="infisical-rotated-token"
- maxLength={CLOUDFLARE_API_TOKEN_NAME_MAX_LENGTH}
+ maxLength={CLOUDFLARE_TOKEN_NAME_MAX_LENGTH}
/>
</FormControl>
)}
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx
new file mode 100644
index 0000000000..cf7497ebf0
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/CloudflareR2AccessKeyRotationParametersFields.tsx
@@ -0,0 +1,215 @@
+import { useEffect, useMemo } from "react";
+import { Control, Controller, useFormContext } from "react-hook-form";
+import { MultiValue } from "react-select";
+
+import {
+ FilterableSelect,
+ FormControl,
+ Input,
+ Select,
+ SelectItem,
+ Tab,
+ TabList,
+ TabPanel,
+ Tabs
+} from "@app/components/v2";
+import { useCloudflareConnectionListR2Buckets } from "@app/hooks/api/appConnections/cloudflare";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+import { TSecretRotationV2Form } from "../schemas";
+import {
+ CLOUDFLARE_R2_ACCESS_LEVEL_MAP,
+ CLOUDFLARE_R2_JURISDICTION_MAP,
+ CloudflareR2AccessLevel,
+ r2BucketKey,
+ TCloudflareR2BucketSelection
+} from "../schemas/cloudflare-r2-access-key-rotation-schema";
+import { CLOUDFLARE_TOKEN_NAME_MAX_LENGTH } from "../schemas/shared";
+import { CloudflareIpListInput } from "./shared";
+
+type TCloudflareR2AccessKeyForm = TSecretRotationV2Form & {
+ type: SecretRotation.CloudflareR2AccessKey;
+};
+
+enum ParameterTab {
+ General = "general",
+ Restrictions = "restrictions"
+}
+
+const formatBucketOptionLabel = ({ name, jurisdiction }: TCloudflareR2BucketSelection) => (
+ <span>
+ {name}{" "}
+ <span className="text-mineshaft-400">{CLOUDFLARE_R2_JURISDICTION_MAP[jurisdiction]}</span>{" "}
+ </span>
+);
+
+// react-select filters on this, so it has to cover the jurisdiction the option renders too
+const getBucketSearchLabel = ({ name, jurisdiction }: TCloudflareR2BucketSelection) =>
+ `${CLOUDFLARE_R2_JURISDICTION_MAP[jurisdiction]} ${name}`;
+
+const IpListField = ({
+ control,
+ name,
+ label,
+ tooltipText
+}: {
+ control: Control<TCloudflareR2AccessKeyForm>;
+ name: "parameters.allowedIps" | "parameters.disallowedIps";
+ label: string;
+ tooltipText: string;
+}) => (
+ <Controller
+ control={control}
+ name={name}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isOptional
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label={label}
+ tooltipText={tooltipText}
+ >
+ <CloudflareIpListInput value={value} onChange={onChange} />
+ </FormControl>
+ )}
+ />
+);
+
+export const CloudflareR2AccessKeyRotationParametersFields = () => {
+ const { control, watch, setValue, getValues } = useFormContext<TCloudflareR2AccessKeyForm>();
+
+ const connectionId = watch("connection.id");
+ const selectedBuckets = watch("parameters.buckets");
+
+ // The rotation template only seeds the secrets mapping, so pick the least-privileged access level on
+ // create rather than leaving the select empty.
+ useEffect(() => {
+ if (!getValues("parameters.accessLevel")) {
+ setValue("parameters.accessLevel", CloudflareR2AccessLevel.ObjectRead);
+ }
+ }, []);
+
+ const { data: buckets, isPending: isBucketsPending } = useCloudflareConnectionListR2Buckets(
+ connectionId,
+ { enabled: Boolean(connectionId) }
+ );
+
+ // A bucket stored on the rotation but no longer returned by Cloudflare (renamed or deleted) is kept
+ // in the options so editing the rotation cannot silently drop it from the token's policy.
+ const bucketOptions = useMemo<TCloudflareR2BucketSelection[]>(() => {
+ const fetched = buckets ?? [];
+ const fetchedKeys = new Set(fetched.map(r2BucketKey));
+
+ const orphans = (selectedBuckets ?? []).filter(
+ (selection) => !fetchedKeys.has(r2BucketKey(selection))
+ );
+
+ return [...fetched, ...orphans];
+ }, [buckets, selectedBuckets]);
+
+ return (
+ <Tabs defaultValue={ParameterTab.General}>
+ <TabList>
+ <Tab value={ParameterTab.General}>General</Tab>
+ <Tab value={ParameterTab.Restrictions}>Restrictions</Tab>
+ </TabList>
+ <TabPanel value={ParameterTab.General}>
+ <Controller
+ control={control}
+ name="parameters.name"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Token Name"
+ tooltipText="The name for the generated Cloudflare API token that backs the access key. A timestamp is appended so each rotated key is distinct."
+ >
+ <Input
+ {...field}
+ placeholder="infisical-r2-access-key"
+ maxLength={CLOUDFLARE_TOKEN_NAME_MAX_LENGTH}
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.buckets"
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Buckets"
+ tooltipText="The R2 buckets the generated access key can act on. Buckets are granted by name, so renaming one in Cloudflare requires updating this rotation."
+ >
+ <FilterableSelect
+ isMulti
+ isLoading={isBucketsPending && Boolean(connectionId)}
+ isDisabled={!connectionId}
+ options={bucketOptions}
+ placeholder="Select buckets..."
+ formatOptionLabel={formatBucketOptionLabel}
+ getOptionLabel={getBucketSearchLabel}
+ getOptionValue={r2BucketKey}
+ value={
+ value
+ ? bucketOptions.filter((bucket) =>
+ value.some((selection) => r2BucketKey(selection) === r2BucketKey(bucket))
+ )
+ : []
+ }
+ // narrowed to the two identifying fields so listing-only metadata is never persisted
+ onChange={(option) =>
+ onChange(
+ (option as MultiValue<TCloudflareR2BucketSelection>).map(
+ ({ name, jurisdiction }) => ({ name, jurisdiction })
+ )
+ )
+ }
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ control={control}
+ name="parameters.accessLevel"
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error?.message)}
+ errorText={error?.message}
+ label="Access Level"
+ tooltipText="What the generated key can do on the selected buckets. Read only allows get and list; Read & Write also allows put and delete."
+ >
+ <Select
+ className="w-full"
+ position="popper"
+ value={field.value}
+ onValueChange={field.onChange}
+ >
+ {Object.entries(CLOUDFLARE_R2_ACCESS_LEVEL_MAP).map(([accessLevel, label]) => (
+ <SelectItem key={accessLevel} value={accessLevel}>
+ {label}
+ </SelectItem>
+ ))}
+ </Select>
+ </FormControl>
+ )}
+ />
+ </TabPanel>
+ <TabPanel value={ParameterTab.Restrictions}>
+ <IpListField
+ control={control}
+ name="parameters.allowedIps"
+ label="Allowed IPs"
+ tooltipText="The generated access key can only be used from these IP addresses or CIDR blocks. One entry per line. Leave empty to allow any IP."
+ />
+ <IpListField
+ control={control}
+ name="parameters.disallowedIps"
+ label="Disallowed IPs"
+ tooltipText="The generated access key cannot be used from these IP addresses or CIDR blocks. One entry per line."
+ />
+ </TabPanel>
+ </Tabs>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
index 7617ce30f9..a004260763 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx
@@ -7,6 +7,7 @@ import { Auth0ClientSecretRotationParametersFields } from "./Auth0ClientSecretRo
import { AwsIamUserSecretRotationParametersFields } from "./AwsIamUserSecretRotationParametersFields";
import { AzureClientSecretRotationParametersFields } from "./AzureClientSecretRotationParametersFields";
import { CloudflareApiTokenRotationParametersFields } from "./CloudflareApiTokenRotationParametersFields";
+import { CloudflareR2AccessKeyRotationParametersFields } from "./CloudflareR2AccessKeyRotationParametersFields";
import { ConvexAccessKeyRotationParametersFields } from "./ConvexAccessKeyRotationParametersFields";
import { DatabricksServicePrincipalSecretRotationParametersFields } from "./DatabricksServicePrincipalSecretRotationParametersFields";
import { DatadogApiKeyRotationParametersFields } from "./DatadogApiKeyRotationParametersFields";
@@ -56,7 +57,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationParametersFields,
[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationParametersFields,
[SecretRotation.SnowflakeUserKeyPair]: SnowflakeUserKeyPairRotationParametersFields,
- [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationParametersFields
+ [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationParametersFields,
+ [SecretRotation.CloudflareR2AccessKey]: CloudflareR2AccessKeyRotationParametersFields
};
export const SecretRotationV2ParametersFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx
new file mode 100644
index 0000000000..de62882e2e
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/CloudflareIpListInput.tsx
@@ -0,0 +1,36 @@
+import { useState } from "react";
+
+import { TextArea } from "@app/components/v2";
+
+/**
+ * Textarea-backed editor for a list of IPs/CIDRs. The raw text lives in local state so partially
+ * typed entries and blank lines survive re-renders, while the form only ever holds the parsed list.
+ */
+export const CloudflareIpListInput = ({
+ value,
+ onChange
+}: {
+ value?: string[];
+ onChange: (value: string[]) => void;
+}) => {
+ const [rawValue, setRawValue] = useState((value ?? []).join("\n"));
+
+ return (
+ <TextArea
+ reSize="none"
+ rows={4}
+ value={rawValue}
+ onChange={(e) => {
+ setRawValue(e.target.value);
+ onChange(
+ e.target.value
+ .split(/[\n,]/)
+ .map((entry) => entry.trim())
+ .filter(Boolean)
+ );
+ }}
+ placeholder={"199.27.128.0/21\n2400:cb00::/32"}
+ className="border-mineshaft-600 bg-mineshaft-900 font-mono text-sm"
+ />
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
index d8284a28cd..e99df7e026 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/shared/index.ts
@@ -1 +1,2 @@
+export * from "./CloudflareIpListInput";
export * from "./SqlCredentialsRotationParametersFields";
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx
new file mode 100644
index 0000000000..f86c6fe6dd
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/CloudflareR2AccessKeyRotationReviewFields.tsx
@@ -0,0 +1,61 @@
+import { useFormContext } from "react-hook-form";
+
+import { GenericFieldLabel } from "@app/components/v2";
+import { Badge } from "@app/components/v3";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+import { TSecretRotationV2Form } from "../schemas";
+import {
+ CLOUDFLARE_R2_ACCESS_LEVEL_MAP,
+ getR2BucketLabel,
+ r2BucketKey
+} from "../schemas/cloudflare-r2-access-key-rotation-schema";
+import { SecretRotationReviewSection } from "./shared";
+
+export const CloudflareR2AccessKeyRotationReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.CloudflareR2AccessKey;
+ }
+ >();
+
+ const [parameters, { apiToken, accessKeyId, secretAccessKey }] = watch([
+ "parameters",
+ "secretsMapping"
+ ]);
+
+ return (
+ <>
+ <SecretRotationReviewSection label="Parameters">
+ <GenericFieldLabel label="Token Name">{parameters.name}</GenericFieldLabel>
+ <GenericFieldLabel label="Buckets">
+ <div className="flex flex-wrap items-center gap-2">
+ {parameters.buckets.map((bucket) => (
+ <Badge key={r2BucketKey(bucket)} variant="neutral">
+ {getR2BucketLabel(bucket)}
+ </Badge>
+ ))}
+ </div>
+ </GenericFieldLabel>
+ <GenericFieldLabel label="Access Level">
+ {CLOUDFLARE_R2_ACCESS_LEVEL_MAP[parameters.accessLevel]}
+ </GenericFieldLabel>
+ {Boolean(parameters.allowedIps?.length) && (
+ <GenericFieldLabel label="Allowed IPs">
+ {parameters.allowedIps?.join(", ")}
+ </GenericFieldLabel>
+ )}
+ {Boolean(parameters.disallowedIps?.length) && (
+ <GenericFieldLabel label="Disallowed IPs">
+ {parameters.disallowedIps?.join(", ")}
+ </GenericFieldLabel>
+ )}
+ </SecretRotationReviewSection>
+ <SecretRotationReviewSection label="Secrets Mapping">
+ <GenericFieldLabel label="Access Key ID">{accessKeyId}</GenericFieldLabel>
+ <GenericFieldLabel label="Secret Access Key">{secretAccessKey}</GenericFieldLabel>
+ <GenericFieldLabel label="API Token">{apiToken}</GenericFieldLabel>
+ </SecretRotationReviewSection>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
index e2dbb1d532..cf563f880c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx
@@ -10,6 +10,7 @@ import { Auth0ClientSecretRotationReviewFields } from "./Auth0ClientSecretRotati
import { AwsIamUserSecretRotationReviewFields } from "./AwsIamUserSecretRotationReviewFields";
import { AzureClientSecretRotationReviewFields } from "./AzureClientSecretRotationReviewFields";
import { CloudflareApiTokenRotationReviewFields } from "./CloudflareApiTokenRotationReviewFields";
+import { CloudflareR2AccessKeyRotationReviewFields } from "./CloudflareR2AccessKeyRotationReviewFields";
import { ConvexAccessKeyRotationReviewFields } from "./ConvexAccessKeyRotationReviewFields";
import { DatabricksServicePrincipalSecretRotationReviewFields } from "./DatabricksServicePrincipalSecretRotationReviewFields";
import { DatadogApiKeyRotationReviewFields } from "./DatadogApiKeyRotationReviewFields";
@@ -58,7 +59,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationReviewFields,
[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationReviewFields,
[SecretRotation.SnowflakeUserKeyPair]: SnowflakeUserKeyPairRotationReviewFields,
- [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationReviewFields
+ [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationReviewFields,
+ [SecretRotation.CloudflareR2AccessKey]: CloudflareR2AccessKeyRotationReviewFields
};
export const SecretRotationV2ReviewFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx
new file mode 100644
index 0000000000..ee6f363e5a
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/CloudflareR2AccessKeyRotationSecretsMappingFields.tsx
@@ -0,0 +1,76 @@
+import { Controller, useFormContext } from "react-hook-form";
+
+import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";
+import { FormControl, Input } from "@app/components/v2";
+import { SecretRotation, useSecretRotationV2Option } from "@app/hooks/api/secretRotationsV2";
+
+import { SecretsMappingTable } from "./shared";
+
+export const CloudflareR2AccessKeyRotationSecretsMappingFields = () => {
+ const { control } = useFormContext<
+ TSecretRotationV2Form & {
+ type: SecretRotation.CloudflareR2AccessKey;
+ }
+ >();
+
+ const { rotationOption } = useSecretRotationV2Option(SecretRotation.CloudflareR2AccessKey);
+
+ const items = [
+ {
+ name: "Access Key ID",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.accessKeyId}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.accessKeyId"
+ />
+ )
+ },
+ {
+ name: "Secret Access Key",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.secretAccessKey}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.secretAccessKey"
+ />
+ )
+ },
+ {
+ name: "API Token",
+ input: (
+ <Controller
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl isError={Boolean(error)} errorText={error?.message}>
+ <Input
+ value={value}
+ onChange={onChange}
+ placeholder={rotationOption?.template.secretsMapping.apiToken}
+ />
+ </FormControl>
+ )}
+ control={control}
+ name="secretsMapping.apiToken"
+ />
+ )
+ }
+ ];
+
+ return <SecretsMappingTable items={items} />;
+};
diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
index fe31649ef2..26e9b9b677 100644
--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx
@@ -7,6 +7,7 @@ import { Auth0ClientSecretRotationSecretsMappingFields } from "./Auth0ClientSecr
import { AwsIamUserSecretRotationSecretsMappingFields } from "./AwsIamUserSecretRotationSecretsMappingFields";
import { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecretRotationSecretsMappingFields";
import { CloudflareApiTokenRotationSecretsMappingFields } from "./CloudflareApiTokenRotationSecretsMappingFields";
+import { CloudflareR2AccessKeyRotationSecretsMappingFields } from "./CloudflareR2AccessKeyRotationSecretsMappingFields";
import { ConvexAccessKeyRotationSecretsMappingFields } from "./ConvexAccessKeyRotationSecretsMappingFields";
import { DatabricksServicePrincipalSecretRotationSecretsMappingFields } from "./DatabricksServicePrincipalSecretRotationSecretsMappingFields";
import { DatadogApiKeyRotationSecretsMappingFields } from "./DatadogApiKeyRotationSecretsMappingFields";
@@ -57,7 +58,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {
[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationSecretsMappingFields,
[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationSecretsMappingFields,
[SecretRotation.SnowflakeUserKeyPair]: SnowflakeUserKeyPairRotationSecretsMappingFields,
- [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationSecretsMappingFields
+ [SecretRotation.CloudflareApiToken]: CloudflareApiTokenRotationSecretsMappingFields,
+ [SecretRotation.CloudflareR2AccessKey]: CloudflareR2AccessKeyRotationSecretsMappingFields
};
export const SecretRotationV2SecretsMappingFields = () => {
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-api-token-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-api-token-rotation-schema.ts
index ca794ed158..a1272587fb 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-api-token-rotation-schema.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-api-token-rotation-schema.ts
@@ -1,7 +1,10 @@
import { z } from "zod";
import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
-import { isValidIpOrCidr } from "@app/helpers/ip";
+import {
+ CloudflareTokenIpRestrictionsSchema,
+ CloudflareTokenNameSchema
+} from "@app/components/secret-rotations-v2/forms/schemas/shared";
import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
import { groupBy, unique } from "@app/lib/fn/array";
@@ -34,19 +37,6 @@ export const CLOUDFLARE_POLICY_SCOPE_RESOURCE_MAP: Record<CloudflareApiTokenPoli
[CloudflareApiTokenPolicyScope.Zones]: "com.cloudflare.api.account.zone"
};
-/** Matches the backend schema — Cloudflare caps token names at 120 and we append a timestamp. */
-export const CLOUDFLARE_API_TOKEN_NAME_MAX_LENGTH = 100;
-
-const IpRestrictionsSchema = z
- .string()
- .trim()
- .array()
- .optional()
- .refine(
- (ips) => !ips || ips.every(isValidIpOrCidr),
- "Each entry must be a valid IP address or CIDR block"
- );
-
/**
* What a form row holds: exactly one permission group, which keeps each row readable as a single
* sentence. Rows are merged into the API shape by `mergePolicyRows` on submit.
@@ -111,18 +101,14 @@ export const CloudflareApiTokenRotationSchema = z
.object({
type: z.literal(SecretRotation.CloudflareApiToken),
parameters: z.object({
- name: z
- .string()
- .trim()
- .min(1, "Token name required")
- .max(CLOUDFLARE_API_TOKEN_NAME_MAX_LENGTH, "Token name too long"),
+ name: CloudflareTokenNameSchema,
// The form edits rows; zodResolver hands the transformed (merged) value to handleSubmit, so the
// API receives the stored shape without the generic rotation form knowing anything about it.
policies: CloudflareApiTokenPolicyRowSchema.array()
.min(1, "At least one policy is required")
.transform(mergePolicyRows),
- allowedIps: IpRestrictionsSchema,
- disallowedIps: IpRestrictionsSchema
+ allowedIps: CloudflareTokenIpRestrictionsSchema,
+ disallowedIps: CloudflareTokenIpRestrictionsSchema
}),
secretsMapping: z.object({
tokenId: z.string().trim().min(1, "Token ID secret name required"),
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-r2-access-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-r2-access-key-rotation-schema.ts
new file mode 100644
index 0000000000..3a502769cc
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/cloudflare-r2-access-key-rotation-schema.ts
@@ -0,0 +1,62 @@
+import { z } from "zod";
+
+import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";
+import {
+ CloudflareTokenIpRestrictionsSchema,
+ CloudflareTokenNameSchema
+} from "@app/components/secret-rotations-v2/forms/schemas/shared";
+import { CloudflareR2Jurisdiction } from "@app/hooks/api/appConnections/cloudflare";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+
+export enum CloudflareR2AccessLevel {
+ ObjectRead = "object-read",
+ ObjectReadWrite = "object-read-write"
+}
+
+export const CLOUDFLARE_R2_ACCESS_LEVEL_MAP: Record<CloudflareR2AccessLevel, string> = {
+ [CloudflareR2AccessLevel.ObjectRead]: "Object Read only",
+ [CloudflareR2AccessLevel.ObjectReadWrite]: "Object Read & Write"
+};
+
+export const CLOUDFLARE_R2_JURISDICTION_MAP: Record<CloudflareR2Jurisdiction, string> = {
+ [CloudflareR2Jurisdiction.Default]: "Default",
+ [CloudflareR2Jurisdiction.Eu]: "EU",
+ [CloudflareR2Jurisdiction.FedRamp]: "FedRAMP"
+};
+
+export const CloudflareR2BucketSchema = z.object({
+ name: z.string().trim().min(1, "Bucket name required"),
+ jurisdiction: z.nativeEnum(CloudflareR2Jurisdiction)
+});
+
+export type TCloudflareR2BucketSelection = z.infer<typeof CloudflareR2BucketSchema>;
+
+/**
+ * A bucket is only unique per (jurisdiction, name) — which is exactly what the token policy's resource
+ * key encodes — so both are needed to identify a selection.
+ */
+export const r2BucketKey = ({ name, jurisdiction }: TCloudflareR2BucketSelection) =>
+ `${jurisdiction}:${name}`;
+
+export const getR2BucketLabel = ({ name, jurisdiction }: TCloudflareR2BucketSelection) =>
+ jurisdiction === CloudflareR2Jurisdiction.Default
+ ? name
+ : `${name} (${CLOUDFLARE_R2_JURISDICTION_MAP[jurisdiction]})`;
+
+export const CloudflareR2AccessKeyRotationSchema = z
+ .object({
+ type: z.literal(SecretRotation.CloudflareR2AccessKey),
+ parameters: z.object({
+ name: CloudflareTokenNameSchema,
+ buckets: CloudflareR2BucketSchema.array().min(1, "At least one bucket is required"),
+ accessLevel: z.nativeEnum(CloudflareR2AccessLevel),
+ allowedIps: CloudflareTokenIpRestrictionsSchema,
+ disallowedIps: CloudflareTokenIpRestrictionsSchema
+ }),
+ secretsMapping: z.object({
+ apiToken: z.string().trim().min(1, "API Token secret name required"),
+ accessKeyId: z.string().trim().min(1, "Access Key ID secret name required"),
+ secretAccessKey: z.string().trim().min(1, "Secret Access Key secret name required")
+ })
+ })
+ .merge(BaseSecretRotationSchema);
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
index 2b7461be40..a67c63414b 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts
@@ -16,6 +16,7 @@ import { UnixLinuxLocalAccountRotationMethod } from "@app/hooks/api/secretRotati
import { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";
import { CloudflareApiTokenRotationSchema } from "./cloudflare-api-token-rotation-schema";
+import { CloudflareR2AccessKeyRotationSchema } from "./cloudflare-r2-access-key-rotation-schema";
import { ConvexAccessKeyRotationSchema } from "./convex-access-key-rotation-schema";
import { DatadogApiKeyRotationSchema } from "./datadog-api-key-rotation-schema";
import { DatadogApplicationKeySecretRotationSchema } from "./datadog-application-key-secret-rotation-schema";
@@ -64,7 +65,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>
ConvexAccessKeyRotationSchema,
FireworksApiKeyRotationSchema,
SnowflakeUserKeyPairRotationSchema,
- CloudflareApiTokenRotationSchema
+ CloudflareApiTokenRotationSchema,
+ CloudflareR2AccessKeyRotationSchema
]),
z.object({ id: z.string().optional() })
)
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/shared/cloudflare-token-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/cloudflare-token-rotation-schema.ts
new file mode 100644
index 0000000000..2cf2d97a50
--- /dev/null
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/cloudflare-token-rotation-schema.ts
@@ -0,0 +1,22 @@
+import { z } from "zod";
+
+import { isValidIpOrCidr } from "@app/helpers/ip";
+
+/** Matches the backend — Cloudflare caps token names at 120 and we append a timestamp. */
+export const CLOUDFLARE_TOKEN_NAME_MAX_LENGTH = 100;
+
+export const CloudflareTokenIpRestrictionsSchema = z
+ .string()
+ .trim()
+ .array()
+ .optional()
+ .refine(
+ (ips) => !ips || ips.every(isValidIpOrCidr),
+ "Each entry must be a valid IP address or CIDR block"
+ );
+
+export const CloudflareTokenNameSchema = z
+ .string()
+ .trim()
+ .min(1, "Token name required")
+ .max(CLOUDFLARE_TOKEN_NAME_MAX_LENGTH, "Token name too long");
diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/shared/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/index.ts
index 284b705e41..bb4e38507c 100644
--- a/frontend/src/components/secret-rotations-v2/forms/schemas/shared/index.ts
+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/shared/index.ts
@@ -1,2 +1,3 @@
+export * from "./cloudflare-token-rotation-schema";
export * from "./password-requirements-schema";
export * from "./sql-credentials-rotation-schema";
diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.ts
index 8289b32aa4..9377dc0ffe 100644
--- a/frontend/src/helpers/secretRotationsV2.ts
+++ b/frontend/src/helpers/secretRotationsV2.ts
@@ -139,6 +139,11 @@ export const SECRET_ROTATION_MAP: Record<
name: "Cloudflare API Token",
image: "Cloudflare.png",
size: 50
+ },
+ [SecretRotation.CloudflareR2AccessKey]: {
+ name: "Cloudflare R2 Access Key",
+ image: "Cloudflare.png",
+ size: 50
}
};
@@ -169,7 +174,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio
[SecretRotation.ConvexAccessKey]: AppConnection.Convex,
[SecretRotation.FireworksApiKey]: AppConnection.Fireworks,
[SecretRotation.SnowflakeUserKeyPair]: AppConnection.Snowflake,
- [SecretRotation.CloudflareApiToken]: AppConnection.Cloudflare
+ [SecretRotation.CloudflareApiToken]: AppConnection.Cloudflare,
+ [SecretRotation.CloudflareR2AccessKey]: AppConnection.Cloudflare
};
// if a rotation can potentially have downtime due to rotating a single credential set this to false
@@ -200,7 +206,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {
[SecretRotation.ConvexAccessKey]: true,
[SecretRotation.FireworksApiKey]: true,
[SecretRotation.SnowflakeUserKeyPair]: true,
- [SecretRotation.CloudflareApiToken]: true
+ [SecretRotation.CloudflareApiToken]: true,
+ [SecretRotation.CloudflareR2AccessKey]: true
};
export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {
diff --git a/frontend/src/hooks/api/appConnections/cloudflare/queries.tsx b/frontend/src/hooks/api/appConnections/cloudflare/queries.tsx
index 05d9935057..baf34f8d03 100644
--- a/frontend/src/hooks/api/appConnections/cloudflare/queries.tsx
+++ b/frontend/src/hooks/api/appConnections/cloudflare/queries.tsx
@@ -6,6 +6,7 @@ import { appConnectionKeys } from "../queries";
import {
TCloudflarePagesProject,
TCloudflarePermissionGroup,
+ TCloudflareR2Bucket,
TCloudflareWorkersScript,
TCloudflareZone
} from "./types";
@@ -19,7 +20,9 @@ const cloudflareConnectionKeys = {
listZones: (connectionId: string, scopeToAccount: boolean) =>
[...cloudflareConnectionKeys.all, "zones", connectionId, { scopeToAccount }] as const,
listPermissionGroups: (connectionId: string) =>
- [...cloudflareConnectionKeys.all, "permission-groups", connectionId] as const
+ [...cloudflareConnectionKeys.all, "permission-groups", connectionId] as const,
+ listR2Buckets: (connectionId: string) =>
+ [...cloudflareConnectionKeys.all, "r2-buckets", connectionId] as const
};
export const useCloudflareConnectionListPagesProjects = (
@@ -125,3 +128,28 @@ export const useCloudflareConnectionListPermissionGroups = (
...options
});
};
+
+export const useCloudflareConnectionListR2Buckets = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TCloudflareR2Bucket[],
+ unknown,
+ TCloudflareR2Bucket[],
+ ReturnType<typeof cloudflareConnectionKeys.listR2Buckets>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: cloudflareConnectionKeys.listR2Buckets(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TCloudflareR2Bucket[]>(
+ `/api/v1/app-connections/cloudflare/${connectionId}/cloudflare-r2-buckets`
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/cloudflare/types.ts b/frontend/src/hooks/api/appConnections/cloudflare/types.ts
index fa42542e45..5dc86178ab 100644
--- a/frontend/src/hooks/api/appConnections/cloudflare/types.ts
+++ b/frontend/src/hooks/api/appConnections/cloudflare/types.ts
@@ -18,3 +18,21 @@ export type TCloudflarePermissionGroup = {
// the resource types this permission group can be attached to, e.g. "com.cloudflare.api.account.zone"
scopes: string[];
};
+
+/**
+ * The storage jurisdiction of an R2 bucket. It is part of the bucket's identity — the same bucket name
+ * can exist in more than one jurisdiction, and a token policy has to name both.
+ */
+export enum CloudflareR2Jurisdiction {
+ Default = "default",
+ Eu = "eu",
+ FedRamp = "fedramp"
+}
+
+export type TCloudflareR2Bucket = {
+ name: string;
+ jurisdiction: CloudflareR2Jurisdiction;
+ location?: string;
+ storageClass?: string;
+ creationDate?: string;
+};
diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.ts
index 9b536fc065..5ce1067525 100644
--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts
@@ -25,7 +25,8 @@ export enum SecretRotation {
ConvexAccessKey = "convex-access-key",
FireworksApiKey = "fireworks-api-key",
SnowflakeUserKeyPair = "snowflake-user-key-pair",
- CloudflareApiToken = "cloudflare-api-token"
+ CloudflareApiToken = "cloudflare-api-token",
+ CloudflareR2AccessKey = "cloudflare-r2-access-key"
}
export enum SecretRotationStatus {
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/cloudflare-r2-access-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/cloudflare-r2-access-key-rotation.ts
new file mode 100644
index 0000000000..f34c2abaa2
--- /dev/null
+++ b/frontend/src/hooks/api/secretRotationsV2/types/cloudflare-r2-access-key-rotation.ts
@@ -0,0 +1,47 @@
+import {
+ CloudflareR2AccessLevel,
+ TCloudflareR2BucketSelection
+} from "@app/components/secret-rotations-v2/forms/schemas/cloudflare-r2-access-key-rotation-schema";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";
+import {
+ TSecretRotationV2Base,
+ TSecretRotationV2GeneratedCredentialsResponseBase
+} from "@app/hooks/api/secretRotationsV2/types/shared";
+
+export type TCloudflareR2AccessKeyRotation = TSecretRotationV2Base & {
+ type: SecretRotation.CloudflareR2AccessKey;
+ parameters: {
+ name: string;
+ buckets: TCloudflareR2BucketSelection[];
+ accessLevel: CloudflareR2AccessLevel;
+ allowedIps?: string[];
+ disallowedIps?: string[];
+ };
+ secretsMapping: {
+ apiToken: string;
+ accessKeyId: string;
+ secretAccessKey: string;
+ };
+};
+
+export type TCloudflareR2AccessKeyRotationGeneratedCredentials = {
+ apiToken: string;
+ accessKeyId: string;
+ secretAccessKey: string;
+};
+
+export type TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse =
+ TSecretRotationV2GeneratedCredentialsResponseBase<
+ SecretRotation.CloudflareR2AccessKey,
+ TCloudflareR2AccessKeyRotationGeneratedCredentials
+ >;
+
+export type TCloudflareR2AccessKeyRotationOption = {
+ name: string;
+ type: SecretRotation.CloudflareR2AccessKey;
+ connection: AppConnection.Cloudflare;
+ template: {
+ secretsMapping: TCloudflareR2AccessKeyRotation["secretsMapping"];
+ };
+};
diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
index d4d2797f5e..bb1b56d5c5 100644
--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts
+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts
@@ -41,6 +41,11 @@ import {
TCloudflareApiTokenRotationGeneratedCredentialsResponse,
TCloudflareApiTokenRotationOption
} from "./cloudflare-api-token-rotation";
+import {
+ TCloudflareR2AccessKeyRotation,
+ TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse,
+ TCloudflareR2AccessKeyRotationOption
+} from "./cloudflare-r2-access-key-rotation";
import {
TConvexAccessKeyRotation,
TConvexAccessKeyRotationGeneratedCredentialsResponse,
@@ -163,6 +168,7 @@ export type TSecretRotationV2 = (
| TFireworksApiKeyRotation
| TSnowflakeUserKeyPairRotation
| TCloudflareApiTokenRotation
+ | TCloudflareR2AccessKeyRotation
) & {
secrets: (SecretV3RawSanitized | null)[];
};
@@ -191,7 +197,8 @@ export type TSecretRotationV2Option =
| TConvexAccessKeyRotationOption
| TFireworksApiKeyRotationOption
| TSnowflakeUserKeyPairRotationOption
- | TCloudflareApiTokenRotationOption;
+ | TCloudflareApiTokenRotationOption
+ | TCloudflareR2AccessKeyRotationOption;
export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };
@@ -224,7 +231,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =
| TConvexAccessKeyRotationGeneratedCredentialsResponse
| TFireworksApiKeyRotationGeneratedCredentialsResponse
| TSnowflakeUserKeyPairRotationGeneratedCredentialsResponse
- | TCloudflareApiTokenRotationGeneratedCredentialsResponse;
+ | TCloudflareApiTokenRotationGeneratedCredentialsResponse
+ | TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse;
export type TCreateSecretRotationV2DTO = DiscriminativePick<
TSecretRotationV2,
@@ -306,6 +314,7 @@ export type TSecretRotationOptionMap = {
[SecretRotation.FireworksApiKey]: TFireworksApiKeyRotationOption;
[SecretRotation.SnowflakeUserKeyPair]: TSnowflakeUserKeyPairRotationOption;
[SecretRotation.CloudflareApiToken]: TCloudflareApiTokenRotationOption;
+ [SecretRotation.CloudflareR2AccessKey]: TCloudflareR2AccessKeyRotationOption;
};
export type TSecretRotationGeneratedCredentialsResponseMap = {
@@ -336,6 +345,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {
[SecretRotation.FireworksApiKey]: TFireworksApiKeyRotationGeneratedCredentialsResponse;
[SecretRotation.SnowflakeUserKeyPair]: TSnowflakeUserKeyPairRotationGeneratedCredentialsResponse;
[SecretRotation.CloudflareApiToken]: TCloudflareApiTokenRotationGeneratedCredentialsResponse;
+ [SecretRotation.CloudflareR2AccessKey]: TCloudflareR2AccessKeyRotationGeneratedCredentialsResponse;
};
// Unified type for local account reconciliation (Unix/Linux, Windows, and HP iLO)