mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
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:
committed by
GitHub
parent
df89685e15
commit
65e5593233
30
packages/core/test/Cipher.test.ts
Normal file
30
packages/core/test/Cipher.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import Container from 'typedi';
|
||||
import { InstanceSettings } from '@/InstanceSettings';
|
||||
import { Cipher } from '@/Cipher';
|
||||
import { mockInstance } from './utils';
|
||||
|
||||
describe('Cipher', () => {
|
||||
mockInstance(InstanceSettings, { encryptionKey: 'test_key' });
|
||||
const cipher = Container.get(Cipher);
|
||||
|
||||
describe('encrypt', () => {
|
||||
it('should encrypt strings', () => {
|
||||
const encrypted = cipher.encrypt('random-string');
|
||||
const decrypted = cipher.decrypt(encrypted);
|
||||
expect(decrypted).toEqual('random-string');
|
||||
});
|
||||
|
||||
it('should encrypt objects', () => {
|
||||
const encrypted = cipher.encrypt({ key: 'value' });
|
||||
const decrypted = cipher.decrypt(encrypted);
|
||||
expect(decrypted).toEqual('{"key":"value"}');
|
||||
});
|
||||
});
|
||||
|
||||
describe('decrypt', () => {
|
||||
it('should decrypt string', () => {
|
||||
const decrypted = cipher.decrypt('U2FsdGVkX194VEoX27o3+y5jUd1JTTmVwkOKjVhB6Jg=');
|
||||
expect(decrypted).toEqual('random-string');
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user