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
@@ -255,7 +255,7 @@ export class ApplicationRegistrationVariableService {
encryptedValue !== ''
? variable.isSecret
? '•••••••••••••'
: this.encryptionService.decryptVersioned(encryptedValue)
: this.encryptionService.decryptVersionedOrThrow(encryptedValue)
: null,
};
}
@@ -44,7 +44,7 @@ describe('ApplicationVariableEntityService', () => {
(value: string, opts?: { workspaceId?: string }) =>
`enc:v2:deadbeef:${value}|${opts?.workspaceId ?? 'instance'}`,
),
decryptVersioned: jest.fn(
decryptVersionedOrThrow: jest.fn(
(value: string, _opts?: { workspaceId?: string }) =>
value.replace(/^enc:v2:[0-9a-f]+:/, '').replace(/\|.*$/, ''),
),
@@ -36,7 +36,7 @@ export class ApplicationVariableEntityService {
});
}
return this.secretEncryptionService.decryptVersioned(
return this.secretEncryptionService.decryptVersionedOrThrow(
applicationVariable.value,
{ workspaceId: applicationVariable.workspaceId },
);
@@ -53,7 +53,9 @@ export class ConnectionProviderService {
variables.map((v) => [
v.key,
v.encryptedValue !== ''
? this.secretEncryptionService.decryptVersioned(v.encryptedValue)
? this.secretEncryptionService.decryptVersionedOrThrow(
v.encryptedValue,
)
: '',
]),
);