File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
python/ql/src/experimental/semmle/python/libraries Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ private module Authlib {
4242
4343 override DataFlow:: Node getAlgorithm ( ) {
4444 exists ( KeyValuePair headerDict |
45- headerDict = this .getArg ( 0 ) .asExpr ( ) .( Dict ) .getItems ( ) . getAnItem ( ) and
45+ headerDict = this .getArg ( 0 ) .asExpr ( ) .( Dict ) .getItem ( _ ) and
4646 headerDict .getKey ( ) .( Str_ ) .getS ( ) .matches ( "alg" ) and
4747 result .asExpr ( ) = headerDict .getValue ( )
4848 )
Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ private module PyJWT {
101101 predicate hasVerifySignatureSetToFalse ( ) {
102102 exists ( KeyValuePair optionsDict , NameConstant falseName |
103103 falseName .getId ( ) = "False" and
104- optionsDict = this .getOptions ( ) .asExpr ( ) .( Dict ) .getItems ( ) . getAnItem ( ) and
104+ optionsDict = this .getOptions ( ) .asExpr ( ) .( Dict ) .getItem ( _ ) and
105105 optionsDict .getKey ( ) .( Str_ ) .getS ( ) .matches ( "%verify%" ) and
106106 falseName = optionsDict .getValue ( )
107107 )
Original file line number Diff line number Diff line change @@ -88,12 +88,18 @@ private module PythonJose {
8888
8989 override predicate verifiesSignature ( ) {
9090 // jwt.decode(token, "key", "HS256")
91- not exists ( this .getOptions ( ) )
91+ this .hasNoOptions ( )
9292 or
9393 // jwt.decode(token, key, options={"verify_signature": False})
94- not exists ( KeyValuePair optionsDict , NameConstant falseName |
94+ not this .hasVerifySignatureSetToFalse ( )
95+ }
96+
97+ predicate hasNoOptions ( ) { not exists ( this .getOptions ( ) ) }
98+
99+ predicate hasVerifySignatureSetToFalse ( ) {
100+ exists ( KeyValuePair optionsDict , NameConstant falseName |
95101 falseName .getId ( ) = "False" and
96- optionsDict = this .getOptions ( ) .asExpr ( ) .( Dict ) .getItems ( ) . getAnItem ( ) and
102+ optionsDict = this .getOptions ( ) .asExpr ( ) .( Dict ) .getItem ( _ ) and
97103 optionsDict .getKey ( ) .( Str_ ) .getS ( ) .matches ( "%verify%" ) and
98104 falseName = optionsDict .getValue ( )
99105 )
You can’t perform that action at this time.
0 commit comments