diff --git a/lib/sensor/index.js b/lib/sensor/index.js index 5c19843..12065e8 100644 --- a/lib/sensor/index.js +++ b/lib/sensor/index.js @@ -58,6 +58,10 @@ var getSensorDriver = function (model) { if (!model) { return; } + // Ensure that model is a single path component + if (model.includes(path.sep) || model === '..' || model === '.') { + throw new Error(`invalid ${model}`) + } if (_cachedDrivers[model]) { return _cachedDrivers[model]; }