Skip to content

Commit 0d1bfc3

Browse files
committed
added a change
1 parent d14f0a1 commit 0d1bfc3

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bin/accessibility-automation/helper.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,13 @@ exports.setAccessibilityEventListeners = (bsConfig) => {
244244
}
245245

246246
// Build the correct glob pattern
247-
const cwd_path = process.cwd();
247+
const resolvedPath = path.resolve(process.cwd(), supportFilesData.supportFile);
248+
if (!resolvedPath.startsWith(process.cwd())) {
249+
throw new Error('Path traversal attempt detected');
250+
}
248251
const globPattern = supportFilesData.supportFile.startsWith('/')
249-
? cwd_path + supportFilesData.supportFile
250-
: path.resolve(cwd_path,supportFilesData.supportFile);
252+
? process.cwd() + supportFilesData.supportFile
253+
: resolvedPath;
251254

252255
glob(globPattern, {}, (err, files) => {
253256
if(err) {

0 commit comments

Comments
 (0)