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
add secret rotation for datadog
adilson1a6c005a9bb1
diff --git a/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-application-key-secret-rotation-router.ts b/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-application-key-secret-rotation-router.tsnew file mode 100644index 0000000000..43ae68e3c3--- /dev/null+++ b/backend/src/ee/routes/v2/secret-rotation-v2-routers/datadog-application-key-secret-rotation-router.ts@@ -0,0 +1,19 @@+import {+ CreateDatadogApplicationKeySecretRotationSchema,+ DatadogApplicationKeySecretRotationGeneratedCredentialsSchema,+ DatadogApplicationKeySecretRotationSchema,+ UpdateDatadogApplicationKeySecretRotationSchema+} from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret";+import { SecretRotation } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";++import { registerSecretRotationEndpoints } from "./secret-rotation-v2-endpoints";++export const registerDatadogApplicationKeySecretRotationRouter = async (server: FastifyZodProvider) =>+ registerSecretRotationEndpoints({+ type: SecretRotation.DatadogApplicationKeySecret,+ server,+ responseSchema: DatadogApplicationKeySecretRotationSchema,+ createSchema: CreateDatadogApplicationKeySecretRotationSchema,+ updateSchema: UpdateDatadogApplicationKeySecretRotationSchema,+ generatedCredentialsSchema: DatadogApplicationKeySecretRotationGeneratedCredentialsSchema+ });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 07cef7ba2c..fd79c52813 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@@ -4,6 +4,7 @@ import { registerAuth0ClientSecretRotationRouter } from "./auth0-client-secret-rimport { registerAwsIamUserSecretRotationRouter } from "./aws-iam-user-secret-rotation-router";import { registerAzureClientSecretRotationRouter } from "./azure-client-secret-rotation-router";import { registerDatabricksServicePrincipalSecretRotationRouter } from "./databricks-service-principal-secret-rotation-router";+import { registerDatadogApplicationKeySecretRotationRouter } from "./datadog-application-key-secret-rotation-router";import { registerDbtServiceTokenRotationRouter } from "./dbt-service-token-rotation-router";import { registerHpIloRotationRouter } from "./hp-ilo-rotation-router";import { registerLdapPasswordRotationRouter } from "./ldap-password-rotation-router";@@ -42,5 +43,6 @@ export const SECRET_ROTATION_REGISTER_ROUTER_MAP: Record<[SecretRotation.WindowsLocalAccount]: registerWindowsLocalAccountRotationRouter,[SecretRotation.OpenRouterApiKey]: registerOpenRouterApiKeyRotationRouter,[SecretRotation.HpIloLocalAccount]: registerHpIloRotationRouter,- [SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter+ [SecretRotation.SupabaseApiKey]: registerSupabaseApiKeyRotationRouter,+ [SecretRotation.DatadogApplicationKeySecret]: registerDatadogApplicationKeySecretRotationRouter};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 e5ff3d6d48..b52982e713 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@@ -5,6 +5,7 @@ import { Auth0ClientSecretRotationListItemSchema } from "@app/ee/services/secretimport { AwsIamUserSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/aws-iam-user-secret";import { AzureClientSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/azure-client-secret";import { DatabricksServicePrincipalSecretRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret";+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 { HpIloRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/hp-ilo-rotation";import { LdapPasswordRotationListItemSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";@@ -43,7 +44,8 @@ const SecretRotationV2OptionsSchema = z.discriminatedUnion("type", [WindowsLocalAccountRotationListItemSchema,OpenRouterApiKeyRotationListItemSchema,HpIloRotationListItemSchema,- SupabaseApiKeyRotationListItemSchema+ SupabaseApiKeyRotationListItemSchema,+ DatadogApplicationKeySecretRotationListItemSchema]);export const registerSecretRotationV2Router = async (server: FastifyZodProvider) => {diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-constants.ts b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-constants.tsnew file mode 100644index 0000000000..a971f82e73--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-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_APPLICATION_KEY_SECRET_ROTATION_LIST_OPTION: TSecretRotationV2ListItem = {+ name: "Datadog Application Key Secret",+ type: SecretRotation.DatadogApplicationKeySecret,+ connection: AppConnection.Datadog,+ template: {+ secretsMapping: {+ applicationKeyId: "DATADOG_APPLICATION_KEY_ID",+ applicationKey: "DATADOG_APPLICATION_KEY"+ }+ }+};diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns.tsnew file mode 100644index 0000000000..647a7362d6--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns.ts@@ -0,0 +1,242 @@+import { AxiosError } from "axios";++import {+ TRotationFactory,+ TRotationFactoryGetSecretsPayload,+ TRotationFactoryIssueCredentials,+ TRotationFactoryRevokeCredentials,+ TRotationFactoryRotateCredentials+} from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-types";+import { request } from "@app/lib/config/request";+import { BadRequestError } from "@app/lib/errors";+import { logger } from "@app/lib/logger";+import {+ getDatadogAuthHeaders,+ getDatadogBaseUrl,+ getDatadogErrorMessage,+ TDatadogConnection+} from "@app/services/app-connection/datadog";++import {+ TDatadogApplicationKeySecretRotationGeneratedCredentials,+ TDatadogApplicationKeySecretRotationWithConnection+} from "./datadog-application-key-secret-rotation-types";++export type TDatadogServiceAccount = {+ id: string;+ name: string;+};++type TDatadogServiceAccountResponse = {+ data: Array<{+ id: string;+ type: string;+ attributes?: {+ name?: string | null;+ email?: string | null;+ handle?: string | null;+ disabled?: boolean;+ };+ }>;+};++type TDatadogCreateApplicationKeyResponse = {+ data: {+ id: string;+ type: string;+ attributes: {+ name: string;+ key: string;+ created_at?: string;+ last4?: string;+ };+ };+};++export const listDatadogServiceAccounts = async (connection: TDatadogConnection): Promise<TDatadogServiceAccount[]> => {+ const baseUrl = await getDatadogBaseUrl(connection);++ try {+ const { data } = await request.get<TDatadogServiceAccountResponse>(`${baseUrl}/api/v2/users`, {+ params: {+ "filter[service_account]": "true",+ "page[size]": 100+ },+ headers: getDatadogAuthHeaders(connection.credentials)+ });++ return (data.data ?? [])+ .filter((entry) => !entry.attributes?.disabled)+ .map((entry) => ({+ id: entry.id,+ name: entry.attributes?.name || entry.attributes?.email || entry.attributes?.handle || entry.id+ }));+ } catch (error: unknown) {+ throw new BadRequestError({+ message: `Failed to list Datadog service accounts: ${getDatadogErrorMessage(error)}`+ });+ }+};++export const datadogApplicationKeySecretRotationFactory: TRotationFactory<+ TDatadogApplicationKeySecretRotationWithConnection,+ TDatadogApplicationKeySecretRotationGeneratedCredentials+> = (secretRotation) => {+ const {+ id: rotationId,+ connection,+ parameters: { serviceAccountId },+ secretsMapping+ } = secretRotation;++ const authHeaders = getDatadogAuthHeaders(connection.credentials);++ let baseUrlCache: string | undefined;+ const resolveBaseUrl = async () => {+ baseUrlCache ??= await getDatadogBaseUrl(connection);+ return baseUrlCache;+ };++ const $createApplicationKey = async () => {+ const baseUrl = await resolveBaseUrl();++ logger.info(`Creating Datadog application key for service account ${serviceAccountId} on base URL: ${baseUrl}`);+ try {+ const { data } = await request.post<TDatadogCreateApplicationKeyResponse>(+ `${baseUrl}/api/v2/service_accounts/${serviceAccountId}/application_keys`,+ {+ data: {+ type: "application_keys",+ attributes: {+ name: `infisical-rotation-${Date.now()}`+ }+ }+ },+ {+ headers: { ...authHeaders, "Content-Type": "application/json" }+ }+ );++ if (!data?.data?.id || !data?.data?.attributes?.key) {+ throw new BadRequestError({+ message: "Datadog application key response missing 'id' or 'attributes.key'"+ });+ }++ return { applicationKeyId: data.data.id, applicationKey: data.data.attributes.key };+ } catch (error: unknown) {+ if (error instanceof BadRequestError) throw error;+ throw new BadRequestError({+ message: `Failed to create Datadog application key for service account ${serviceAccountId}: ${getDatadogErrorMessage(error)}`+ });+ }+ };++ const $deleteApplicationKey = async (applicationKeyId: string) => {+ const baseUrl = await resolveBaseUrl();++ try {+ await request.delete(+ `${baseUrl}/api/v2/service_accounts/${serviceAccountId}/application_keys/${applicationKeyId}`,+ { 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 application key ${applicationKeyId} for service account ${serviceAccountId}: ${getDatadogErrorMessage(error)}`+ });+ }+ };++ const $issueAndValidateKey = async () => {+ const created = await $createApplicationKey();++ logger.info(`baseUrl: ${await resolveBaseUrl()}`);++ try {+ const baseUrl = await resolveBaseUrl();+ await request.get(`${baseUrl}/api/v1/validate`, {+ headers: { "DD-API-KEY": connection.credentials.apiKey, "DD-APPLICATION-KEY": created.applicationKey }+ });+ } catch (error) {+ try {+ await $deleteApplicationKey(created.applicationKeyId);+ } catch (cleanupError) {+ logger.error(+ cleanupError,+ `datadogApplicationKeySecretRotation: failed to revoke unvalidated key [rotationId=${rotationId}] [keyId=${created.applicationKeyId}]`+ );+ }+ if (error instanceof BadRequestError) throw error;+ throw new BadRequestError({+ message: `Failed to validate newly issued Datadog application key: ${getDatadogErrorMessage(error)}`+ });+ }++ return created;+ };++ const issueCredentials: TRotationFactoryIssueCredentials<+ TDatadogApplicationKeySecretRotationGeneratedCredentials+ > = async (callback) => {+ const credentials = await $issueAndValidateKey();+ return callback(credentials);+ };++ const revokeCredentials: TRotationFactoryRevokeCredentials<+ TDatadogApplicationKeySecretRotationGeneratedCredentials+ > = async (generatedCredentials, callback) => {+ if (!generatedCredentials?.length) return callback();++ const results = await Promise.allSettled(+ generatedCredentials.map((credential) => $deleteApplicationKey(credential.applicationKeyId))+ );++ results.forEach((result, index) => {+ if (result.status === "rejected") {+ logger.error(+ result.reason,+ `datadogApplicationKeySecretRotation: failed to revoke key during cleanup [rotationId=${rotationId}] [keyId=${generatedCredentials[index].applicationKeyId}]`+ );+ }+ });++ return callback();+ };++ // Issue first, then revoke the previously-inactive key. If issue fails, the old key remains usable+ // and we avoid leaving the service account keyless.+ const rotateCredentials: TRotationFactoryRotateCredentials<+ TDatadogApplicationKeySecretRotationGeneratedCredentials+ > = async (credentialsToRevoke, callback) => {+ const credentials = await $issueAndValidateKey();++ if (credentialsToRevoke?.applicationKeyId) {+ try {+ await $deleteApplicationKey(credentialsToRevoke.applicationKeyId);+ } catch (revokeError) {+ logger.error(+ revokeError,+ `datadogApplicationKeySecretRotation: failed to revoke previous key after rotation [rotationId=${rotationId}] [keyId=${credentialsToRevoke.applicationKeyId}]`+ );+ }+ }++ return callback(credentials);+ };++ const getSecretsPayload: TRotationFactoryGetSecretsPayload<+ TDatadogApplicationKeySecretRotationGeneratedCredentials+ > = (generatedCredentials) => [+ { key: secretsMapping.applicationKeyId, value: generatedCredentials.applicationKeyId },+ { key: secretsMapping.applicationKey, value: generatedCredentials.applicationKey }+ ];++ return {+ issueCredentials,+ revokeCredentials,+ rotateCredentials,+ getSecretsPayload+ };+};diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-schemas.tsnew file mode 100644index 0000000000..3e2dca40c5--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-schemas.ts@@ -0,0 +1,73 @@+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";++export const DatadogApplicationKeySecretRotationGeneratedCredentialsSchema = z+ .object({+ applicationKeyId: z.string(),+ applicationKey: z.string()+ })+ .array()+ .min(1)+ .max(2);++const DatadogApplicationKeySecretRotationParametersSchema = z.object({+ serviceAccountId: z+ .string()+ .trim()+ .min(1, "Service Account ID required")+ .describe(SecretRotations.PARAMETERS.DATADOG_APPLICATION_KEY_SECRET.serviceAccountId)+});++const DatadogApplicationKeySecretRotationSecretsMappingSchema = z.object({+ applicationKeyId: SecretNameSchema.describe(+ SecretRotations.SECRETS_MAPPING.DATADOG_APPLICATION_KEY_SECRET.applicationKeyId+ ),+ applicationKey: SecretNameSchema.describe(+ SecretRotations.SECRETS_MAPPING.DATADOG_APPLICATION_KEY_SECRET.applicationKey+ )+});++export const DatadogApplicationKeySecretRotationTemplateSchema = z.object({+ secretsMapping: z.object({+ applicationKeyId: z.string(),+ applicationKey: z.string()+ })+});++export const DatadogApplicationKeySecretRotationSchema = BaseSecretRotationSchema(+ SecretRotation.DatadogApplicationKeySecret+).extend({+ type: z.literal(SecretRotation.DatadogApplicationKeySecret),+ parameters: DatadogApplicationKeySecretRotationParametersSchema,+ secretsMapping: DatadogApplicationKeySecretRotationSecretsMappingSchema+});++export const CreateDatadogApplicationKeySecretRotationSchema = BaseCreateSecretRotationSchema(+ SecretRotation.DatadogApplicationKeySecret+).extend({+ parameters: DatadogApplicationKeySecretRotationParametersSchema,+ secretsMapping: DatadogApplicationKeySecretRotationSecretsMappingSchema+});++export const UpdateDatadogApplicationKeySecretRotationSchema = BaseUpdateSecretRotationSchema(+ SecretRotation.DatadogApplicationKeySecret+).extend({+ parameters: DatadogApplicationKeySecretRotationParametersSchema.optional(),+ secretsMapping: DatadogApplicationKeySecretRotationSecretsMappingSchema.optional()+});++export const DatadogApplicationKeySecretRotationListItemSchema = z.object({+ name: z.literal("Datadog Application Key Secret"),+ connection: z.literal(AppConnection.Datadog),+ type: z.literal(SecretRotation.DatadogApplicationKeySecret),+ template: DatadogApplicationKeySecretRotationTemplateSchema+});diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-types.ts b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-types.tsnew file mode 100644index 0000000000..2c24c8d552--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-types.ts@@ -0,0 +1,26 @@+import { z } from "zod";++import { TDatadogConnection } from "@app/services/app-connection/datadog";++import {+ CreateDatadogApplicationKeySecretRotationSchema,+ DatadogApplicationKeySecretRotationGeneratedCredentialsSchema,+ DatadogApplicationKeySecretRotationListItemSchema,+ DatadogApplicationKeySecretRotationSchema+} from "./datadog-application-key-secret-rotation-schemas";++export type TDatadogApplicationKeySecretRotation = z.infer<typeof DatadogApplicationKeySecretRotationSchema>;++export type TDatadogApplicationKeySecretRotationInput = z.infer<typeof CreateDatadogApplicationKeySecretRotationSchema>;++export type TDatadogApplicationKeySecretRotationListItem = z.infer<+ typeof DatadogApplicationKeySecretRotationListItemSchema+>;++export type TDatadogApplicationKeySecretRotationWithConnection = TDatadogApplicationKeySecretRotation & {+ connection: TDatadogConnection;+};++export type TDatadogApplicationKeySecretRotationGeneratedCredentials = z.infer<+ typeof DatadogApplicationKeySecretRotationGeneratedCredentialsSchema+>;diff --git a/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/index.ts b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/index.tsnew file mode 100644index 0000000000..0d066c6c3b--- /dev/null+++ b/backend/src/ee/services/secret-rotation-v2/datadog-application-key-secret/index.ts@@ -0,0 +1,3 @@+export * from "./datadog-application-key-secret-rotation-constants";+export * from "./datadog-application-key-secret-rotation-schemas";+export * from "./datadog-application-key-secret-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 4643531cc8..5e6b26e51a 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@@ -16,7 +16,8 @@ export enum SecretRotation {WindowsLocalAccount = "windows-local-account",OpenRouterApiKey = "open-router-api-key",HpIloLocalAccount = "hp-ilo-local-account",- SupabaseApiKey = "supabase-api-key"+ SupabaseApiKey = "supabase-api-key",+ DatadogApplicationKeySecret = "datadog-application-key-secret"}export enum SecretRotationStatus {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 3a47fa50b2..3374909e21 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@@ -10,6 +10,7 @@ import { AUTH0_CLIENT_SECRET_ROTATION_LIST_OPTION } from "./auth0-client-secret"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 { DATABRICKS_SERVICE_PRINCIPAL_SECRET_ROTATION_LIST_OPTION } from "./databricks-service-principal-secret";+import { DATADOG_APPLICATION_KEY_SECRET_ROTATION_LIST_OPTION } from "./datadog-application-key-secret";import { DBT_SERVICE_TOKEN_ROTATION_LIST_OPTION } from "./dbt-service-token";import { HP_ILO_ROTATION_LIST_OPTION, THpIloRotation } from "./hp-ilo-rotation";import { LDAP_PASSWORD_ROTATION_LIST_OPTION, TLdapPasswordRotation } from "./ldap-password";@@ -60,7 +61,8 @@ const SECRET_ROTATION_LIST_OPTIONS: Record<SecretRotation, TSecretRotationV2List[SecretRotation.WindowsLocalAccount]: WINDOWS_LOCAL_ACCOUNT_ROTATION_LIST_OPTION,[SecretRotation.OpenRouterApiKey]: OPEN_ROUTER_API_KEY_ROTATION_LIST_OPTION,[SecretRotation.HpIloLocalAccount]: HP_ILO_ROTATION_LIST_OPTION,- [SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION+ [SecretRotation.SupabaseApiKey]: SUPABASE_API_KEY_ROTATION_LIST_OPTION,+ [SecretRotation.DatadogApplicationKeySecret]: DATADOG_APPLICATION_KEY_SECRET_ROTATION_LIST_OPTION};export const listSecretRotationOptions = () => {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 ca22e153cc..3944eba60e 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@@ -19,7 +19,8 @@ export const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.WindowsLocalAccount]: "Windows Local Account",[SecretRotation.OpenRouterApiKey]: "OpenRouter API Key",[SecretRotation.HpIloLocalAccount]: "HP iLO Local Account",- [SecretRotation.SupabaseApiKey]: "Supabase API Key"+ [SecretRotation.SupabaseApiKey]: "Supabase API Key",+ [SecretRotation.DatadogApplicationKeySecret]: "Datadog Application Key"};export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnection> = {@@ -40,5 +41,6 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,- [SecretRotation.SupabaseApiKey]: AppConnection.Supabase+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase,+ [SecretRotation.DatadogApplicationKeySecret]: AppConnection.Datadog};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 2508742402..bbd4ab5dba 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@@ -16,6 +16,7 @@ import {import { auth0ClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/auth0-client-secret/auth0-client-secret-rotation-fns";import { azureClientSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-fns";import { databricksServicePrincipalSecretRotationFactory } from "@app/ee/services/secret-rotation-v2/databricks-service-principal-secret/databricks-service-principal-secret-rotation-fns";+import { datadogApplicationKeySecretRotationFactory } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns";import { ldapPasswordRotationFactory } from "@app/ee/services/secret-rotation-v2/ldap-password/ldap-password-rotation-fns";import { SecretRotation, SecretRotationStatus } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-enums";import {@@ -186,7 +187,9 @@ const SECRET_ROTATION_FACTORY_MAP: Record<SecretRotation, TRotationFactoryImplem[SecretRotation.WindowsLocalAccount]: windowsLocalAccountRotationFactory as TRotationFactoryImplementation,[SecretRotation.OpenRouterApiKey]: openRouterApiKeyRotationFactory as TRotationFactoryImplementation,[SecretRotation.HpIloLocalAccount]: hpIloRotationFactory as TRotationFactoryImplementation,- [SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation+ [SecretRotation.SupabaseApiKey]: supabaseApiKeyRotationFactory as TRotationFactoryImplementation,+ [SecretRotation.DatadogApplicationKeySecret]:+ datadogApplicationKeySecretRotationFactory as TRotationFactoryImplementation};export const secretRotationV2ServiceFactory = ({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 e9a67ff84a..6e6ed6e2d1 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@@ -35,6 +35,13 @@ import {TDatabricksServicePrincipalSecretRotationListItem,TDatabricksServicePrincipalSecretRotationWithConnection} from "./databricks-service-principal-secret";+import {+ TDatadogApplicationKeySecretRotation,+ TDatadogApplicationKeySecretRotationGeneratedCredentials,+ TDatadogApplicationKeySecretRotationInput,+ TDatadogApplicationKeySecretRotationListItem,+ TDatadogApplicationKeySecretRotationWithConnection+} from "./datadog-application-key-secret";import {TDbtServiceTokenRotation,TDbtServiceTokenRotationGeneratedCredentials,@@ -149,7 +156,8 @@ export type TSecretRotationV2 =| TWindowsLocalAccountRotation| TOpenRouterApiKeyRotation| THpIloRotation- | TSupabaseApiKeyRotation;+ | TSupabaseApiKeyRotation+ | TDatadogApplicationKeySecretRotation;export type TSecretRotationV2WithConnection =| TPostgresCredentialsRotationWithConnection@@ -169,7 +177,8 @@ export type TSecretRotationV2WithConnection =| TWindowsLocalAccountRotationWithConnection| TOpenRouterApiKeyRotationWithConnection| THpIloRotationWithConnection- | TSupabaseApiKeyRotationWithConnection;+ | TSupabaseApiKeyRotationWithConnection+ | TDatadogApplicationKeySecretRotationWithConnection;export type TSecretRotationV2GeneratedCredentials =| TSqlCredentialsRotationGeneratedCredentials@@ -185,7 +194,8 @@ export type TSecretRotationV2GeneratedCredentials =| TWindowsLocalAccountRotationGeneratedCredentials| TOpenRouterApiKeyRotationGeneratedCredentials| THpIloRotationGeneratedCredentials- | TSupabaseApiKeyRotationGeneratedCredentials;+ | TSupabaseApiKeyRotationGeneratedCredentials+ | TDatadogApplicationKeySecretRotationGeneratedCredentials;export type TSecretRotationV2Input =| TPostgresCredentialsRotationInput@@ -205,7 +215,8 @@ export type TSecretRotationV2Input =| TWindowsLocalAccountRotationInput| TOpenRouterApiKeyRotationInput| THpIloRotationInput- | TSupabaseApiKeyRotationInput;+ | TSupabaseApiKeyRotationInput+ | TDatadogApplicationKeySecretRotationInput;export type TSecretRotationV2ListItem =| TPostgresCredentialsRotationListItem@@ -225,7 +236,8 @@ export type TSecretRotationV2ListItem =| TWindowsLocalAccountRotationListItem| TOpenRouterApiKeyRotationListItem| THpIloRotationListItem- | TSupabaseApiKeyRotationListItem;+ | TSupabaseApiKeyRotationListItem+ | TDatadogApplicationKeySecretRotationListItem;export type TSecretRotationV2TemporaryParameters =| TLdapPasswordRotationInput["temporaryParameters"]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 8b88b76faa..963534e9a3 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 { DatadogApplicationKeySecretRotationSchema } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret";import { LdapPasswordRotationSchema } from "@app/ee/services/secret-rotation-v2/ldap-password";import { MongoDBCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mongodb-credentials";import { MsSqlCredentialsRotationSchema } from "@app/ee/services/secret-rotation-v2/mssql-credentials";@@ -38,5 +39,6 @@ export const SecretRotationV2Schema = z.discriminatedUnion("type", [WindowsLocalAccountRotationSchema,OpenRouterApiKeyRotationSchema,HpIloRotationSchema,- SupabaseApiKeyRotationSchema+ SupabaseApiKeyRotationSchema,+ DatadogApplicationKeySecretRotationSchema]);diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex cac34aad10..75e9abc43d 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -3318,6 +3318,9 @@ export const SecretRotations = {SUPABASE_API_KEY: {projectRef: "The reference ID of the Supabase project to rotate the API key for.",keyType: "The type of the API key to rotate (e.g. publishable, secret)."+ },+ DATADOG_APPLICATION_KEY_SECRET: {+ serviceAccountId: "The ID of the Datadog service account to rotate the application key for."}},SECRETS_MAPPING: {@@ -3381,6 +3384,10 @@ export const SecretRotations = {},SUPABASE_API_KEY: {apiKey: "The name of the secret that the rotated Supabase API key will be mapped to."+ },+ DATADOG_APPLICATION_KEY_SECRET: {+ 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."}}};diff --git a/backend/src/server/routes/v1/app-connection-routers/datadog-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/datadog-connection-router.tsindex 1c2faa8c6c..0b771840f6 100644--- a/backend/src/server/routes/v1/app-connection-routers/datadog-connection-router.ts+++ b/backend/src/server/routes/v1/app-connection-routers/datadog-connection-router.ts@@ -1,9 +1,14 @@+import { z } from "zod";++import { readLimit } from "@app/server/config/rateLimiter";+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { AppConnection } from "@app/services/app-connection/app-connection-enums";import {CreateDatadogConnectionSchema,SanitizedDatadogConnectionSchema,UpdateDatadogConnectionSchema} from "@app/services/app-connection/datadog";+import { AuthMode } from "@app/services/auth/auth-type";import { registerAppConnectionEndpoints } from "./app-connection-endpoints";@@ -15,4 +20,37 @@ export const registerDatadogConnectionRouter = async (server: FastifyZodProvidercreateSchema: CreateDatadogConnectionSchema,updateSchema: UpdateDatadogConnectionSchema});++ // The below endpoints are not exposed and for Infisical App use++ server.route({+ method: "GET",+ url: `/:connectionId/service-accounts`,+ config: {+ rateLimit: readLimit+ },+ schema: {+ operationId: "listDatadogServiceAccounts",+ params: z.object({+ connectionId: z.string().uuid()+ }),+ response: {+ 200: z.object({+ serviceAccounts: z.object({ id: z.string(), name: z.string() }).array()+ })+ }+ },+ onRequest: verifyAuth([AuthMode.JWT]),+ handler: async (req) => {+ const {+ params: { connectionId }+ } = req;++ const serviceAccounts = await server.services.appConnection.datadog.listServiceAccounts(+ connectionId,+ req.permission+ );+ return { serviceAccounts };+ }+ });};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex a209d37336..db20b4fcf5 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -85,6 +85,7 @@ import { TAppConnectionCredentialRotationServiceFactory } from "./credential-rotimport { ValidateDatabricksConnectionCredentialsSchema } from "./databricks";import { databricksConnectionService } from "./databricks/databricks-connection-service";import { ValidateDatadogConnectionCredentialsSchema } from "./datadog";+import { datadogConnectionService } from "./datadog/datadog-connection-service";import { ValidateDbtConnectionCredentialsSchema } from "./dbt";import { dbtConnectionService } from "./dbt/dbt-connection-service";import { ValidateDevinConnectionCredentialsSchema } from "./devin";@@ -1116,6 +1117,7 @@ export const appConnectionServiceFactory = ({northflank: northflankConnectionService(connectAppConnectionById),externalInfisical: externalInfisicalConnectionService(connectAppConnectionById),okta: oktaConnectionService(connectAppConnectionById),+ datadog: datadogConnectionService(connectAppConnectionById),laravelForge: laravelForgeConnectionService(connectAppConnectionById),chef: chefConnectionService(connectAppConnectionById, licenseService),octopusDeploy: octopusDeployConnectionService(connectAppConnectionById),diff --git a/backend/src/services/app-connection/datadog/datadog-connection-fns.ts b/backend/src/services/app-connection/datadog/datadog-connection-fns.tsindex a6dcc8c85e..fd39fe0535 100644--- a/backend/src/services/app-connection/datadog/datadog-connection-fns.ts+++ b/backend/src/services/app-connection/datadog/datadog-connection-fns.ts@@ -3,6 +3,7 @@ import { AxiosError } from "axios";import { request } from "@app/lib/config/request";import { BadRequestError } from "@app/lib/errors";import { removeTrailingSlash } from "@app/lib/fn";+import { logger } from "@app/lib/logger/logger";import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";import { AppConnection } from "../app-connection-enums";@@ -42,27 +43,36 @@ export const getDatadogConnectionListItem = () => {};};+export const getDatadogAuthHeaders = (credentials: { apiKey: string; applicationKey: string }) => ({+ "DD-API-KEY": credentials.apiKey,+ "DD-APPLICATION-KEY": credentials.applicationKey,+ Accept: "application/json"+});++type TDatadogJsonApiError = { detail?: string; title?: string; status?: string };++// Datadog v2 errors use JSON:API shape: { errors: [{ detail, title, status }] }.+// Surface the most actionable field; fall back to axios error.message.+export const getDatadogErrorMessage = (error: unknown): string => {+ if (error instanceof AxiosError) {+ const errors = (error.response?.data as { errors?: TDatadogJsonApiError[] } | undefined)?.errors;+ const first = errors?.[0];+ if (first?.detail) return first.detail;+ if (first?.title) return first.title;+ if (error.message) return error.message;+ }+ if (error instanceof Error && error.message) return error.message;+ return "Unknown error";+};+export const validateDatadogConnectionCredentials = async (config: TDatadogConnectionConfig) => {const baseUrl = await getDatadogBaseUrl(config);- const { apiKey, applicationKey } = config.credentials;try {- await request.get(`${baseUrl}/api/v2/permissions`, {- headers: {- "DD-API-KEY": apiKey,- "DD-APPLICATION-KEY": applicationKey,- Accept: "application/json"- }- });+ await request.get(`${baseUrl}/api/v2/permissions`, { headers: getDatadogAuthHeaders(config.credentials) });} catch (error: unknown) {- if (error instanceof AxiosError) {- throw new BadRequestError({- message: `Failed to validate Datadog credentials: ${error.message || "Unknown error"}`- });- }-throw new BadRequestError({- message: "Failed to validate Datadog credentials - verify URL, API key and Application key are correct"+ message: `Failed to validate Datadog credentials: ${getDatadogErrorMessage(error)}`});}diff --git a/backend/src/services/app-connection/datadog/datadog-connection-service.ts b/backend/src/services/app-connection/datadog/datadog-connection-service.tsnew file mode 100644index 0000000000..ad72d7270a--- /dev/null+++ b/backend/src/services/app-connection/datadog/datadog-connection-service.ts@@ -0,0 +1,22 @@+import { listDatadogServiceAccounts } from "@app/ee/services/secret-rotation-v2/datadog-application-key-secret/datadog-application-key-secret-rotation-fns";+import { OrgServiceActor } from "@app/lib/types";++import { AppConnection } from "../app-connection-enums";+import { TDatadogConnection } from "./datadog-connection-types";++type TGetAppConnectionFunc = (+ app: AppConnection,+ connectionId: string,+ actor: OrgServiceActor+) => Promise<TDatadogConnection>;++export const datadogConnectionService = (getAppConnection: TGetAppConnectionFunc) => {+ const listServiceAccounts = async (connectionId: string, actor: OrgServiceActor) => {+ const appConnection = await getAppConnection(AppConnection.Datadog, connectionId, actor);+ return listDatadogServiceAccounts(appConnection);+ };++ return {+ listServiceAccounts+ };+};diff --git a/backend/src/services/app-connection/datadog/index.ts b/backend/src/services/app-connection/datadog/index.tsindex 67e0dd338b..5f2663e21c 100644--- a/backend/src/services/app-connection/datadog/index.ts+++ b/backend/src/services/app-connection/datadog/index.ts@@ -1,4 +1,5 @@export * from "./datadog-connection-enums";export * from "./datadog-connection-fns";export * from "./datadog-connection-schemas";+export * from "./datadog-connection-service";export * from "./datadog-connection-types";diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApplicationKeySecretRotationGeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApplicationKeySecretRotationGeneratedCredentials.tsxnew file mode 100644index 0000000000..1c19b5c6b9--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewDatadogApplicationKeySecretRotationGeneratedCredentials.tsx@@ -0,0 +1,42 @@+import { CredentialDisplay } from "@app/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/shared/CredentialDisplay";+import { TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse } from "@app/hooks/api/secretRotationsV2/types/datadog-application-key-secret-rotation";++import { ViewRotationGeneratedCredentialsDisplay } from "./shared";++type Props = {+ generatedCredentialsResponse: TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse;+};++export const ViewDatadogApplicationKeySecretRotationGeneratedCredentials = ({+ generatedCredentialsResponse: { generatedCredentials, activeIndex }+}: Props) => {+ const inactiveIndex = activeIndex === 0 ? 1 : 0;++ const activeCredentials = generatedCredentials[activeIndex];+ const inactiveCredentials = generatedCredentials[inactiveIndex];++ return (+ <ViewRotationGeneratedCredentialsDisplay+ activeCredentials={+ <>+ <CredentialDisplay label="Application Key ID">+ {activeCredentials?.applicationKeyId}+ </CredentialDisplay>+ <CredentialDisplay isSensitive label="Application Key">+ {activeCredentials?.applicationKey}+ </CredentialDisplay>+ </>+ }+ inactiveCredentials={+ <>+ <CredentialDisplay label="Application Key ID">+ {inactiveCredentials?.applicationKeyId}+ </CredentialDisplay>+ <CredentialDisplay isSensitive label="Application Key">+ {inactiveCredentials?.applicationKey}+ </CredentialDisplay>+ </>+ }+ />+ );+};diff --git a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsxindex 7a523c686c..6708f17f9f 100644--- a/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx+++ b/frontend/src/components/secret-rotations-v2/ViewSecretRotationV2GeneratedCredentials/ViewSecretRotationV2GeneratedCredentials.tsx@@ -23,6 +23,7 @@ import {import { ViewSqlCredentialsRotationGeneratedCredentials } from "./shared";import { ViewAwsIamUserSecretRotationGeneratedCredentials } from "./ViewAwsIamUserSecretRotationGeneratedCredentials";+import { ViewDatadogApplicationKeySecretRotationGeneratedCredentials } from "./ViewDatadogApplicationKeySecretRotationGeneratedCredentials";import { ViewDbtServiceTokenRotationGeneratedCredentials } from "./ViewDbtSeviceTokenRotationGeneratedCredentials";import { ViewHpIloRotationGeneratedCredentials } from "./ViewHpIloRotationGeneratedCredentials";import { ViewOktaClientSecretRotationGeneratedCredentials } from "./ViewOktaClientSecretRotationGeneratedCredentials";@@ -172,6 +173,13 @@ const Content = ({ secretRotation }: ContentProps) => {/>);break;+ case SecretRotation.DatadogApplicationKeySecret:+ Component = (+ <ViewDatadogApplicationKeySecretRotationGeneratedCredentials+ generatedCredentialsResponse={generatedCredentialsResponse}+ />+ );+ break;default:throw new Error("Unhandled View Generated Credential Rotation Type");}diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsxnew file mode 100644index 0000000000..d9f0bbc0fa--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ParametersFields/DatadogApplicationKeySecretRotationParametersFields.tsx@@ -0,0 +1,47 @@+import { Controller, useFormContext } from "react-hook-form";+import { SingleValue } from "react-select";++import { TSecretRotationV2Form } from "@app/components/secret-rotations-v2/forms/schemas";+import { FilterableSelect, FormControl } from "@app/components/v2";+import { useListDatadogConnectionServiceAccounts } from "@app/hooks/api/appConnections/datadog";+import { TDatadogServiceAccount } from "@app/hooks/api/appConnections/datadog/types";+import { SecretRotation } from "@app/hooks/api/secretRotationsV2";++export const DatadogApplicationKeySecretRotationParametersFields = () => {+ const { control, watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApplicationKeySecret;+ }+ >();++ const connectionId = watch("connection.id");++ const { data: serviceAccounts, isPending: isServiceAccountsPending } =+ useListDatadogConnectionServiceAccounts(connectionId, {+ enabled: Boolean(connectionId)+ });++ return (+ <Controller+ name="parameters.serviceAccountId"+ control={control}+ render={({ field: { value, onChange }, fieldState: { error } }) => (+ <FormControl isError={Boolean(error)} errorText={error?.message} label="Service Account">+ <FilterableSelect+ menuPlacement="top"+ isLoading={isServiceAccountsPending && Boolean(connectionId)}+ isDisabled={!connectionId}+ value={serviceAccounts?.find((serviceAccount) => serviceAccount.id === value) ?? null}+ onChange={(option) => {+ onChange((option as SingleValue<TDatadogServiceAccount>)?.id ?? "");+ }}+ options={serviceAccounts}+ placeholder="Select a service account..."+ getOptionLabel={(option) => option.name}+ getOptionValue={(option) => option.id}+ />+ </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 eab5d623ce..f46dd8bbbf 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 "./Auth0ClientSecretRoimport { AwsIamUserSecretRotationParametersFields } from "./AwsIamUserSecretRotationParametersFields";import { AzureClientSecretRotationParametersFields } from "./AzureClientSecretRotationParametersFields";import { DatabricksServicePrincipalSecretRotationParametersFields } from "./DatabricksServicePrincipalSecretRotationParametersFields";+import { DatadogApplicationKeySecretRotationParametersFields } from "./DatadogApplicationKeySecretRotationParametersFields";import { DbtServiceTokenRotationParametersFields } from "./DbtServiceTokenRotationParametersFields";import { HpIloRotationParametersFields } from "./HpIloRotationParametersFields";import { LdapPasswordRotationParametersFields } from "./LdapPasswordRotationParametersFields";@@ -38,7 +39,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationParametersFields,[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationParametersFields,[SecretRotation.HpIloLocalAccount]: HpIloRotationParametersFields,- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationParametersFields,+ [SecretRotation.DatadogApplicationKeySecret]: DatadogApplicationKeySecretRotationParametersFields};export const SecretRotationV2ParametersFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsxnew file mode 100644index 0000000000..c1540a553d--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2ReviewFields/DatadogApplicationKeySecretRotationReviewFields.tsx@@ -0,0 +1,34 @@+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 DatadogApplicationKeySecretRotationReviewFields = () => {+ const { watch } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApplicationKeySecret;+ }+ >();++ const [parameters, { applicationKeyId, applicationKey }] = watch([+ "parameters",+ "secretsMapping"+ ]);++ return (+ <>+ <SecretRotationReviewSection label="Parameters">+ <GenericFieldLabel label="Service Account ID">+ {parameters.serviceAccountId}+ </GenericFieldLabel>+ </SecretRotationReviewSection>+ <SecretRotationReviewSection label="Secrets Mapping">+ <GenericFieldLabel label="Application Key ID">{applicationKeyId}</GenericFieldLabel>+ <GenericFieldLabel label="Application Key">{applicationKey}</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 cef3ad5faa..cd5016fa6e 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 "./Auth0ClientSecretRotatiimport { AwsIamUserSecretRotationReviewFields } from "./AwsIamUserSecretRotationReviewFields";import { AzureClientSecretRotationReviewFields } from "./AzureClientSecretRotationReviewFields";import { DatabricksServicePrincipalSecretRotationReviewFields } from "./DatabricksServicePrincipalSecretRotationReviewFields";+import { DatadogApplicationKeySecretRotationReviewFields } from "./DatadogApplicationKeySecretRotationReviewFields";import { DbtServiceTokenRotationReviewFields } from "./DbtServiceTokenRotationReviewFields";import { HpIloRotationReviewFields } from "./HpIloRotationReviewFields";import { LdapPasswordRotationReviewFields } from "./LdapPasswordRotationReviewFields";@@ -40,7 +41,8 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationReviewFields,[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationReviewFields,[SecretRotation.HpIloLocalAccount]: HpIloRotationReviewFields,- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationReviewFields,+ [SecretRotation.DatadogApplicationKeySecret]: DatadogApplicationKeySecretRotationReviewFields};export const SecretRotationV2ReviewFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.tsxnew file mode 100644index 0000000000..611309b587--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/DatadogApplicationKeySecretRotationSecretsMappingFields.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 DatadogApplicationKeySecretRotationSecretsMappingFields = () => {+ const { control } = useFormContext<+ TSecretRotationV2Form & {+ type: SecretRotation.DatadogApplicationKeySecret;+ }+ >();++ const { rotationOption } = useSecretRotationV2Option(SecretRotation.DatadogApplicationKeySecret);++ const items = [+ {+ name: "Application 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.applicationKeyId}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.applicationKeyId"+ />+ )+ },+ {+ name: "Application 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.applicationKey}+ />+ </FormControl>+ )}+ control={control}+ name="secretsMapping.applicationKey"+ />+ )+ }+ ];++ 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 e9878c6577..12ad5143d2 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 "./Auth0ClientSecrimport { AwsIamUserSecretRotationSecretsMappingFields } from "./AwsIamUserSecretRotationSecretsMappingFields";import { AzureClientSecretRotationSecretsMappingFields } from "./AzureClientSecretRotationSecretsMappingFields";import { DatabricksServicePrincipalSecretRotationSecretsMappingFields } from "./DatabricksServicePrincipalSecretRotationSecretsMappingFields";+import { DatadogApplicationKeySecretRotationSecretsMappingFields } from "./DatadogApplicationKeySecretRotationSecretsMappingFields";import { DbtServiceTokenRotationSecretsMappingFields } from "./DbtServiceTokenRotationSecretsMappingFields";import { HpIloRotationSecretsMappingFields } from "./HpIloRotationSecretsMappingFields";import { LdapPasswordRotationSecretsMappingFields } from "./LdapPasswordRotationSecretsMappingFields";@@ -37,7 +38,9 @@ const COMPONENT_MAP: Record<SecretRotation, React.FC> = {[SecretRotation.WindowsLocalAccount]: WindowsLocalAccountRotationSecretsMappingFields,[SecretRotation.OpenRouterApiKey]: OpenRouterApiKeyRotationSecretsMappingFields,[SecretRotation.HpIloLocalAccount]: HpIloRotationSecretsMappingFields,- [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields+ [SecretRotation.SupabaseApiKey]: SupabaseApiKeyRotationSecretsMappingFields,+ [SecretRotation.DatadogApplicationKeySecret]:+ DatadogApplicationKeySecretRotationSecretsMappingFields};export const SecretRotationV2SecretsMappingFields = () => {diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-application-key-secret-rotation-schema.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-application-key-secret-rotation-schema.tsnew file mode 100644index 0000000000..e2f4ed0757--- /dev/null+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/datadog-application-key-secret-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 DatadogApplicationKeySecretRotationSchema = z+ .object({+ type: z.literal(SecretRotation.DatadogApplicationKeySecret),+ parameters: z.object({+ serviceAccountId: z.string().trim().min(1, "Service Account required")+ }),+ secretsMapping: z.object({+ applicationKeyId: z.string().trim().min(1, "Application Key ID secret name required"),+ applicationKey: z.string().trim().min(1, "Application 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 863061b4f7..6a12c5b0ce 100644--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts@@ -15,6 +15,7 @@ import { LdapPasswordRotationMethod } from "@app/hooks/api/secretRotationsV2/typimport { UnixLinuxLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/unix-linux-local-account-rotation";import { WindowsLocalAccountRotationMethod } from "@app/hooks/api/secretRotationsV2/types/windows-local-account-rotation";+import { DatadogApplicationKeySecretRotationSchema } from "./datadog-application-key-secret-rotation-schema";import { DbtServiceTokenRotationSchema } from "./dbt-service-token-rotation-schema";import { HpIloRotationSchema } from "./hp-ilo-rotation-schema";import { OktaClientSecretRotationSchema } from "./okta-client-secret-rotation-schema";@@ -46,7 +47,8 @@ export const SecretRotationV2FormSchema = (isUpdate: boolean) =>WindowsLocalAccountRotationSchema,OpenRouterApiKeyRotationSchema,HpIloRotationSchema,- SupabaseApiKeyRotationSchema+ SupabaseApiKeyRotationSchema,+ DatadogApplicationKeySecretRotationSchema]),z.object({ id: z.string().optional() }))diff --git a/frontend/src/helpers/secretRotationsV2.ts b/frontend/src/helpers/secretRotationsV2.tsindex 55afff89bb..e5a325e227 100644--- a/frontend/src/helpers/secretRotationsV2.ts+++ b/frontend/src/helpers/secretRotationsV2.ts@@ -94,6 +94,11 @@ export const SECRET_ROTATION_MAP: Record<name: "Supabase API Key",image: "Supabase.png",size: 50+ },+ [SecretRotation.DatadogApplicationKeySecret]: {+ name: "Datadog Application Key",+ image: "DatadogWhite.png",+ size: 50}};@@ -115,7 +120,8 @@ export const SECRET_ROTATION_CONNECTION_MAP: Record<SecretRotation, AppConnectio[SecretRotation.WindowsLocalAccount]: AppConnection.SMB,[SecretRotation.OpenRouterApiKey]: AppConnection.OpenRouter,[SecretRotation.HpIloLocalAccount]: AppConnection.SSH,- [SecretRotation.SupabaseApiKey]: AppConnection.Supabase+ [SecretRotation.SupabaseApiKey]: AppConnection.Supabase,+ [SecretRotation.DatadogApplicationKeySecret]: AppConnection.Datadog};// if a rotation can potentially have downtime due to rotating a single credential set this to false@@ -137,7 +143,8 @@ export const IS_ROTATION_DUAL_CREDENTIALS: Record<SecretRotation, boolean> = {[SecretRotation.WindowsLocalAccount]: false,[SecretRotation.OpenRouterApiKey]: true,[SecretRotation.HpIloLocalAccount]: false,- [SecretRotation.SupabaseApiKey]: true+ [SecretRotation.SupabaseApiKey]: true,+ [SecretRotation.DatadogApplicationKeySecret]: true};export const getRotateAtLocal = ({ hours, minutes }: TSecretRotationV2["rotateAtUtc"]) => {diff --git a/frontend/src/hooks/api/appConnections/datadog/index.ts b/frontend/src/hooks/api/appConnections/datadog/index.tsnew file mode 100644index 0000000000..2c1906d369--- /dev/null+++ b/frontend/src/hooks/api/appConnections/datadog/index.ts@@ -0,0 +1,2 @@+export * from "./queries";+export * from "./types";diff --git a/frontend/src/hooks/api/appConnections/datadog/queries.tsx b/frontend/src/hooks/api/appConnections/datadog/queries.tsxnew file mode 100644index 0000000000..77802eeebc--- /dev/null+++ b/frontend/src/hooks/api/appConnections/datadog/queries.tsx@@ -0,0 +1,37 @@+import { useQuery, UseQueryOptions } from "@tanstack/react-query";++import { apiRequest } from "@app/config/request";++import { appConnectionKeys } from "../queries";+import { TDatadogServiceAccount } from "./types";++const datadogConnectionKeys = {+ all: [...appConnectionKeys.all, "datadog"] as const,+ listServiceAccounts: (connectionId: string) =>+ [...datadogConnectionKeys.all, "service-accounts", connectionId] as const+};++export const useListDatadogConnectionServiceAccounts = (+ connectionId: string,+ options?: Omit<+ UseQueryOptions<+ TDatadogServiceAccount[],+ unknown,+ TDatadogServiceAccount[],+ ReturnType<typeof datadogConnectionKeys.listServiceAccounts>+ >,+ "queryKey" | "queryFn"+ >+) => {+ return useQuery({+ queryKey: datadogConnectionKeys.listServiceAccounts(connectionId),+ queryFn: async () => {+ const { data } = await apiRequest.get<{ serviceAccounts: TDatadogServiceAccount[] }>(+ `/api/v1/app-connections/datadog/${connectionId}/service-accounts`+ );++ return data.serviceAccounts;+ },+ ...options+ });+};diff --git a/frontend/src/hooks/api/appConnections/datadog/types.ts b/frontend/src/hooks/api/appConnections/datadog/types.tsnew file mode 100644index 0000000000..59875742ec--- /dev/null+++ b/frontend/src/hooks/api/appConnections/datadog/types.ts@@ -0,0 +1,4 @@+export type TDatadogServiceAccount = {+ id: string;+ name: string;+};diff --git a/frontend/src/hooks/api/secretRotationsV2/enums.ts b/frontend/src/hooks/api/secretRotationsV2/enums.tsindex 22cf52d8e0..fa46aa5d67 100644--- a/frontend/src/hooks/api/secretRotationsV2/enums.ts+++ b/frontend/src/hooks/api/secretRotationsV2/enums.ts@@ -16,7 +16,8 @@ export enum SecretRotation {WindowsLocalAccount = "windows-local-account",OpenRouterApiKey = "open-router-api-key",HpIloLocalAccount = "hp-ilo-local-account",- SupabaseApiKey = "supabase-api-key"+ SupabaseApiKey = "supabase-api-key",+ DatadogApplicationKeySecret = "datadog-application-key-secret"}export enum SecretRotationStatus {diff --git a/frontend/src/hooks/api/secretRotationsV2/types/datadog-application-key-secret-rotation.ts b/frontend/src/hooks/api/secretRotationsV2/types/datadog-application-key-secret-rotation.tsnew file mode 100644index 0000000000..82aeba588b--- /dev/null+++ b/frontend/src/hooks/api/secretRotationsV2/types/datadog-application-key-secret-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 TDatadogApplicationKeySecretRotation = TSecretRotationV2Base & {+ type: SecretRotation.DatadogApplicationKeySecret;+ parameters: {+ serviceAccountId: string;+ };+ secretsMapping: {+ applicationKeyId: string;+ applicationKey: string;+ };+};++export type TDatadogApplicationKeySecretRotationGeneratedCredentials = {+ applicationKeyId: string;+ applicationKey: string;+};++export type TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse =+ TSecretRotationV2GeneratedCredentialsResponseBase<+ SecretRotation.DatadogApplicationKeySecret,+ TDatadogApplicationKeySecretRotationGeneratedCredentials+ >;++export type TDatadogApplicationKeySecretRotationOption = {+ name: string;+ type: SecretRotation.DatadogApplicationKeySecret;+ connection: AppConnection.Datadog;+ template: {+ secretsMapping: TDatadogApplicationKeySecretRotation["secretsMapping"];+ };+};diff --git a/frontend/src/hooks/api/secretRotationsV2/types/index.ts b/frontend/src/hooks/api/secretRotationsV2/types/index.tsindex dc4807a439..c428408fac 100644--- a/frontend/src/hooks/api/secretRotationsV2/types/index.ts+++ b/frontend/src/hooks/api/secretRotationsV2/types/index.ts@@ -36,6 +36,11 @@ import { TSqlCredentialsRotationOption } from "@app/hooks/api/secretRotationsV2/import { SecretV3RawSanitized } from "@app/hooks/api/secrets/types";import { DiscriminativePick } from "@app/types";+import {+ TDatadogApplicationKeySecretRotation,+ TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse,+ TDatadogApplicationKeySecretRotationOption+} from "./datadog-application-key-secret-rotation";import {TDbtServiceTokenRotation,TDbtServiceTokenRotationGeneratedCredentialsResponse,@@ -109,6 +114,7 @@ export type TSecretRotationV2 = (| TOpenRouterApiKeyRotation| THpIloRotation| TSupabaseApiKeyRotation+ | TDatadogApplicationKeySecretRotation) & {secrets: (SecretV3RawSanitized | null)[];};@@ -128,7 +134,8 @@ export type TSecretRotationV2Option =| TWindowsLocalAccountRotationOption| TOpenRouterApiKeyRotationOption| THpIloRotationOption- | TSupabaseApiKeyRotationOption;+ | TSupabaseApiKeyRotationOption+ | TDatadogApplicationKeySecretRotationOption;export type TListSecretRotationV2Options = { secretRotationOptions: TSecretRotationV2Option[] };@@ -152,7 +159,8 @@ export type TViewSecretRotationGeneratedCredentialsResponse =| TWindowsLocalAccountRotationGeneratedCredentialsResponse| TOpenRouterApiKeyRotationGeneratedCredentialsResponse| THpIloRotationGeneratedCredentialsResponse- | TSupabaseApiKeyRotationGeneratedCredentialsResponse;+ | TSupabaseApiKeyRotationGeneratedCredentialsResponse+ | TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse;export type TCreateSecretRotationV2DTO = DiscriminativePick<TSecretRotationV2,@@ -225,6 +233,7 @@ export type TSecretRotationOptionMap = {[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationOption;[SecretRotation.HpIloLocalAccount]: THpIloRotationOption;[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationOption;+ [SecretRotation.DatadogApplicationKeySecret]: TDatadogApplicationKeySecretRotationOption;};export type TSecretRotationGeneratedCredentialsResponseMap = {@@ -246,6 +255,7 @@ export type TSecretRotationGeneratedCredentialsResponseMap = {[SecretRotation.OpenRouterApiKey]: TOpenRouterApiKeyRotationGeneratedCredentialsResponse;[SecretRotation.HpIloLocalAccount]: THpIloRotationGeneratedCredentialsResponse;[SecretRotation.SupabaseApiKey]: TSupabaseApiKeyRotationGeneratedCredentialsResponse;+ [SecretRotation.DatadogApplicationKeySecret]: TDatadogApplicationKeySecretRotationGeneratedCredentialsResponse;};// Unified type for local account reconciliation (Unix/Linux, Windows, and HP iLO)