mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core)!: Introduce insecure mode in task runner (#16911)
This commit is contained in:
@@ -26,6 +26,7 @@ describe('TaskRunnerProcess', () => {
|
||||
const runnerConfig = mockInstance(TaskRunnersConfig);
|
||||
runnerConfig.enabled = true;
|
||||
runnerConfig.mode = 'internal';
|
||||
runnerConfig.insecureMode = false;
|
||||
const authService = mock<TaskBrokerAuthService>();
|
||||
let taskRunnerProcess = new TaskRunnerProcess(logger, runnerConfig, authService, mock());
|
||||
|
||||
@@ -78,7 +79,7 @@ describe('TaskRunnerProcess', () => {
|
||||
'DEPLOYMENT_NAME',
|
||||
'NODE_PATH',
|
||||
'GENERIC_TIMEZONE',
|
||||
'N8N_RUNNERS_ALLOW_PROTOTYPE_MUTATION',
|
||||
'N8N_RUNNERS_INSECURE_MODE',
|
||||
])('should propagate %s from env as is', async (envVar) => {
|
||||
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');
|
||||
process.env[envVar] = 'custom value';
|
||||
@@ -150,7 +151,7 @@ describe('TaskRunnerProcess', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('should use --disallow-code-generation-from-strings and --disable-proto=delete flags', async () => {
|
||||
it('on secure mode, should use --disallow-code-generation-from-strings and --disable-proto=delete flags', async () => {
|
||||
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');
|
||||
|
||||
await taskRunnerProcess.start();
|
||||
@@ -161,5 +162,22 @@ describe('TaskRunnerProcess', () => {
|
||||
expect.stringContaining('/packages/@n8n/task-runner/dist/start.js'),
|
||||
]);
|
||||
});
|
||||
|
||||
it('on insecure mode, should not use --disallow-code-generation-from-strings and --disable-proto=delete flags', async () => {
|
||||
jest.spyOn(authService, 'createGrantToken').mockResolvedValue('grantToken');
|
||||
runnerConfig.insecureMode = true;
|
||||
const insecureTaskRunnerProcess = new TaskRunnerProcess(
|
||||
logger,
|
||||
runnerConfig,
|
||||
authService,
|
||||
mock(),
|
||||
);
|
||||
|
||||
await insecureTaskRunnerProcess.start();
|
||||
|
||||
expect(spawnMock.mock.calls[0].at(1)).toEqual([
|
||||
expect.stringContaining('/packages/@n8n/task-runner/dist/start.js'),
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user