Skip to content

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

remove advisory lock

Matheus Nogueira7f51784451a1
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.ts
index d8ecc131bc..a3d8072b1b 100644
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@ -41,8 +41,7 @@ export const PgSqlLock = {
pgAdvisoryLockHashText(`last-admin-guard:${scope}:${scopeId}`),
AuditReportRequest: (projectId: string) => pgAdvisoryLockHashText(`audit-report-request:${projectId}`),
OrgAuditReportRequest: (orgId: string) => pgAdvisoryLockHashText(`audit-report-request:org:${orgId}`),
- OrgAgentProxyConfigInit: (orgId: string) => pgAdvisoryLockHashText(`org-agent-proxy-config-init:${orgId}`),
- SecretValueReuseCheck: (projectId: string) => pgAdvisoryLockHashText(`secret-value-reuse-check:${projectId}`)
+ OrgAgentProxyConfigInit: (orgId: string) => pgAdvisoryLockHashText(`org-agent-proxy-config-init:${orgId}`)
} as const;
// all the key prefixes used must be set here to avoid conflict
diff --git a/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts b/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts
index 3589dc860a..6e7e344ca4 100644
--- a/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts
+++ b/backend/src/services/secret-validation-rule/secret-validation-rule-service.ts
@@ -7,7 +7,6 @@ import {
ProjectPermissionSecretValidationRuleActions,
ProjectPermissionSub
} from "@app/ee/services/permission/project-permission";
-import { PgSqlLock } from "@app/keystore/keystore";
import { BadRequestError, ForbiddenRequestError, NotFoundError } from "@app/lib/errors";
import { OrgServiceActor } from "@app/lib/types";
import { TProjectEnvDALFactory } from "@app/services/project-env/project-env-dal";
@@ -425,10 +424,6 @@ export const secretValidationRuleServiceFactory = ({
);
if (!candidates.length) return {};
- // Two writes of the same value would each find no duplicate and both land. The lock makes this
- // check and the write that follows it atomic, so the second one sees the first.
- if (tx) await tx.raw("SELECT pg_advisory_xact_lock(?)", [PgSqlLock.SecretValueReuseCheck(projectId)]);
-
const blindIndexes = await Promise.all(
candidates.map((secret) => generateSecretBlindIndex(Buffer.from(secret.value)))
);