File tree Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Expand file tree Collapse file tree 1 file changed +0
-4
lines changed Original file line number Diff line number Diff line change @@ -32,8 +32,6 @@ async function getPathType(path) {
3232async function getDirectoryFiles ( inDirPath ) {
3333 const dirents = await fs . readdir ( inDirPath , { withFileTypes : true } ) ;
3434 const files = await Promise . all ( dirents . map ( ( dirent ) => {
35- // Check for possible path traversal attack and mitigate
36- if ( dirent . name . includes ( '..' ) ) throw new Error ( 'Invalid file name' ) ;
3735 const direntPath = path . resolve ( inDirPath , dirent . name ) ;
3836 return dirent . isDirectory ( ) ? getDirectoryFiles ( direntPath ) : direntPath ;
3937 } ) ) ;
@@ -42,8 +40,6 @@ async function getDirectoryFiles(inDirPath) {
4240
4341async function loadFile ( inFilePath ) {
4442 logger . debug ( `Loading file: ${ inFilePath } ` ) ;
45- // Check for possible path traversal attack and mitigate
46- if ( inFilePath . includes ( '..' ) ) throw new Error ( 'Invalid file path' ) ;
4743 const sarifText = await fs . readFile ( inFilePath , 'utf-8' ) ;
4844 const sarif = JSON . parse ( sarifText ) ;
4945 return sarif ;
You can’t perform that action at this time.
0 commit comments