fix(core): Prevent issues with missing or mismatching encryption key (#8332)

This commit is contained in:
Iván Ovejero
2024-01-16 18:25:53 +01:00
committed by GitHub
parent 7bb2d1799e
commit d4c93b1607
7 changed files with 62 additions and 45 deletions

View File

@@ -24,6 +24,12 @@ describe('InstanceSettings', () => {
readSpy.mockReturnValue('{"encryptionKey":"test_key"');
expect(() => new InstanceSettings()).toThrowError();
});
it('should throw if the env and file keys do not match', () => {
readSpy.mockReturnValue(JSON.stringify({ encryptionKey: 'key_1' }));
process.env.N8N_ENCRYPTION_KEY = 'key_2';
expect(() => new InstanceSettings()).toThrowError();
});
});
describe('If the settings file does not exist', () => {