File tree Expand file tree Collapse file tree
lib/semmle/javascript/frameworks
test/library-tests/CryptoLibraries Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ private module AsmCrypto {
5151 DataFlow:: Node input ;
5252 CryptographicAlgorithm algorithm ; // non-functional
5353 private string algorithmName ;
54+ private string methodName ;
5455
5556 Apply ( ) {
5657 /*
@@ -66,7 +67,7 @@ private module AsmCrypto {
6667 exists ( DataFlow:: SourceNode asmCrypto |
6768 asmCrypto = DataFlow:: globalVarRef ( "asmCrypto" ) and
6869 algorithm .matchesName ( algorithmName ) and
69- this = asmCrypto .getAPropertyRead ( algorithmName ) .getAMemberCall ( _ ) and
70+ this = asmCrypto .getAPropertyRead ( algorithmName ) .getAMemberCall ( methodName ) and
7071 input = this .getArgument ( 0 )
7172 )
7273 }
@@ -79,6 +80,15 @@ private module AsmCrypto {
7980 isBlockEncryptionAlgorithm ( this .getAlgorithm ( ) ) and
8081 result .matchesString ( algorithmName )
8182 }
83+
84+ DataFlow:: Node getKey ( ) {
85+ methodName = [ "encrypt" , "decrypt" ] and
86+ result = super .getArgument ( 1 )
87+ }
88+ }
89+
90+ private class Key extends CryptographicKey {
91+ Key ( ) { this = any ( Apply apply ) .getKey ( ) }
8292 }
8393}
8494
Original file line number Diff line number Diff line change 1+ | tst.js:3:34:3:36 | key |
12| tst.js:7:26:7:42 | keypair.secretKey |
23| tst.js:21:42:21:51 | 'a secret' |
34| tst.js:36:36:36:51 | 'secret key 123' |
You can’t perform that action at this time.
0 commit comments