diff --git a/lib/internal/worker.js b/lib/internal/worker.js index 53e3c7668c31a0..796d1713dd510a 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -68,11 +68,7 @@ class Worker extends EventEmitter { options.execArgv); } if (!options.eval) { - if (!path.isAbsolute(filename) && - !filename.startsWith('./') && - !filename.startsWith('../') && - !filename.startsWith('.' + path.sep) && - !filename.startsWith('..' + path.sep)) { + if (!path.isAbsolute(filename) && !/^\.\.?[\\/]/.test(filename)) { throw new ERR_WORKER_PATH(filename); } filename = path.resolve(filename);