File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
javascript/ql/lib/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -276,7 +276,7 @@ private module NodeJSCrypto {
276276 */
277277private module CryptoJS {
278278 private class InstantiatedAlgorithm extends DataFlow:: CallNode {
279- CryptographicAlgorithm algorithm ; // non-functional
279+ private string algorithmName ;
280280
281281 InstantiatedAlgorithm ( ) {
282282 /*
@@ -295,11 +295,25 @@ private module CryptoJS {
295295 mod = DataFlow:: moduleImport ( "crypto-js" ) and
296296 propRead = mod .getAPropertyRead ( "algo" ) .getAPropertyRead ( ) and
297297 this = propRead .getAMemberCall ( "create" ) and
298- not isStrongPasswordHashingAlgorithm ( propRead .getPropertyName ( ) )
298+ algorithmName = propRead .getPropertyName ( ) and
299+ not isStrongPasswordHashingAlgorithm ( algorithmName )
299300 )
300301 }
301302
302- CryptographicAlgorithm getAlgorithm ( ) { result = algorithm }
303+ CryptographicAlgorithm getAlgorithm ( ) { result .matchesName ( algorithmName ) }
304+
305+ private BlockMode getExplicitBlockMode ( ) { result .matchesString ( algorithmName ) }
306+
307+ BlockMode getBlockMode ( ) {
308+ isBlockEncryptionAlgorithm ( this .getAlgorithm ( ) ) and
309+ (
310+ if exists ( this .getExplicitBlockMode ( ) )
311+ then result = this .getExplicitBlockMode ( )
312+ else
313+ // CBC is the default if not explicitly specified
314+ result = "CBC"
315+ )
316+ }
303317 }
304318
305319
You can’t perform that action at this time.
0 commit comments