From 82e02c1db8ae2b124489eb00f042e7b073d8f6af Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 25 Jan 2022 14:20:03 +0100 Subject: [PATCH] fix false Attempted path traversal attack - alarm on win --- scripts/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/utils.js b/scripts/utils.js index 31e8c6c..055f1be 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -31,7 +31,8 @@ const getArgs = function () { const getSafeFilePath = function (rootPath, singleFileSegment) { var filePath = path.join(rootPath, singleFileSegment); if ( - path.dirname(filePath) !== rootPath || + (path.dirname(filePath) !== rootPath && + path.dirname(filePath) !== rootPath.replace("/", "\\")) || path.basename(filePath) !== singleFileSegment || path.normalize(singleFileSegment) !== singleFileSegment ) {