@@ -64,16 +64,12 @@ class PasswordVarExpr extends Expr {
64
64
}
65
65
}
66
66
67
- /** Holds if `Expr` e is an operand of `AddExpr`. */
68
- predicate hasAddExpr ( AddExpr ae , Expr e ) {
69
- ae .getAnOperand ( ) = e or
70
- hasAddExpr ( ae .getAnOperand ( ) , e )
71
- }
67
+ /** Holds if `Expr` e is a direct or indirect operand of `ae`. */
68
+ predicate hasAddExpr ( AddExpr ae , Expr e ) { ae .getAnOperand + ( ) = e }
72
69
73
70
/** Holds if `MethodAccess` ma has a flow to another `MDHashMethodAccess` call. */
74
71
predicate hasAnotherHashCall ( MethodAccess ma ) {
75
- exists ( MethodAccess ma2 , DataFlow2:: Node node1 , DataFlow2:: Node node2 |
76
- ma2 instanceof MDHashMethodAccess and
72
+ exists ( MDHashMethodAccess ma2 , DataFlow:: Node node1 , DataFlow:: Node node2 |
77
73
ma2 != ma and
78
74
node1 .asExpr ( ) = ma .getAChildExpr ( ) and
79
75
node2 .asExpr ( ) = ma2 .getAChildExpr ( ) and
@@ -85,29 +81,22 @@ predicate hasAnotherHashCall(MethodAccess ma) {
85
81
}
86
82
87
83
/** Holds if `MethodAccess` ma is a hashing call without a sibling node making another hashing call. */
88
- predicate isSingleHashMethodCall ( MethodAccess ma ) {
89
- (
90
- ma instanceof MDHashMethodAccess and
91
- not hasAnotherHashCall ( ma )
92
- )
93
- }
84
+ predicate isSingleHashMethodCall ( MDHashMethodAccess ma ) { not hasAnotherHashCall ( ma ) }
94
85
95
86
/** Holds if `MethodAccess` ma is invoked by `MethodAccess` ma2 either directly or indirectly. */
96
87
predicate hasParentCall ( MethodAccess ma2 , MethodAccess ma ) {
97
- ma .getCaller ( ) = ma2 .getMethod ( ) and
98
- not ma2 instanceof MDHashMethodAccess
88
+ ma .getCaller ( ) = ma2 .getMethod ( )
99
89
or
100
90
exists ( MethodAccess ma3 |
101
91
ma .getCaller ( ) = ma3 .getMethod ( ) and
102
- not ma3 instanceof MDHashMethodAccess and
103
92
hasParentCall ( ma2 , ma3 )
104
93
)
105
94
}
106
95
107
- /** Holds if `MethodAccess` is a single hashing call. */
96
+ /** Holds if `MethodAccess` is a single hashing call that is not invoked by a wrapper method . */
108
97
predicate isSink ( MethodAccess ma ) {
109
98
isSingleHashMethodCall ( ma ) and
110
- not exists ( MethodAccess ma2 | hasParentCall ( ma2 , ma ) )
99
+ not exists ( MethodAccess ma2 | hasParentCall ( ma2 , ma ) ) // Not invoked by a wrapper method which could invoke MDHashMethod in another call stack to reduce FPs
111
100
}
112
101
113
102
/** Sink of hashing calls. */
0 commit comments