Skip to content

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

greptile review fixes

x0322059cc59ce8fbdf
diff --git a/backend/src/ee/services/pam-account/pam-account-service.ts b/backend/src/ee/services/pam-account/pam-account-service.ts
index da1ac3df80..36683ff74c 100644
--- a/backend/src/ee/services/pam-account/pam-account-service.ts
+++ b/backend/src/ee/services/pam-account/pam-account-service.ts
@@ -1341,6 +1341,7 @@ export const pamAccountServiceFactory = ({
throw new BadRequestError({ message: "Rotation credentials are not configured on this resource" });
}
+ // Immediate check. There's an actual atomic lock in rotateAccount
if (account.rotationStatus === PamAccountRotationStatus.Rotating) {
throw new BadRequestError({ message: "Account is already being rotated" });
}
diff --git a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts
index a7bbc6e618..94acf8497c 100644
--- a/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts
+++ b/backend/src/ee/services/pam-resource/active-directory/active-directory-resource-factory.ts
@@ -214,14 +214,21 @@ export const activeDirectoryResourceFactory: TPamResourceFactory<
...buildLdapTlsOptions()
});
+ let clientError: Error | null = null;
client.on("error", (err: Error) => {
- client.unbind();
+ clientError = err;
+ try {
+ client.unbind();
+ } catch {
+ // do nothing
+ }
reject(err);
});
// Bind as rotation account (admin)
const bindDn = `${rotationAccountCredentials.username}@${connectionDetails.domain}`;
client.bind(bindDn, rotationAccountCredentials.password, (bindErr) => {
+ if (clientError) return;
if (bindErr) {
client.unbind();
reject(new Error(`Rotation account bind failed: ${bindErr.message}`));
diff --git a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-factory.ts b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-factory.ts
index ce7ef16222..94cc6d7c64 100644
--- a/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-factory.ts
+++ b/backend/src/ee/services/pam-resource/windows-server/windows-server-resource-factory.ts
@@ -171,7 +171,7 @@ export const windowsResourceFactory: TPamResourceFactory<
);
logger.info(
- `[Windows Rotation] Password rotated for local account '${currentCredentials.username}' on ${connectionDetails.hostname}`
+ `[Windows Rotation] Password rotated for local account [username=${currentCredentials.username}] on [hostname=${connectionDetails.hostname}]`
);
}
);