Skip to content

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

add validation to datadog

adilson04a09c42fbe0
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.ts
index 4341996523..943565e117 100644
--- 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.ts
@@ -2,6 +2,7 @@ import { AxiosError } from "axios";
import {
TRotationFactory,
+ TRotationFactoryCheckActiveCredentials,
TRotationFactoryGetSecretsPayload,
TRotationFactoryIssueCredentials,
TRotationFactoryRevokeCredentials,
@@ -156,10 +157,28 @@ export const datadogApplicationKeySecretRotationFactory: TRotationFactory<
{ key: secretsMapping.applicationKey, value: generatedCredentials.applicationKey }
];
+ const checkActiveCredentials: TRotationFactoryCheckActiveCredentials<
+ TDatadogApplicationKeySecretRotationGeneratedCredentials
+ > = async ({ applicationKey }) => {
+ const baseUrl = await getDatadogBaseUrl(connection);
+
+ try {
+ await request.get(`${baseUrl}/api/v2/permissions`, {
+ headers: { "DD-API-KEY": connection.credentials.apiKey, "DD-APPLICATION-KEY": applicationKey }
+ });
+ } catch (error: unknown) {
+ if (error instanceof BadRequestError) throw error;
+ throw new BadRequestError({
+ message: `Datadog application key verification failed: ${getDatadogErrorMessage(error)}`
+ });
+ }
+ };
+
return {
issueCredentials,
revokeCredentials,
rotateCredentials,
- getSecretsPayload
+ getSecretsPayload,
+ checkActiveCredentials
};
};
diff --git a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
index 2d02945c62..c2d1075e67 100644
--- a/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
+++ b/backend/src/ee/services/secret-rotation-v2/hp-ilo-rotation/hp-ilo-rotation-fns.ts
@@ -222,8 +222,6 @@ export const hpIloRotationFactory: TRotationFactory<
if (username === connection.credentials.username)
throw new BadRequestError({ message: "Provided username is used in Infisical app connections." });
-<<<<<<< HEAD
-=======
const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({
gatewayId: connection.gatewayId,
gatewayPoolId: connection.gatewayPoolId
@@ -237,7 +235,6 @@ export const hpIloRotationFactory: TRotationFactory<
credentials: connection.credentials
} as TSshConnectionConfig;
->>>>>>> main
if (isSelfRotation && currentPassword) {
await rotateIloPasswordAsTarget(sshConfig, gatewayV2Service, username, currentPassword, newPassword);
} else {