@@ -86,39 +86,37 @@ private predicate writesProperty(DataFlow::Node node, string name) {
86
86
87
87
/** A write to a variable or property that might contain sensitive data. */
88
88
private class BasicSensitiveWrite extends SensitiveWrite {
89
- SensitiveDataClassification classification ;
89
+ string name ;
90
90
91
91
BasicSensitiveWrite ( ) {
92
- exists ( string name |
93
- /*
94
- * PERFORMANCE OPTIMISATION:
95
- * `nameIndicatesSensitiveData` performs a `regexpMatch` on `name`.
96
- * To carry out a regex match, we must first compute the Cartesian product
97
- * of all possible `name`s and regexes, then match.
98
- * To keep this product as small as possible,
99
- * we want to filter `name` as much as possible before the product.
100
- *
101
- * Do this by factoring out a helper predicate containing the filtering
102
- * logic that restricts `name`. This helper predicate will get picked first
103
- * in the join order, since it is the only call here that binds `name`.
104
- */
105
-
106
- writesProperty ( this , name ) and
107
- nameIndicatesSensitiveData ( name , classification )
108
- )
92
+ /*
93
+ * PERFORMANCE OPTIMISATION:
94
+ * `nameIndicatesSensitiveData` performs a `regexpMatch` on `name`.
95
+ * To carry out a regex match, we must first compute the Cartesian product
96
+ * of all possible `name`s and regexes, then match.
97
+ * To keep this product as small as possible,
98
+ * we want to filter `name` as much as possible before the product.
99
+ *
100
+ * Do this by factoring out a helper predicate containing the filtering
101
+ * logic that restricts `name`. This helper predicate will get picked first
102
+ * in the join order, since it is the only call here that binds `name`.
103
+ */
104
+
105
+ writesProperty ( this , name ) and
106
+ nameIndicatesSensitiveData ( name )
109
107
}
110
108
111
109
/** Gets a classification of the kind of sensitive data the write might handle. */
112
- SensitiveDataClassification getClassification ( ) { result = classification }
110
+ SensitiveDataClassification getClassification ( ) { nameIndicatesSensitiveData ( name , result ) }
113
111
}
114
112
115
113
/** An access to a variable or property that might contain sensitive data. */
116
114
private class BasicSensitiveVariableAccess extends SensitiveVariableAccess {
117
- SensitiveDataClassification classification ;
118
-
119
- BasicSensitiveVariableAccess ( ) { nameIndicatesSensitiveData ( name , classification ) }
115
+ BasicSensitiveVariableAccess ( ) { nameIndicatesSensitiveData ( name ) }
120
116
121
- override SensitiveDataClassification getClassification ( ) { result = classification }
117
+ override SensitiveDataClassification getClassification ( ) {
118
+ nameIndicatesSensitiveData ( name , result )
119
+ }
122
120
}
123
121
124
122
/** A function name that suggests it may be sensitive. */
@@ -138,11 +136,11 @@ abstract class SensitiveDataFunctionName extends SensitiveFunctionName {
138
136
139
137
/** A method that might return sensitive data, based on the name. */
140
138
class CredentialsFunctionName extends SensitiveDataFunctionName {
141
- SensitiveDataClassification classification ;
142
-
143
- CredentialsFunctionName ( ) { nameIndicatesSensitiveData ( this , classification ) }
139
+ CredentialsFunctionName ( ) { nameIndicatesSensitiveData ( this ) }
144
140
145
- override SensitiveDataClassification getClassification ( ) { result = classification }
141
+ override SensitiveDataClassification getClassification ( ) {
142
+ nameIndicatesSensitiveData ( this , result )
143
+ }
146
144
}
147
145
148
146
/**
0 commit comments