File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
python/ql/src/semmle/python/frameworks Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -1207,6 +1207,13 @@ private module Stdlib {
12071207 override DataFlow:: Node getAnInput ( ) { result = this .getArg ( 0 ) }
12081208 }
12091209
1210+ /** Helper predicate for the `HashLibGenericHashOperation` charpred, to prevent a bad join order. */
1211+ pragma [ nomagic]
1212+ private API:: Node hashlibMember ( string hashName ) {
1213+ result = API:: moduleImport ( "hashlib" ) .getMember ( hashName ) and
1214+ hashName != "new"
1215+ }
1216+
12101217 /**
12111218 * A hashing operation from the `hashlib` package using one of the predefined classes
12121219 * (such as `hashlib.md5`). `hashlib.new` is not included, since it is handled by
@@ -1218,10 +1225,7 @@ private module Stdlib {
12181225 API:: Node hashClass ;
12191226
12201227 bindingset [ this ]
1221- HashlibGenericHashOperation ( ) {
1222- not hashName = "new" and
1223- hashClass = API:: moduleImport ( "hashlib" ) .getMember ( hashName )
1224- }
1228+ HashlibGenericHashOperation ( ) { hashClass = hashlibMember ( hashName ) }
12251229
12261230 override Cryptography:: CryptographicAlgorithm getAlgorithm ( ) { result .matchesName ( hashName ) }
12271231 }
You can’t perform that action at this time.
0 commit comments