Deprecate legacy encryption (#21831)

# Introduction
Still preserving the cross-upgrade flow

close https://github.com/twentyhq/core-team-issues/issues/2465


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/21831?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Paul Rastoin
2026-06-19 13:32:39 +02:00
committed by GitHub
parent 4de9f45015
commit 26db3f5735
32 changed files with 206 additions and 249 deletions
@@ -85,10 +85,11 @@ export class EncryptApplicationVariableSlowInstanceCommand
if (looksLikeLegacyCtrCiphertext(row.value)) {
try {
plaintext = this.secretEncryptionService.decryptVersioned(
row.value as EncryptedString,
{ workspaceId: row.workspaceId },
);
plaintext =
this.secretEncryptionService.legacyDecryptVersionedWithFallback(
row.value as EncryptedString,
{ workspaceId: row.workspaceId },
);
} catch (error) {
this.logger.warn(
`applicationVariable row ${row.id} value not valid ciphertext; treating as plaintext. ${
@@ -57,9 +57,10 @@ export class EncryptApplicationRegistrationVariableSlowInstanceCommand
continue;
}
const plaintext = this.secretEncryptionService.decryptVersioned(
row.encryptedValue as EncryptedString,
);
const plaintext =
this.secretEncryptionService.legacyDecryptVersionedWithFallback(
row.encryptedValue as EncryptedString,
);
if (!isDefined(plaintext)) {
continue;
@@ -54,9 +54,10 @@ export class EncryptSigningKeyPrivateKeysSlowInstanceCommand implements SlowInst
continue;
}
const plaintext = this.secretEncryptionService.decryptVersioned(
row.privateKey as EncryptedString,
);
const plaintext =
this.secretEncryptionService.legacyDecryptVersionedWithFallback(
row.privateKey as EncryptedString,
);
if (!isDefined(plaintext)) {
continue;
@@ -57,9 +57,10 @@ export class EncryptSensitiveConfigStorageSlowInstanceCommand implements SlowIns
continue;
}
const plaintext = this.secretEncryptionService.decryptVersioned(
rawValue as EncryptedString,
);
const plaintext =
this.secretEncryptionService.legacyDecryptVersionedWithFallback(
rawValue as EncryptedString,
);
if (!isDefined(plaintext)) {
continue;