File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
lib/semmle/javascript/frameworks
test/library-tests/CryptoLibraries Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ private module AsmCrypto {
51
51
DataFlow:: Node input ;
52
52
CryptographicAlgorithm algorithm ; // non-functional
53
53
private string algorithmName ;
54
+ private string methodName ;
54
55
55
56
Apply ( ) {
56
57
/*
@@ -66,7 +67,7 @@ private module AsmCrypto {
66
67
exists ( DataFlow:: SourceNode asmCrypto |
67
68
asmCrypto = DataFlow:: globalVarRef ( "asmCrypto" ) and
68
69
algorithm .matchesName ( algorithmName ) and
69
- this = asmCrypto .getAPropertyRead ( algorithmName ) .getAMemberCall ( _ ) and
70
+ this = asmCrypto .getAPropertyRead ( algorithmName ) .getAMemberCall ( methodName ) and
70
71
input = this .getArgument ( 0 )
71
72
)
72
73
}
@@ -79,6 +80,15 @@ private module AsmCrypto {
79
80
isBlockEncryptionAlgorithm ( this .getAlgorithm ( ) ) and
80
81
result .matchesString ( algorithmName )
81
82
}
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 ( ) }
82
92
}
83
93
}
84
94
Original file line number Diff line number Diff line change
1
+ | tst.js:3:34:3:36 | key |
1
2
| tst.js:7:26:7:42 | keypair.secretKey |
2
3
| tst.js:21:42:21:51 | 'a secret' |
3
4
| tst.js:36:36:36:51 | 'secret key 123' |
You can’t perform that action at this time.
0 commit comments