fix(core): Upgrade crypto-js to address CVE-2023-46233 (#7519)

[GH Advisory](https://github.com/advisories/GHSA-xwcq-pm8m-c4vf)
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-10-26 11:21:53 +02:00
committed by GitHub
parent df89685e15
commit 65e5593233
7 changed files with 49 additions and 11 deletions

View File

@@ -7,13 +7,15 @@ export class Cipher {
constructor(private readonly instanceSettings: InstanceSettings) {}
encrypt(data: string | object) {
const { encryptionKey } = this.instanceSettings;
return AES.encrypt(
typeof data === 'string' ? data : JSON.stringify(data),
this.instanceSettings.encryptionKey,
encryptionKey,
).toString();
}
decrypt(data: string) {
return AES.decrypt(data, this.instanceSettings.encryptionKey).toString(enc.Utf8);
const { encryptionKey } = this.instanceSettings;
return AES.decrypt(data, encryptionKey).toString(enc.Utf8);
}
}