File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
javascript/ql/src/Security/CWE-078 Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -14,10 +14,12 @@ import javascript
1414import semmle.javascript.security.UselessUseOfCat
1515import semmle.javascript.RestrictedLocations
1616
17-
1817from UselessCat cat , string message
19- where
20- message = " Can be replaced with: " + PrettyPrintCatCall:: createReadFileCall ( cat )
21- or
22- not exists ( PrettyPrintCatCall:: createReadFileCall ( cat ) ) and message = ""
18+ where
19+ message = " Can be replaced with: " + PrettyPrintCatCall:: createReadFileCall ( cat )
20+ or
21+ not exists ( PrettyPrintCatCall:: createReadFileCall ( cat ) ) and
22+ if cat .isSync ( )
23+ then message = " Can be replaced with a call to fs.readFileSync(..)."
24+ else message = " Can be replaced with a call to fs.readFile(..)."
2325select cat .asExpr ( ) .( FirstLineOf ) , "Useless use of `cat`." + message
You can’t perform that action at this time.
0 commit comments