Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: add support for api key rotation
adilsonded1ff77a1ab
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-api-key-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-api-key-rotation-router.tsnew file mode 100644index 0000000000..af73a489c6--- /dev/null+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-api-key-rotation-router.ts@@ -0,0 +1,19 @@+import {+ CreateDatadogApiKeyRotationSchema,+ DatadogApiKeyRotationGeneratedCredentialsSchema,+ DatadogApiKeyRotationSchema,+ UpdateDatadogApiKeyRotationSchema+} from "@app/ee/services/secret-rotation-v2/datadog-api-key";+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";++import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";++export const registerDatadogApiKeyRotationRouter = async (server: FastifyZodProvider) =>+ registerSecretRotationEndpoints({+ type: SecretRotation.DatadogApiKey,+ server,+ responseSchema: DatadogApiKeyRotationSchema,+ createSchema: CreateDatadogApiKeyRotationSchema,+ updateSchema: UpdateDatadogApiKeyRotationSchema,+ generatedCredentialsSchema: DatadogApiKeyRotationGeneratedCredentialsSchema+ });diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.tsindex f529032576..8c3bc9542e 100644--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/index.ts@@ -5,6 +5,7 @@ import { registerAwsIamUserSecretRotationRouter } from "./aws-iam-user-secret-roimport { registerAzureClientSecretRotationRouter } from "./azure-client-secret-rotation-router";import { registerConvexAccessKeyRotationRouter } from "./convex-access-key-rotation-router";import { registerDatabricksServicePrincipalSecretRotationRouter } from "./databricks-service-principal-secret-rotation-router";+import { registerDatadogApiKeyRotationRouter } from "./datadog-api-key-rotation-router";import { registerDatadogApplicationKeySecretRotationRouter } from "./datadog-application-key-secret-rotation-router";import { registerDbtServiceTokenRotationRouter } from "./dbt-service-token-rotation-router";import { registerFireworksApiKeyRotationRouter } from "./fireworks-api-key-rotation-router";@@ -53,6 +54,7 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<[SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter,[SecretRotation.SalesforceOauthCredentials]: registerSalesforceOauthCredentialsRotationRouter,[SecretRotation.DatadogApplicationKeySecret]: registerDatadogApplicationKeySecretRotationRouter,+ [SecretRotation.DatadogApiKey]: registerDatadogApiKeyRotationRouter,[SecretRotation.ConvexAccessKey]: registerConvexAccessKeyRotationRouter,[SecretRotation.FireworksApiKey]: registerFireworksApiKeyRotationRouter};diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.tsindex a7fc88177f..7de45922a2 100644--- a/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/secret-rotation-v2-router.ts@@ -6,6 +6,7 @@ import { AwsIamUserSecretRotationListItemSchema } from "@app/ee/services/secret-import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";import { ConvexAccessKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/convex-access-key";import { DatabricksServicePrincipalSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";+import { DatadogApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/datadog-api-key";import { DatadogApplicationKeySecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret";import { DbtServiceTokenRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/dbt-service-token";import { FireworksApiKeyRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/fireworks-api-key";@@ -54,6 +55,7 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [SupabaseApiKeyRotationListItemSchema,SalesforceOauthCredentialsRotationListItemSchema,DatadogApplicationKeySecretRotationListItemSchema,+ DatadogApiKeyRotationListItemSchema,ConvexAccessKeyRotationListItemSchema,FireworksApiKeyRotationListItemSchema]);diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-constants.tsnew file mode 100644index 0000000000..a785d4c34d--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-constants.ts@@ -0,0 +1,15 @@+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";+import { TSecretRotationV2ListItem } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++export const DATADOG_API_KEY_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {+ name: "Datadog API Key",+ type: SecretRotation.DatadogApiKey,+ connection: AppConnection.Datadog,+ template: {+ secretsMapping: {+ apiKeyId: "DATADOG_API_KEY_ID",+ apiKey: "DATADOG_API_KEY"+ }+ }+};diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-fns.tsnew file mode 100644index 0000000000..40e912c66a--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-fns.ts@@ -0,0 +1,185 @@+import { AxiosError } from "axios";++import {+ TRotationFactory,+ TRotationFactoryCheckActiveCredentials,+ TRotationFactoryGetSecretsPayload,+ TRotationFactoryIssueCredentials,+ TRotationFactoryRevokeCredentials,+ TRotationFactoryRotateCredentials+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";+import { BadRequestError } from "@app/lib/errors";+import { logger } from "@app/lib/logger";+import { safeRequest } from "@app/lib/validator";+import { getDatadogAuthHeaders, getDatadogBaseUrl, getDatadogErrorMessage } from "@app/services/app-connection/datadog";++import {+ TDatadogApiKeyRotationGeneratedCredentials,+ TDatadogApiKeyRotationWithConnection+} from "./datadog-api-key-rotation-types";++type TDatadogCreateApiKeyResponse = {+ data: {+ id: string;+ type: string;+ attributes: {+ name: string;+ key: string;+ created_at?: string;+ last4?: string;+ };+ };+};++// exists only one right now, but this is an enum on their side.+enum DatadogAPIKeyType {+ API = "api_keys"+}++export const datadogApiKeyRotationFactory: TRotationFactory<+ TDatadogApiKeyRotationWithConnection,+ TDatadogApiKeyRotationGeneratedCredentials+> = (secretRotation) => {+ const {+ id: rotationId,+ connection,+ parameters: { name },+ secretsMapping+ } = secretRotation;++ const authHeaders = getDatadogAuthHeaders(connection);++ const $createApiKey = async () => {+ const baseUrl = await getDatadogBaseUrl(connection);++ try {+ const { data } = await safeRequest.post<TDatadogCreateApiKeyResponse>(+ `${baseUrl}/api/v2/api_keys`,+ {+ data: {+ type: DatadogAPIKeyType.API,+ attributes: {+ name+ }+ }+ },+ {+ headers: { ...authHeaders, "Content-Type": "application/json" }+ }+ );++ if (!data?.data?.id || !data?.data?.attributes?.key) {+ throw new BadRequestError({+ message: "Datadog API key response missing 'id' or 'attributes.key'"+ });+ }++ return { apiKeyId: data.data.id, apiKey: data.data.attributes.key };+ } catch (error: unknown) {+ if (error instanceof BadRequestError) throw error;+ throw new BadRequestError({+ message: `Failed to create Datadog API key: ${getDatadogErrorMessage(error)}`+ });+ }+ };++ const $deleteApiKey = async (apiKeyId: string) => {+ const baseUrl = await getDatadogBaseUrl(connection);++ try {+ await safeRequest.delete(`${baseUrl}/api/v2/api_keys/${encodeURIComponent(apiKeyId)}`, {+ headers: authHeaders+ });+ } catch (error: unknown) {+ // 404 means the key is already gone — treat as success since revocation is the desired end state.+ if (error instanceof AxiosError && error.response?.status === 404) return;+ throw new BadRequestError({+ message: `Failed to delete Datadog API key ${apiKeyId}: ${getDatadogErrorMessage(error)}`+ });+ }+ };++ const issueCredentials: TRotationFactoryIssueCredentials<TDatadogApiKeyRotationGeneratedCredentials> = async (+ callback+ ) => {+ const credentials = await $createApiKey();+ return callback(credentials);+ };++ const revokeCredentials: TRotationFactoryRevokeCredentials<TDatadogApiKeyRotationGeneratedCredentials> = async (+ generatedCredentials,+ callback+ ) => {+ if (!generatedCredentials?.length) return callback();++ const results = await Promise.allSettled(+ generatedCredentials.map((credential) => $deleteApiKey(credential.apiKeyId))+ );++ results.forEach((result, index) => {+ if (result.status === "rejected") {+ logger.error(+ result.reason,+ `datadogApiKeyRotation: failed to revoke key during cleanup [rotationId=${rotationId}] [keyId=${generatedCredentials[index].apiKeyId}]`+ );+ }+ });++ return callback();+ };++ // Issue first, then revoke the previously-inactive key. If issue fails, the old key remains usable+ // and we avoid leaving the rotation without a working key.+ const rotateCredentials: TRotationFactoryRotateCredentials<TDatadogApiKeyRotationGeneratedCredentials> = async (+ credentialsToRevoke,+ callback+ ) => {+ const credentials = await $createApiKey();++ if (credentialsToRevoke?.apiKeyId) {+ try {+ await $deleteApiKey(credentialsToRevoke.apiKeyId);+ } catch (revokeError) {+ logger.error(+ revokeError,+ `datadogApiKeyRotation: failed to revoke previous key after rotation [rotationId=${rotationId}] [keyId=${credentialsToRevoke.apiKeyId}]`+ );+ }+ }++ return callback(credentials);+ };++ const getSecretsPayload: TRotationFactoryGetSecretsPayload<TDatadogApiKeyRotationGeneratedCredentials> = (+ generatedCredentials+ ) => [+ { key: secretsMapping.apiKeyId, value: generatedCredentials.apiKeyId },+ { key: secretsMapping.apiKey, value: generatedCredentials.apiKey }+ ];++ const checkActiveCredentials: TRotationFactoryCheckActiveCredentials<+ TDatadogApiKeyRotationGeneratedCredentials+ > = async ({ apiKey }) => {+ const baseUrl = await getDatadogBaseUrl(connection);++ try {+ // Validate the freshly-issued API key against the connection's known-good application key.+ await safeRequest.get(`${baseUrl}/api/v2/validate`, {+ headers: { "DD-API-KEY": apiKey }+ });+ } catch (error: unknown) {+ if (error instanceof BadRequestError) throw error;+ throw new BadRequestError({+ message: `Datadog API key verification failed: ${getDatadogErrorMessage(error)}`+ });+ }+ };++ return {+ issueCredentials,+ revokeCredentials,+ rotateCredentials,+ getSecretsPayload,+ checkActiveCredentials+ };+};diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-schemas.tsnew file mode 100644index 0000000000..e45de36c15--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-schemas.ts@@ -0,0 +1,67 @@+import { z } from "zod";++import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";+import {+ BaseCreateSecretRotationSchema,+ BaseSecretRotationSchema,+ BaseUpdateSecretRotationSchema+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-schemas";+import { SecretRotations } from "@app/lib/api-docs";+import { SecretNameSchema } from "@app/server/lib/schemas";+import { AppConnection } from "@app/services/app-connection/app-connection-enums";++/** Datadog does not publish a strict maximum length for API key names; cap for sanity. */+export const DATADOG_API_KEY_NAME_MAX_LENGTH = 255;++export const DatadogApiKeyRotationGeneratedCredentialsSchema = z+ .object({+ apiKeyId: z.string(),+ apiKey: z.string()+ })+ .array()+ .min(1)+ .max(2);++const DatadogApiKeyRotationParametersSchema = z.object({+ name: z+ .string()+ .trim()+ .min(1, "Key name required")+ .max(DATADOG_API_KEY_NAME_MAX_LENGTH, `Key name must be ${DATADOG_API_KEY_NAME_MAX_LENGTH} characters or fewer`)+ .describe(SecretRotations.PARAMETERS.DATADOG_API_KEY.name)+});++const DatadogApiKeyRotationSecretsMappingSchema = z.object({+ apiKeyId: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.DATADOG_API_KEY.apiKeyId),+ apiKey: SecretNameSchema.describe(SecretRotations.SECRETS_MAPPING.DATADOG_API_KEY.apiKey)+});++export const DatadogApiKeyRotationTemplateSchema = z.object({+ secretsMapping: z.object({+ apiKeyId: z.string(),+ apiKey: z.string()+ })+});++export const DatadogApiKeyRotationSchema = BaseSecretRotationSchema(SecretRotation.DatadogApiKey).extend({+ type: z.literal(SecretRotation.DatadogApiKey),+ parameters: DatadogApiKeyRotationParametersSchema,+ secretsMapping: DatadogApiKeyRotationSecretsMappingSchema+});++export const CreateDatadogApiKeyRotationSchema = BaseCreateSecretRotationSchema(SecretRotation.DatadogApiKey).extend({+ parameters: DatadogApiKeyRotationParametersSchema,+ secretsMapping: DatadogApiKeyRotationSecretsMappingSchema+});++export const UpdateDatadogApiKeyRotationSchema = BaseUpdateSecretRotationSchema(SecretRotation.DatadogApiKey).extend({+ parameters: DatadogApiKeyRotationParametersSchema.optional(),+ secretsMapping: DatadogApiKeyRotationSecretsMappingSchema.optional()+});++export const DatadogApiKeyRotationListItemSchema = z.object({+ name: z.literal("Datadog API Key"),+ connection: z.literal(AppConnection.Datadog),+ type: z.literal(SecretRotation.DatadogApiKey),+ template: DatadogApiKeyRotationTemplateSchema+});diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-types.tsnew file mode 100644index 0000000000..7c640506a3--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-types.ts@@ -0,0 +1,24 @@+import { z } from "zod";++import { TDatadogConnection } from "@app/services/app-connection/datadog";++import {+ CreateDatadogApiKeyRotationSchema,+ DatadogApiKeyRotationGeneratedCredentialsSchema,+ DatadogApiKeyRotationListItemSchema,+ DatadogApiKeyRotationSchema+} from "./datadog-api-key-rotation-schemas";++export type TDatadogApiKeyRotation = z.infer<typeof DatadogApiKeyRotationSchema>;++export type TDatadogApiKeyRotationInput = z.infer<typeof CreateDatadogApiKeyRotationSchema>;++export type TDatadogApiKeyRotationListItem = z.infer<typeof DatadogApiKeyRotationListItemSchema>;++export type TDatadogApiKeyRotationWithConnection = TDatadogApiKeyRotation & {+ connection: TDatadogConnection;+};++export type TDatadogApiKeyRotationGeneratedCredentials = z.infer<+ typeof DatadogApiKeyRotationGeneratedCredentialsSchema+>;diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-api-key/index.ts b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/index.tsnew file mode 100644index 0000000000..a46c47d915--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-api-key/index.ts@@ -0,0 +1,3 @@+export * from "./datadog-api-key-rotation-constants";+export * from "./datadog-api-key-rotation-schemas";+export * from "./datadog-api-key-rotation-types";diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.tsindex 58b8b9eb37..be51733359 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-enums.ts@@ -21,6 +21,7 @@ export enum SecretRotation {SupabaseApiKey = "supabase-api-key",SalesforceOauthCredentials = "salesforce-oauth-credentials",DatadogApplicationKeySecret = "datadog-application-key-secret",+ DatadogApiKey = "datadog-api-key",ConvexAccessKey = "convex-access-key",FireworksApiKey = "fireworks-api-key"}diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.tsindex cebf16adc3..b3870df4a8 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-fns.ts@@ -11,6 +11,7 @@ import { AWS_IAM_USER_SECRET_ROTATION_LIST_OPTION } from "./aws-iam-user-secret"import { AZURE_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./azure-client-secret";import { CONVEX_ACCESS_KEY_ROTATION_LIST_OPTION } from "./convex-access-key";import { DATABRICKS_SERVICE_PRINCIPAL_SECRET_ROTATION_LIST_OPTION } from "./databricks-service-principal-secret";+import { DATADOG_API_KEY_ROTATION_LIST_OPTION } from "./datadog-api-key";import {DATADOG_APPLICATION_KEY_SECRET_ROTATION_LIST_OPTION,TDatadogApplicationKeySecretRotation@@ -74,6 +75,7 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List[SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION,[SecretRotation.SalesforceOauthCredentials]: SALESFORCE_OAUTH_CREDENTIALS_ROTATION_LIST_OPTION,[SecretRotation.DatadogApplicationKeySecret]: DATADOG_APPLICATION_KEY_SECRET_ROTATION_LIST_OPTION,+ [SecretRotation.DatadogApiKey]: DATADOG_API_KEY_ROTATION_LIST_OPTION,[SecretRotation.ConvexAccessKey]: CONVEX_ACCESS_KEY_ROTATION_LIST_OPTION,[SecretRotation.FireworksApiKey]: FIREWORKS_API_KEY_ROTATION_LIST_OPTION};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.tsindex 16d9a4d421..273a7b5fb7 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts@@ -24,6 +24,7 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.SupabaseApiKey]: "Supabase API Key",[SecretRotation.SalesforceOauthCredentials]: "Salesforce OAuth Credentials",[SecretRotation.DatadogApplicationKeySecret]: "Datadog Application Key",+ [SecretRotation.DatadogApiKey]: "Datadog API Key",[SecretRotation.ConvexAccessKey]: "Convex Access Key",[SecretRotation.FireworksApiKey]: "Fireworks Secret"};@@ -51,6 +52,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.SupabaseApiKey]: AppConnection.Supabase,[SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce,[SecretRotation.DatadogApplicationKeySecret]: AppConnection.Datadog,+ [SecretRotation.DatadogApiKey]: AppConnection.Datadog,[SecretRotation.ConvexAccessKey]: AppConnection.Convex,[SecretRotation.FireworksApiKey]: AppConnection.Fireworks};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.tsindex a1f3de2957..d772ade239 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-service.ts@@ -17,6 +17,7 @@ import { auth0ClientSecretRotationFactory } from "@app/ee/services/secret-rotatiimport { azureClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns";import { convexAccessKeyRotationFactory } from "@app/ee/services/secret-rotation-v2/convex-access-key/convex-access-key-rotation-fns";import { databricksServicePrincipalSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns";+import { datadogApiKeyRotationFactory } from "@app/ee/services/secret-rotation-v2/datadog-api-key/datadog-api-key-rotation-fns";import { datadogApplicationKeySecretRotationFactory } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns";import { fireworksApiKeyRotationFactory } from "@app/ee/services/secret-rotation-v2/fireworks-api-key/fireworks-api-key-rotation-fns";import { ldapPasswordRotationFactory } from "@app/ee/services/secret-rotation-v2/ldap-password/ldap-password-rotation-fns";@@ -210,6 +211,7 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplemsalesforceOauthCredentialsRotationFactory as TRotationFactoryImplementation,[SecretRotation.DatadogApplicationKeySecret]:datadogApplicationKeySecretRotationFactory as TRotationFactoryImplementation,+ [SecretRotation.DatadogApiKey]: datadogApiKeyRotationFactory as TRotationFactoryImplementation,[SecretRotation.ConvexAccessKey]: convexAccessKeyRotationFactory as TRotationFactoryImplementation,[SecretRotation.FireworksApiKey]: fireworksApiKeyRotationFactory as TRotationFactoryImplementation};diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.tsindex b73f2a21de..de48f0af4a 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-types.ts@@ -44,6 +44,13 @@ import {TDatabricksServicePrincipalSecretRotationListItem,TDatabricksServicePrincipalSecretRotationWithConnection} from "./databricks-service-principal-secret";+import {+ TDatadogApiKeyRotation,+ TDatadogApiKeyRotationGeneratedCredentials,+ TDatadogApiKeyRotationInput,+ TDatadogApiKeyRotationListItem,+ TDatadogApiKeyRotationWithConnection+} from "./datadog-api-key";import {TDatadogApplicationKeySecretRotation,TDatadogApplicationKeySecretRotationGeneratedCredentials,@@ -198,6 +205,7 @@ export type TSecretRotationV2 =| TSupabaseApiKeyRotation| TSalesforceOauthCredentialsRotation| TDatadogApplicationKeySecretRotation+ | TDatadogApiKeyRotation| TConvexAccessKeyRotation| TFireworksApiKeyRotation;@@ -224,6 +232,7 @@ export type TSecretRotationV2WithConnection =| TSupabaseApiKeyRotationWithConnection| TSalesforceOauthCredentialsRotationWithConnection| TDatadogApplicationKeySecretRotationWithConnection+ | TDatadogApiKeyRotationWithConnection| TConvexAccessKeyRotationWithConnection| TFireworksApiKeyRotationWithConnection;@@ -246,6 +255,7 @@ export type TSecretRotationV2GeneratedCredentials =| TSupabaseApiKeyRotationGeneratedCredentials| TSalesforceOauthCredentialsRotationGeneratedCredentials| TDatadogApplicationKeySecretRotationGeneratedCredentials+ | TDatadogApiKeyRotationGeneratedCredentials| TConvexAccessKeyRotationGeneratedCredentials| TFireworksApiKeyRotationGeneratedCredentials;@@ -272,6 +282,7 @@ export type TSecretRotationV2Input =| TSupabaseApiKeyRotationInput| TSalesforceOauthCredentialsRotationInput| TDatadogApplicationKeySecretRotationInput+ | TDatadogApiKeyRotationInput| TConvexAccessKeyRotationInput| TFireworksApiKeyRotationInput;@@ -298,6 +309,7 @@ export type TSecretRotationV2ListItem =| TSupabaseApiKeyRotationListItem| TSalesforceOauthCredentialsRotationListItem| TDatadogApplicationKeySecretRotationListItem+ | TDatadogApiKeyRotationListItem| TConvexAccessKeyRotationListItem| TFireworksApiKeyRotationListItem;diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.tsindex 75c9360080..68884bed42 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-union-schema.ts@@ -4,6 +4,7 @@ import { Auth0ClientSecretRotationSchema } from "@app/ee/services/secret-rotatioimport { AwsIamUserSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/aws-iam-user-secret";import { AzureClientSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";import { DatabricksServicePrincipalSecretRotationSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";+import { DatadogApiKeyRotationSchema } from "@app/ee/services/secret-rotation-v2/datadog-api-key";import { DatadogApplicationKeySecretRotationSchema } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret";import { LdapPasswordRotationSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";import { LiteLLMApiKeyRotationSchema } from "@app/ee/services/secret-rotation-v2/litellm-api-key";@@ -49,6 +50,7 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [SupabaseApiKeyRotationSchema,SalesforceOauthCredentialsRotationSchema,DatadogApplicationKeySecretRotationSchema,+ DatadogApiKeyRotationSchema,ConvexAccessKeyRotationSchema,FireworksApiKeyRotationSchema]);diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 123c8c9ae1..2c8946f943 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3560,6 +3560,9 @@ export const SecretRotations = {DATADOG_APPLICATION_KEY_SECRET: {serviceAccountId: "The ID of the Datadog service account to rotate the application key for."},+ DATADOG_API_KEY: {+ name: "The name for the generated Datadog API key."+ },CONVEX_ACCESS_KEY: {namePrefix: "A prefix to use when naming the generated Convex access key."},@@ -3643,6 +3646,10 @@ export const SecretRotations = {applicationKeyId: "The name of the secret that the rotated Datadog application key ID will be mapped to.",applicationKey: "The name of the secret that the rotated Datadog application key value will be mapped to."},+ DATADOG_API_KEY: {+ apiKeyId: "The name of the secret that the rotated Datadog API key ID will be mapped to.",+ apiKey: "The name of the secret that the rotated Datadog API key value will be mapped to."+ },CONVEX_ACCESS_KEY: {accessKey: "The name of the secret that the rotated Convex access key will be mapped to."},diff --git a/docs/docs.json b/docs/docs.jsonindex 7468eb17f7..e3ce5174f4 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -522,6 +522,7 @@"documentation/platform/secret-rotation/convex-access-key","documentation/platform/secret-rotation/databricks-service-principal-secret","documentation/platform/secret-rotation/datadog-application-key-secret",+ "documentation/platform/secret-rotation/datadog-api-key","documentation/platform/secret-rotation/dbt-service-token","documentation/platform/secret-rotation/fireworks-api-key","documentation/platform/secret-rotation/litellm-api-key",diff --git a/docs/documentation/platform/secret-rotation/datadog-api-key.mdx b/docs/documentation/platform/secret-rotation/datadog-api-key.mdxnew file mode 100644index 0000000000..5d1adf5f5a--- /dev/null+++ b/docs/documentation/platform/secret-rotation/datadog-api-key.mdx@@ -0,0 +1,150 @@+---+title: "Datadog API Key"+description: "Learn how to automatically rotate Datadog API Keys."+---++<Note>+ **Rotation Type: Dual-Phase**++ This rotation maintains two active credential sets with overlapping validity, ensuring zero-downtime during rotation cycles.+</Note>++## Prerequisites++- Create a [Datadog Connection](/integrations/app-connections/datadog) using the **API Key** method (both an API Key and an Application Key are required).+- The Application Key used by the connection must belong to a user with permission to create and delete API keys. Set `api_keys_read` and `api_keys_write` under **API and Application Keys** in the key's scopes.++## Create a Datadog API Key Rotation in Infisical++<Tabs>+ <Tab title="Infisical UI">+ 1. Navigate to your Secret Manager Project's Dashboard and select **Add Secret Rotation** from the actions dropdown.++ ++ 2. Select the **Datadog API Key** option.++ ++ 3. Configure the rotation behavior, then click **Next**.++ ++ - **Datadog Connection** - the connection that will perform the rotation of the API Key.+ - **Rotation Interval** - the interval, in days, that once elapsed will trigger a rotation.+ - **Rotate At** - the local time of day when rotation should occur once the interval has elapsed.+ - **Auto-Rotation Enabled** - whether secrets should automatically be rotated once the rotation interval has elapsed. Disable this option to manually rotate secrets or pause secret rotation.++ 4. Provide a **Key Name** for the generated Datadog API keys. Then click **Next**.++ ++ - **Key Name** - the name assigned to the API keys created by this rotation in Datadog. Each rotation creates a new key using this name.++ 5. Specify the secret names that the rotated credentials should be mapped to. Then click **Next**.++ ++ - **API Key ID** - the name of the secret that the Datadog API Key ID will be mapped to.+ - **API Key** - the name of the secret that the rotated Datadog API Key value will be mapped to.++ 6. Give your rotation a name and description (optional). Then click **Next**.++ ++ - **Name** - the name of the secret rotation configuration. Must be slug-friendly.+ - **Description** (optional) - a description of this rotation configuration.++ 7. Review your configuration, then click **Create Secret Rotation**.++ ++ 8. Your **Datadog API Key** credentials are now available for use via the mapped secrets.++ + </Tab>+ <Tab title="API">+ To create a Datadog API Key Rotation, make an API request to the [Create Datadog API Key Rotation](/api-reference/endpoints/secret-rotations/datadog-api-key/create) API endpoint.++ ### Sample request++ ```bash Request+ curl --request POST \+ --url https://us.infisical.com/api/v2/secret-rotations/datadog-api-key \+ --header 'Content-Type: application/json' \+ --data '{+ "name": "my-datadog-rotation",+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "description": "my datadog api key rotation",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "environment": "dev",+ "secretPath": "/",+ "isAutoRotationEnabled": true,+ "rotationInterval": 30,+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "parameters": {+ "name": "Infisical Rotated API Key"+ },+ "secretsMapping": {+ "apiKeyId": "DATADOG_API_KEY_ID",+ "apiKey": "DATADOG_API_KEY"+ }+ }'+ ```++ ### Sample response++ ```bash Response+ {+ "secretRotation": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "name": "my-datadog-rotation",+ "description": "my datadog api key rotation",+ "secretsMapping": {+ "apiKeyId": "DATADOG_API_KEY_ID",+ "apiKey": "DATADOG_API_KEY"+ },+ "isAutoRotationEnabled": true,+ "activeIndex": 0,+ "folderId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "connectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "createdAt": "2023-11-07T05:31:56Z",+ "updatedAt": "2023-11-07T05:31:56Z",+ "rotationInterval": 30,+ "rotationStatus": "success",+ "lastRotationAttemptedAt": "2023-11-07T05:31:56Z",+ "lastRotatedAt": "2023-11-07T05:31:56Z",+ "lastRotationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "nextRotationAt": "2023-11-07T05:31:56Z",+ "connection": {+ "app": "datadog",+ "name": "my-datadog-connection",+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"+ },+ "environment": {+ "slug": "dev",+ "name": "Development",+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"+ },+ "projectId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "folder": {+ "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",+ "path": "/"+ },+ "rotateAtUtc": {+ "hours": 0,+ "minutes": 0+ },+ "lastRotationMessage": null,+ "type": "datadog-api-key",+ "parameters": {+ "name": "Infisical Rotated API Key"+ }+ }+ }+ ```+ </Tab>+</Tabs>diff --git a/docs/snippets/RotationsBrowser.jsx b/docs/snippets/RotationsBrowser.jsxindex 6377689cae..9cbd862805 100644--- a/docs/snippets/RotationsBrowser.jsx+++ b/docs/snippets/RotationsBrowser.jsx@@ -196,6 +196,14 @@ export const RotationsBrowser = () => {category: "Monitoring",rotationType: "Dual-Phase",},+ {+ name: "Datadog API Key",+ slug: "datadog-api-key",+ path: "/documentation/platform/secret-rotation/datadog-api-key",+ description: "Learn how to automatically rotate Datadog API keys.",+ category: "Monitoring",+ rotationType: "Dual-Phase",+ },{name: "LiteLLM API Key",slug: "litellm-api-key",diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApiKeyRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApiKeyRotationGeneratedCredentials.tsxnew file mode 100644index 0000000000..399b3f52cc--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApiKeyRotationGeneratedCredentials.tsx@@ -0,0 +1,38 @@+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";+import { TDatadogApiKeyRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/datadog-api-key-rotation";++import { ViewRotationGeneratedCredentialsDisplay } from "./shared";++type Props = {+ generatedCredentialsResponse: TDatadogApiKeyRotationGeneratedCredentialsResponse;+};++export const ViewDatadogApiKeyRotationGeneratedCredentials = ({+ generatedCredentialsResponse: { generatedCredentials, activeIndex }+}: Props) => {+ const inactiveIndex = activeIndex === 0 ? 1 : 0;++ const activeCredentials = generatedCredentials[activeIndex];+ const inactiveCredentials = generatedCredentials[inactiveIndex];++ return (+ <ViewRotationGeneratedCredentialsDisplay+ activeCredentials={+ <>+ <CredentialDisplay label="API Key ID">{activeCredentials?.apiKeyId}</CredentialDisplay>+ <CredentialDisplay isSensitive label="API Key">+ {activeCredentials?.apiKey}+ </CredentialDisplay>+ </>+ }+ inactiveCredentials={+ <>+ <CredentialDisplay label="API Key ID">{inactiveCredentials?.apiKeyId}</CredentialDisplay>+ <CredentialDisplay isSensitive label="API Key">+ {inactiveCredentials?.apiKey}+ </CredentialDisplay>+ </>+ }+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsxindex b71e5e393e..a5bee3bcbc 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx@@ -24,6 +24,7 @@ import {import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUserSecretRotationGeneratedCredentials";+import { ViewDatadogApiKeyRotationGeneratedCredentials } from "./ViewDatadogApiKeyRotationGeneratedCredentials";import { ViewDatadogApplicationKeySecretRotationGeneratedCredentials } from "./ViewDatadogApplicationKeySecretRotationGeneratedCredentials";import { ViewDbtServiceTokenRotationGeneratedCredentials } from "./ViewDbtSeviceTokenRotationGeneratedCredentials";import { ViewFireworksApiKeyRotationGeneratedCredentials } from "./ViewFireworksApiKeyRotationGeneratedCredentials";@@ -206,6 +207,13 @@ const Content = ({ secretRotation }: ContentProps) => {/>);break;+ case SecretRotation.DatadogApiKey:+ Component = (+ <ViewDatadogApiKeyRotationGeneratedCredentials+ generatedCredentialsResponse={generatedCredentialsResponse}+ />+ );+ break;case SecretRotation.ConvexAccessKey:Component = (<ViewConvexAccessKeyRotationGeneratedCredentialsdiff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsxnew file mode 100644index 0000000000..6954c385de--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApiKeyRotationParametersFields.tsx@@ -0,0 +1,38 @@+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 } from "@app/hooks/api/secretRotationsV2";++/** Max length for the generated Datadog API key name (matches backend schema). */+const DATADOG_API_KEY_NAME_MAX_LENGTH = 255;++export const DatadogApiKeyRotationParametersFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApiKey;+ }+ >();++ return (+ <Controller+ name="parameters.name"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl+ isError={Boolean(error)}+ errorText={error?.message}+ label="Key Name"+ tooltipText="The name for the generated Datadog API key"+ >+ <Input+ value={value}+ onChange={onChange}+ placeholder="Infisical Rotated API Key"+ maxLength={DATADOG_API_KEY_NAME_MAX_LENGTH}+ />+ </FormControl>+ )}+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsxindex 7927e39604..909ca75844 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/SecretRotationV2ParametersFields.tsx@@ -8,6 +8,7 @@ import { AwsIamUserSecretRotationParametersFields } from "./AwsIamUserSecretRotaimport { AzureClientSecretRotationParametersFields } from "./AzureClientSecretRotationParametersFields";import { ConvexAccessKeyRotationParametersFields } from "./ConvexAccessKeyRotationParametersFields";import { DatabricksServicePrincipalSecretRotationParametersFields } from "./DatabricksServicePrincipalSecretRotationParametersFields";+import { DatadogApiKeyRotationParametersFields } from "./DatadogApiKeyRotationParametersFields";import { DatadogApplicationKeySecretRotationParametersFields } from "./DatadogApplicationKeySecretRotationParametersFields";import { DbtServiceTokenRotationParametersFields } from "./DbtServiceTokenRotationParametersFields";import { FireworksApiKeyRotationParametersFields } from "./FireworksApiKeyRotationParametersFields";@@ -49,6 +50,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields,[SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationParametersFields,[SecretRotation.DatadogApplicationKeySecret]: DatadogApplicationKeySecretRotationParametersFields,+ [SecretRotation.DatadogApiKey]: DatadogApiKeyRotationParametersFields,[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationParametersFields,[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationParametersFields};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsxnew file mode 100644index 0000000000..8bf7fe0c88--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApiKeyRotationReviewFields.tsx@@ -0,0 +1,29 @@+import { useFormContext } from "react-hook-form";++import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";+import { GenericFieldLabel } from "@app/components/v2";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";++import { SecretRotationReviewSection } from "./shared";++export const DatadogApiKeyRotationReviewFields = () => {+ const { watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApiKey;+ }+ >();++ const [{ name }, { apiKeyId, apiKey }] = watch(["parameters", "secretsMapping"]);++ return (+ <>+ <SecretRotationReviewSection label="Parameters">+ <GenericFieldLabel label="Key Name">{name}</GenericFieldLabel>+ </SecretRotationReviewSection>+ <SecretRotationReviewSection label="Secrets Mapping">+ <GenericFieldLabel label="API Key ID">{apiKeyId}</GenericFieldLabel>+ <GenericFieldLabel label="API Key">{apiKey}</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.tsxindex f571a4ae75..b328ab88ae 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/SecretRotationReviewFields.tsx@@ -11,6 +11,7 @@ import { AwsIamUserSecretRotationReviewFields } from "./AwsIamUserSecretRotationimport { AzureClientSecretRotationReviewFields } from "./AzureClientSecretRotationReviewFields";import { ConvexAccessKeyRotationReviewFields } from "./ConvexAccessKeyRotationReviewFields";import { DatabricksServicePrincipalSecretRotationReviewFields } from "./DatabricksServicePrincipalSecretRotationReviewFields";+import { DatadogApiKeyRotationReviewFields } from "./DatadogApiKeyRotationReviewFields";import { DatadogApplicationKeySecretRotationReviewFields } from "./DatadogApplicationKeySecretRotationReviewFields";import { DbtServiceTokenRotationReviewFields } from "./DbtServiceTokenRotationReviewFields";import { FireworksApiKeyRotationReviewFields } from "./FireworksApiKeyRotationReviewFields";@@ -51,6 +52,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields,[SecretRotation.SalesforceOauthCredentials]: SalesforceOauthCredentialsRotationReviewFields,[SecretRotation.DatadogApplicationKeySecret]: DatadogApplicationKeySecretRotationReviewFields,+ [SecretRotation.DatadogApiKey]: DatadogApiKeyRotationReviewFields,[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationReviewFields,[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationReviewFields};diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsxnew file mode 100644index 0000000000..b228454c51--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApiKeyRotationSecretsMappingFields.tsx@@ -0,0 +1,58 @@+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 DatadogApiKeyRotationSecretsMappingFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApiKey;+ }+ >();++ const { rotationOption } = useSecretRotationV2Option(SecretRotation.DatadogApiKey);++ const items = [+ {+ name: "API 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.apiKeyId}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.apiKeyId"+ />+ )+ },+ {+ name: "API 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.apiKey}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.apiKey"+ />+ )+ }+ ];++ 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.tsxindex b9dfb92d48..54ec002a27 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/SecretRotationV2SecretsMappingFields.tsx@@ -8,6 +8,7 @@ import { AwsIamUserSecretRotationSecretsMappingFields } from "./AwsIamUserSecretimport { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecretRotationSecretsMappingFields";import { ConvexAccessKeyRotationSecretsMappingFields } from "./ConvexAccessKeyRotationSecretsMappingFields";import { DatabricksServicePrincipalSecretRotationSecretsMappingFields } from "./DatabricksServicePrincipalSecretRotationSecretsMappingFields";+import { DatadogApiKeyRotationSecretsMappingFields } from "./DatadogApiKeyRotationSecretsMappingFields";import { DatadogApplicationKeySecretRotationSecretsMappingFields } from "./DatadogApplicationKeySecretRotationSecretsMappingFields";import { DbtServiceTokenRotationSecretsMappingFields } from "./DbtServiceTokenRotationSecretsMappingFields";import { FireworksApiKeyRotationSecretsMappingFields } from "./FireworksApiKeyRotationSecretsMappingFields";@@ -50,6 +51,7 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {SalesforceOauthCredentialsRotationSecretsMappingFields,[SecretRotation.DatadogApplicationKeySecret]:DatadogApplicationKeySecretRotationSecretsMappingFields,+ [SecretRotation.DatadogApiKey]: DatadogApiKeyRotationSecretsMappingFields,[SecretRotation.ConvexAccessKey]: ConvexAccessKeyRotationSecretsMappingFields,[SecretRotation.FireworksApiKey]: FireworksApiKeyRotationSecretsMappingFields};diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-api-key-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-api-key-rotation-schema.tsnew file mode 100644index 0000000000..ed76703db2--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-api-key-rotation-schema.ts@@ -0,0 +1,17 @@+import { z } from "zod";++import { BaseSecretRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/base-secret-rotation-v2-schema";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";++export const DatadogApiKeyRotationSchema = z+ .object({+ type: z.literal(SecretRotation.DatadogApiKey),+ parameters: z.object({+ name: z.string().trim().min(1, "Key name required")+ }),+ secretsMapping: z.object({+ apiKeyId: z.string().trim().min(1, "API Key ID secret name required"),+ apiKey: z.string().trim().min(1, "API 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.tsindex 7695ebc66f..82535830d9 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/secretRotatiimport { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";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";import { DbtServiceTokenRotationSchema } from "./dbt-service-token-rotation-schema";import { FireworksApiKeyRotationSchema } from "./fireworks-api-key-rotation-schema";@@ -57,6 +58,7 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>SupabaseApiKeyRotationSchema,SalesforceOauthCredentialsRotationSchema,DatadogApplicationKeySecretRotationSchema,+ DatadogApiKeyRotationSchema,ConvexAccessKeyRotationSchema,FireworksApiKeyRotationSchema]),diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.tsindex 839c167a45..07cce27b54 100644--- a/frontend/src/helpers/secretRotationsV2.ts+++ b/frontend/src/helpers/secretRotationsV2.ts@@ -115,6 +115,11 @@ export const SECRET_ROTATION_MAP: Record<image: "DatadogWhite.png",size: 50},+ [SecretRotation.DatadogApiKey]: {+ name: "Datadog API Key",+ image: "DatadogWhite.png",+ size: 50+ },[SecretRotation.ConvexAccessKey]: {name: "Convex Access Key",image: "Convex.png",@@ -150,6 +155,7 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.SupabaseApiKey]: AppConnection.Supabase,[SecretRotation.SalesforceOauthCredentials]: AppConnection.Salesforce,[SecretRotation.DatadogApplicationKeySecret]: AppConnection.Datadog,+ [SecretRotation.DatadogApiKey]: AppConnection.Datadog,[SecretRotation.ConvexAccessKey]: AppConnection.Convex,[SecretRotation.FireworksApiKey]: AppConnection.Fireworks};@@ -178,6 +184,7 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {[SecretRotation.SupabaseApiKey]: true,[SecretRotation.SalesforceOauthCredentials]: true,[SecretRotation.DatadogApplicationKeySecret]: true,+ [SecretRotation.DatadogApiKey]: true,[SecretRotation.ConvexAccessKey]: true,[SecretRotation.FireworksApiKey]: true};diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.tsindex 86de187c58..6716c6be7a 100644--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts@@ -21,6 +21,7 @@ export enum SecretRotation {SupabaseApiKey = "supabase-api-key",SalesforceOauthCredentials = "salesforce-oauth-credentials",DatadogApplicationKeySecret = "datadog-application-key-secret",+ DatadogApiKey = "datadog-api-key",ConvexAccessKey = "convex-access-key",FireworksApiKey = "fireworks-api-key"}diff --git a/frontend/src/hooks/api/secretRotationsV2/types/datadog-api-key-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/datadog-api-key-rotation.tsnew file mode 100644index 0000000000..3c12b25eaa--- /dev/null+++ b/frontend/src/hooks/api/secretRotationsV2/types/datadog-api-key-rotation.ts@@ -0,0 +1,37 @@+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 TDatadogApiKeyRotation = TSecretRotationV2Base & {+ type: SecretRotation.DatadogApiKey;+ parameters: {+ name: string;+ };+ secretsMapping: {+ apiKeyId: string;+ apiKey: string;+ };+};++export type TDatadogApiKeyRotationGeneratedCredentials = {+ apiKeyId: string;+ apiKey: string;+};++export type TDatadogApiKeyRotationGeneratedCredentialsResponse =+ TSecretRotationV2GeneratedCredentialsResponseBase<+ SecretRotation.DatadogApiKey,+ TDatadogApiKeyRotationGeneratedCredentials+ >;++export type TDatadogApiKeyRotationOption = {+ name: string;+ type: SecretRotation.DatadogApiKey;+ connection: AppConnection.Datadog;+ template: {+ secretsMapping: TDatadogApiKeyRotation["secretsMapping"];+ };+};diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.tsindex cb12686b90..e54c8b48fb 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts@@ -41,6 +41,11 @@ import {TConvexAccessKeyRotationGeneratedCredentialsResponse,TConvexAccessKeyRotationOption} from "./convex-access-key-rotation";+import {+ TDatadogApiKeyRotation,+ TDatadogApiKeyRotationGeneratedCredentialsResponse,+ TDatadogApiKeyRotationOption+} from "./datadog-api-key-rotation";import {TDatadogApplicationKeySecretRotation,TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse,@@ -143,6 +148,7 @@ export type TSecretRotationV2 = (| TSupabaseApiKeyRotation| TSalesforceOauthCredentialsRotation| TDatadogApplicationKeySecretRotation+ | TDatadogApiKeyRotation| TConvexAccessKeyRotation| TFireworksApiKeyRotation) & {@@ -169,6 +175,7 @@ export type TSecretRotationV2Option =| TSupabaseApiKeyRotationOption| TSalesforceOauthCredentialsRotationOption| TDatadogApplicationKeySecretRotationOption+ | TDatadogApiKeyRotationOption| TConvexAccessKeyRotationOption| TFireworksApiKeyRotationOption;@@ -199,6 +206,7 @@ export type TViewSecretRotationGeneratedCredentialsResponse =| TSupabaseApiKeyRotationGeneratedCredentialsResponse| TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse| TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse+ | TDatadogApiKeyRotationGeneratedCredentialsResponse| TConvexAccessKeyRotationGeneratedCredentialsResponse| TFireworksApiKeyRotationGeneratedCredentialsResponse;@@ -277,6 +285,7 @@ export type TSecretRotationOptionMap = {[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationOption;[SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationOption;[SecretRotation.DatadogApplicationKeySecret]: TDatadogApplicationKeySecretRotationOption;+ [SecretRotation.DatadogApiKey]: TDatadogApiKeyRotationOption;[SecretRotation.ConvexAccessKey]: TConvexAccessKeyRotationOption;[SecretRotation.FireworksApiKey]: TFireworksApiKeyRotationOption;};@@ -304,6 +313,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationGeneratedCredentialsResponse;[SecretRotation.SalesforceOauthCredentials]: TSalesforceOauthCredentialsRotationGeneratedCredentialsResponse;[SecretRotation.DatadogApplicationKeySecret]: TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse;+ [SecretRotation.DatadogApiKey]: TDatadogApiKeyRotationGeneratedCredentialsResponse;[SecretRotation.ConvexAccessKey]: TConvexAccessKeyRotationGeneratedCredentialsResponse;[SecretRotation.FireworksApiKey]: TFireworksApiKeyRotationGeneratedCredentialsResponse;};