@@ -195,18 +195,33 @@ private module SensitiveDataModeling {
195
195
}
196
196
197
197
/**
198
- * Returns strings (primarily the names of various program entities) that may contain sensitive data
199
- * with the classification `classification`.
198
+ * This helper predicate serves to deduplicate the results of the preceding predicates. This
199
+ * means that if, say, an attribute and a function parameter have the same name, then that name will
200
+ * only be matched once, which greatly cuts down on the number of regexp matches that have to be
201
+ * performed.
200
202
*
201
- * This is a helper predicate, used to limit the number of regexp matches that have to be performed.
203
+ * Under normal circumstances, deduplication is only performed when a predicate is materialized, and
204
+ * so to see the effect of this we must create a separate predicate that calculates the union of the
205
+ * preceding predicates.
202
206
*/
203
207
pragma [ nomagic]
204
- private string sensitiveString ( SensitiveDataClassification classification ) {
208
+ private string sensitiveStringCandidate ( ) {
205
209
result in [
206
210
sensitiveNameCandidate ( ) , sensitiveAttributeNameCandidate ( ) ,
207
211
sensitiveParameterNameCandidate ( ) , sensitiveFunctionNameCandidate ( ) ,
208
212
sensitiveStrConstCandidate ( )
209
- ] and
213
+ ]
214
+ }
215
+
216
+ /**
217
+ * Returns strings (primarily the names of various program entities) that may contain sensitive data
218
+ * with the classification `classification`.
219
+ *
220
+ * This is a helper predicate, used to limit the number of regexp matches that have to be performed.
221
+ */
222
+ pragma [ nomagic]
223
+ private string sensitiveString ( SensitiveDataClassification classification ) {
224
+ result = sensitiveStringCandidate ( ) and
210
225
result .regexpMatch ( maybeSensitiveRegexp ( classification ) )
211
226
}
212
227
0 commit comments