Skip to content

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

use another key for lock

Thiago Araujo da Silvadcab8dff39e1
diff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.ts
index 7d45ce1cf9..9d662d8fa7 100644
--- a/backend/src/keystore/keystore.ts
+++ b/backend/src/keystore/keystore.ts
@@ -110,7 +110,8 @@ export const KeyStorePrefixes = {
CertActivityTrend: (projectId: string, range: string) => `cert-activity-trend:${projectId}:${range}` as const,
CertPqcTrend: (projectId: string, range: string) => `cert-pqc-trend:${projectId}:${range}` as const,
RefreshTokenGrace: (sessionId: string) => `refresh-token-grace:${sessionId}` as const,
- EmailSignupOtp: (hash: string) => `email-signup-otp:${hash}` as const,
+ EmailSignupOtp: (hash: string) => `email-signup-otp:${hash}:hash` as const,
+ EmailSignupOtpLock: (hash: string) => `email-signup-otp-lock:${hash}:lock` as const,
InsightsCache: (projectId: string, endpoint: string) => `insights-cache:${projectId}:${endpoint}` as const,
AdminConfig: "infisical-admin-cfg",
diff --git a/backend/src/services/auth-token/auth-token-service.ts b/backend/src/services/auth-token/auth-token-service.ts
index 4271175383..b993b9b801 100644
--- a/backend/src/services/auth-token/auth-token-service.ts
+++ b/backend/src/services/auth-token/auth-token-service.ts
@@ -381,7 +381,7 @@ export const tokenServiceFactory = ({ tokenDAL, userDAL, orgDAL, keyStore }: TAu
const key = KeyStorePrefixes.EmailSignupOtp(emailHash);
// Acquire a short-lived lock to make the tries-decrement / delete atomic.
- const lock = await keyStore.acquireLock([key], 5000);
+ const lock = await keyStore.acquireLock([KeyStorePrefixes.EmailSignupOtpLock(emailHash)], 5000);
try {
const raw = await keyStore.getItem(key);
const parsed = raw ? (JSON.parse(raw) as TEmailSignupOtpPayload) : null;