File tree Expand file tree Collapse file tree 3 files changed +15
-0
lines changed
test/query-tests/Security/CWE-326 Expand file tree Collapse file tree 3 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,15 @@ private predicate isRequire(DataFlow::Node nd) {
295295 isCreateRequire ( call .getCallee ( ) .flow ( ) ) and
296296 nd = call .flow ( )
297297 )
298+ or
299+ // `$.require('underscore');`.
300+ // NPM as supported in [XSJS files](https://www.npmjs.com/package/@sap/async-xsjs#npm-packages-support).
301+ exists ( MethodCallExpr require |
302+ nd .getFile ( ) .getExtension ( ) = [ "xsjs" , "xsjslib" ] and
303+ require .getCalleeName ( ) = "require" and
304+ require .getReceiver ( ) .( GlobalVarAccess ) .getName ( ) = "$" and
305+ nd = require .getCallee ( ) .flow ( )
306+ )
298307}
299308
300309/**
Original file line number Diff line number Diff line change 99| tst.js:35:13:35:43 | crypto. ... an(512) | Creation of an asymmetric key uses 512 bits, which is below 2048 and considered breakable. |
1010| tst.js:39:13:39:33 | new Nod ... : 512}) | Creation of an asymmetric RSA key uses 512 bits, which is below 2048 and considered breakable. |
1111| tst.js:43:1:43:31 | key.gen ... 65537) | Creation of an asymmetric RSA key uses 512 bits, which is below 2048 and considered breakable. |
12+ | tst.xsjs:3:14:3:71 | crypto. ... 1024 }) | Creation of an asymmetric RSA key uses 1024 bits, which is below 2048 and considered breakable. |
Original file line number Diff line number Diff line change 1+ const crypto = $ . require ( "crypto" ) ;
2+
3+ const bad1 = crypto . generateKeyPairSync ( "rsa" , { modulusLength : 1024 } ) ; // NOT OK
4+
5+ const good1 = crypto . generateKeyPairSync ( "rsa" , { modulusLength : 4096 } ) ; // OK
You can’t perform that action at this time.
0 commit comments