@@ -119,10 +119,14 @@ private class JwtParserInsecureParseMethodAccess extends MethodAccess {
119
119
* In this case, the signing key is set on a `JwtParserBuilder` indirectly setting the key of `JwtParser` that is created by the call to `build`.
120
120
*/
121
121
private predicate isSigningKeySetter ( Expr expr , MethodAccess signingMa ) {
122
- any ( SigningToExprDataFlow s ) .hasFlow ( DataFlow:: exprNode ( signingMa ) , DataFlow:: exprNode ( expr ) )
122
+ any ( SigningToInsecureMethodAccessDataFlow s )
123
+ .hasFlow ( DataFlow:: exprNode ( signingMa ) , DataFlow:: exprNode ( expr ) )
123
124
}
124
125
125
- /** An expr that is a `JwtParser` for which a signing key has been set. */
126
+ /**
127
+ * An expr that is a `JwtParser` for which a signing key has been set and which is used as
128
+ * the qualifier to a `JwtParserInsecureParseMethodAccess`.
129
+ */
126
130
private class JwtParserWithSigningKeyExpr extends Expr {
127
131
MethodAccess signingMa ;
128
132
@@ -136,18 +140,20 @@ private class JwtParserWithSigningKeyExpr extends Expr {
136
140
}
137
141
138
142
/**
139
- * Models flow from `SigningKeyMethodAccess`es to expressions that are a (sub-type of) `JwtParser`.
143
+ * Models flow from `SigningKeyMethodAccess`es to expressions that are a
144
+ * (sub-type of) `JwtParser` and which are also the qualifier to a `JwtParserInsecureParseMethodAccess`.
140
145
* This is used to determine whether a `JwtParser` has a signing key set.
141
146
*/
142
- private class SigningToExprDataFlow extends DataFlow:: Configuration {
143
- SigningToExprDataFlow ( ) { this = "SigningToExprDataFlow" }
147
+ private class SigningToInsecureMethodAccessDataFlow extends DataFlow:: Configuration {
148
+ SigningToInsecureMethodAccessDataFlow ( ) { this = "SigningToExprDataFlow" }
144
149
145
150
override predicate isSource ( DataFlow:: Node source ) {
146
151
source .asExpr ( ) instanceof SigningKeyMethodAccess
147
152
}
148
153
149
154
override predicate isSink ( DataFlow:: Node sink ) {
150
- sink .asExpr ( ) .getType ( ) instanceof TypeDerivedJwtParser
155
+ sink .asExpr ( ) .getType ( ) instanceof TypeDerivedJwtParser and
156
+ any ( JwtParserInsecureParseMethodAccess ma ) .getQualifier ( ) = sink .asExpr ( )
151
157
}
152
158
153
159
/** Models the builder style of `JwtParser` and `JwtParserBuilder`. */
0 commit comments