Skip to content

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

fix(pam): redact the heartbeat error before logging it

bernie-g3e0d40c1f960
diff --git a/backend/src/ee/services/pam-account-heartbeat/pam-account-heartbeat-service.ts b/backend/src/ee/services/pam-account-heartbeat/pam-account-heartbeat-service.ts
index 94087ce3e5..ff870935b0 100644
--- a/backend/src/ee/services/pam-account-heartbeat/pam-account-heartbeat-service.ts
+++ b/backend/src/ee/services/pam-account-heartbeat/pam-account-heartbeat-service.ts
@@ -288,11 +288,11 @@ export const pamAccountHeartbeatServiceFactory = ({
try {
outcome = await probe(account, usedSecrets);
} catch (err) {
- logger.warn(err, `PAM heartbeat could not complete [accountId=${account.id}]`);
- outcome = {
- status: PamHeartbeatStatus.CannotCheck,
- message: redactRotationError(err, usedSecrets)
- };
+ const message = redactRotationError(err, usedSecrets);
+ // Logged as the redacted string, never the error object: a target that echoed the credential back would
+ // otherwise copy it into the application log, which no later redaction reaches.
+ logger.warn(`PAM heartbeat could not complete [accountId=${account.id}]: ${message}`);
+ outcome = { status: PamHeartbeatStatus.CannotCheck, message };
}
if (outcome.message) {
outcome = { ...outcome, message: redactRotationError(new Error(outcome.message), usedSecrets) };