File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
bin/accessibility-automation Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff 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 ) {
You can’t perform that action at this time.
0 commit comments