Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix empty display
Thiago Araujo da Silvab44102485c78
diff --git a/backend/src/services/mfa-recovery-code/mfa-recovery-code-service.ts b/backend/src/services/mfa-recovery-code/mfa-recovery-code-service.tsindex ae53e6975b..ac0ae67730 100644--- a/backend/src/services/mfa-recovery-code/mfa-recovery-code-service.ts+++ b/backend/src/services/mfa-recovery-code/mfa-recovery-code-service.ts@@ -67,7 +67,13 @@ export const mfaRecoveryCodeServiceFactory = ({}const decryptWithRoot = kmsService.decryptWithRootKey();- const recoveryCodes = decryptWithRoot(recoveryCodeConfig.encryptedRecoveryCodes).toString().split(",");+ // Once every code is consumed the stored value is the empty string, which+ // split(",") turns into [""]. Filter out empties so an exhausted pool+ // reads as [] rather than a single blank code.+ const recoveryCodes = decryptWithRoot(recoveryCodeConfig.encryptedRecoveryCodes)+ .toString()+ .split(",")+ .filter(Boolean);return recoveryCodes;};