@@ -143,11 +143,19 @@ private class NosqlInjectionSinkCharacteristic extends EndpointCharacteristic {
143143 * negative samples for training.
144144 */
145145
146+ /**
147+ * A characteristic that is an indicator of not being a sink of any type, because it's a modeled argument.
148+ */
149+ abstract class OtherModeledArgumentCharacteristic extends EndpointCharacteristic {
150+ bindingset [ this ]
151+ OtherModeledArgumentCharacteristic ( ) { any ( ) }
152+ }
153+
146154/**
147155 * A characteristic that is an indicator of not being a sink of any type, because it's an argument to a function of a
148156 * builtin object.
149157 */
150- abstract private class ArgumentToBuiltinFunctionCharacteristic extends EndpointCharacteristic {
158+ abstract private class ArgumentToBuiltinFunctionCharacteristic extends OtherModeledArgumentCharacteristic {
151159 bindingset [ this ]
152160 ArgumentToBuiltinFunctionCharacteristic ( ) { any ( ) }
153161}
@@ -187,23 +195,26 @@ abstract class LikelyNotASinkCharacteristic extends EndpointCharacteristic {
187195 }
188196}
189197
190- private class LodashUnderscore extends NotASinkCharacteristic {
191- LodashUnderscore ( ) { this = "LodashUnderscoreArgument" }
198+ private class LodashUnderscoreCharacteristic extends NotASinkCharacteristic ,
199+ OtherModeledArgumentCharacteristic {
200+ LodashUnderscoreCharacteristic ( ) { this = "LodashUnderscoreArgument" }
192201
193202 override predicate getEndpoints ( DataFlow:: Node n ) {
194203 any ( LodashUnderscore:: Member m ) .getACall ( ) .getAnArgument ( ) = n
195204 }
196205}
197206
198- private class JQueryArgumentCharacteristic extends NotASinkCharacteristic {
207+ private class JQueryArgumentCharacteristic extends NotASinkCharacteristic ,
208+ OtherModeledArgumentCharacteristic {
199209 JQueryArgumentCharacteristic ( ) { this = "JQueryArgument" }
200210
201211 override predicate getEndpoints ( DataFlow:: Node n ) {
202212 any ( JQuery:: MethodCall m ) .getAnArgument ( ) = n
203213 }
204214}
205215
206- private class ClientRequestCharacteristic extends NotASinkCharacteristic {
216+ private class ClientRequestCharacteristic extends NotASinkCharacteristic ,
217+ OtherModeledArgumentCharacteristic {
207218 ClientRequestCharacteristic ( ) { this = "ClientRequest" }
208219
209220 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -213,7 +224,8 @@ private class ClientRequestCharacteristic extends NotASinkCharacteristic {
213224 }
214225}
215226
216- private class PromiseDefinitionCharacteristic extends NotASinkCharacteristic {
227+ private class PromiseDefinitionCharacteristic extends NotASinkCharacteristic ,
228+ OtherModeledArgumentCharacteristic {
217229 PromiseDefinitionCharacteristic ( ) { this = "PromiseDefinition" }
218230
219231 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -223,21 +235,24 @@ private class PromiseDefinitionCharacteristic extends NotASinkCharacteristic {
223235 }
224236}
225237
226- private class CryptographicKeyCharacteristic extends NotASinkCharacteristic {
238+ private class CryptographicKeyCharacteristic extends NotASinkCharacteristic ,
239+ OtherModeledArgumentCharacteristic {
227240 CryptographicKeyCharacteristic ( ) { this = "CryptographicKey" }
228241
229242 override predicate getEndpoints ( DataFlow:: Node n ) { n instanceof CryptographicKey }
230243}
231244
232- private class CryptographicOperationFlowCharacteristic extends NotASinkCharacteristic {
245+ private class CryptographicOperationFlowCharacteristic extends NotASinkCharacteristic ,
246+ OtherModeledArgumentCharacteristic {
233247 CryptographicOperationFlowCharacteristic ( ) { this = "CryptographicOperationFlow" }
234248
235249 override predicate getEndpoints ( DataFlow:: Node n ) {
236250 any ( CryptographicOperation op ) .getInput ( ) = n
237251 }
238252}
239253
240- private class LoggerMethodCharacteristic extends NotASinkCharacteristic {
254+ private class LoggerMethodCharacteristic extends NotASinkCharacteristic ,
255+ OtherModeledArgumentCharacteristic {
241256 LoggerMethodCharacteristic ( ) { this = "LoggerMethod" }
242257
243258 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -247,7 +262,8 @@ private class LoggerMethodCharacteristic extends NotASinkCharacteristic {
247262 }
248263}
249264
250- private class TimeoutCharacteristic extends NotASinkCharacteristic {
265+ private class TimeoutCharacteristic extends NotASinkCharacteristic ,
266+ OtherModeledArgumentCharacteristic {
251267 TimeoutCharacteristic ( ) { this = "Timeout" }
252268
253269 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -257,7 +273,8 @@ private class TimeoutCharacteristic extends NotASinkCharacteristic {
257273 }
258274}
259275
260- private class ReceiverStorageCharacteristic extends NotASinkCharacteristic {
276+ private class ReceiverStorageCharacteristic extends NotASinkCharacteristic ,
277+ OtherModeledArgumentCharacteristic {
261278 ReceiverStorageCharacteristic ( ) { this = "ReceiverStorage" }
262279
263280 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -267,7 +284,8 @@ private class ReceiverStorageCharacteristic extends NotASinkCharacteristic {
267284 }
268285}
269286
270- private class StringStartsWithCharacteristic extends NotASinkCharacteristic {
287+ private class StringStartsWithCharacteristic extends NotASinkCharacteristic ,
288+ OtherModeledArgumentCharacteristic {
271289 StringStartsWithCharacteristic ( ) { this = "StringStartsWith" }
272290
273291 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -277,15 +295,17 @@ private class StringStartsWithCharacteristic extends NotASinkCharacteristic {
277295 }
278296}
279297
280- private class StringEndsWithCharacteristic extends NotASinkCharacteristic {
298+ private class StringEndsWithCharacteristic extends NotASinkCharacteristic ,
299+ OtherModeledArgumentCharacteristic {
281300 StringEndsWithCharacteristic ( ) { this = "StringEndsWith" }
282301
283302 override predicate getEndpoints ( DataFlow:: Node n ) {
284303 exists ( DataFlow:: CallNode call | n = call .getAnArgument ( ) | call instanceof StringOps:: EndsWith )
285304 }
286305}
287306
288- private class StringRegExpTestCharacteristic extends NotASinkCharacteristic {
307+ private class StringRegExpTestCharacteristic extends NotASinkCharacteristic ,
308+ OtherModeledArgumentCharacteristic {
289309 StringRegExpTestCharacteristic ( ) { this = "StringRegExpTest" }
290310
291311 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -295,23 +315,26 @@ private class StringRegExpTestCharacteristic extends NotASinkCharacteristic {
295315 }
296316}
297317
298- private class EventRegistrationCharacteristic extends NotASinkCharacteristic {
318+ private class EventRegistrationCharacteristic extends NotASinkCharacteristic ,
319+ OtherModeledArgumentCharacteristic {
299320 EventRegistrationCharacteristic ( ) { this = "EventRegistration" }
300321
301322 override predicate getEndpoints ( DataFlow:: Node n ) {
302323 exists ( DataFlow:: CallNode call | n = call .getAnArgument ( ) | call instanceof EventRegistration )
303324 }
304325}
305326
306- private class EventDispatchCharacteristic extends NotASinkCharacteristic {
327+ private class EventDispatchCharacteristic extends NotASinkCharacteristic ,
328+ OtherModeledArgumentCharacteristic {
307329 EventDispatchCharacteristic ( ) { this = "EventDispatch" }
308330
309331 override predicate getEndpoints ( DataFlow:: Node n ) {
310332 exists ( DataFlow:: CallNode call | n = call .getAnArgument ( ) | call instanceof EventDispatch )
311333 }
312334}
313335
314- private class MembershipCandidateTestCharacteristic extends NotASinkCharacteristic {
336+ private class MembershipCandidateTestCharacteristic extends NotASinkCharacteristic ,
337+ OtherModeledArgumentCharacteristic {
315338 MembershipCandidateTestCharacteristic ( ) { this = "MembershipCandidateTest" }
316339
317340 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -321,15 +344,17 @@ private class MembershipCandidateTestCharacteristic extends NotASinkCharacterist
321344 }
322345}
323346
324- private class FileSystemAccessCharacteristic extends NotASinkCharacteristic {
347+ private class FileSystemAccessCharacteristic extends NotASinkCharacteristic ,
348+ OtherModeledArgumentCharacteristic {
325349 FileSystemAccessCharacteristic ( ) { this = "FileSystemAccess" }
326350
327351 override predicate getEndpoints ( DataFlow:: Node n ) {
328352 exists ( DataFlow:: CallNode call | n = call .getAnArgument ( ) | call instanceof FileSystemAccess )
329353 }
330354}
331355
332- private class DatabaseAccessCharacteristic extends NotASinkCharacteristic {
356+ private class DatabaseAccessCharacteristic extends NotASinkCharacteristic ,
357+ OtherModeledArgumentCharacteristic {
333358 DatabaseAccessCharacteristic ( ) { this = "DatabaseAccess" }
334359
335360 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -344,15 +369,16 @@ private class DatabaseAccessCharacteristic extends NotASinkCharacteristic {
344369 }
345370}
346371
347- private class DomCharacteristic extends NotASinkCharacteristic {
372+ private class DomCharacteristic extends NotASinkCharacteristic , OtherModeledArgumentCharacteristic {
348373 DomCharacteristic ( ) { this = "DOM" }
349374
350375 override predicate getEndpoints ( DataFlow:: Node n ) {
351376 exists ( DataFlow:: CallNode call | n = call .getAnArgument ( ) | call = DOM:: domValueRef ( ) )
352377 }
353378}
354379
355- private class NextFunctionCallCharacteristic extends NotASinkCharacteristic {
380+ private class NextFunctionCallCharacteristic extends NotASinkCharacteristic ,
381+ OtherModeledArgumentCharacteristic {
356382 NextFunctionCallCharacteristic ( ) { this = "NextFunctionCall" }
357383
358384 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -363,7 +389,8 @@ private class NextFunctionCallCharacteristic extends NotASinkCharacteristic {
363389 }
364390}
365391
366- private class DojoRequireCharacteristic extends NotASinkCharacteristic {
392+ private class DojoRequireCharacteristic extends NotASinkCharacteristic ,
393+ OtherModeledArgumentCharacteristic {
367394 DojoRequireCharacteristic ( ) { this = "DojoRequire" }
368395
369396 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -373,7 +400,8 @@ private class DojoRequireCharacteristic extends NotASinkCharacteristic {
373400 }
374401}
375402
376- private class Base64ManipulationCharacteristic extends NotASinkCharacteristic {
403+ private class Base64ManipulationCharacteristic extends NotASinkCharacteristic ,
404+ OtherModeledArgumentCharacteristic {
377405 Base64ManipulationCharacteristic ( ) { this = "Base64Manipulation" }
378406
379407 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -475,7 +503,7 @@ abstract private class StandardEndpointFilterCharacteristic extends EndpointFilt
475503 }
476504}
477505
478- private class IsArgumentToModeledFunctionCharacteristic extends StandardEndpointFilterCharacteristic {
506+ class IsArgumentToModeledFunctionCharacteristic extends StandardEndpointFilterCharacteristic {
479507 IsArgumentToModeledFunctionCharacteristic ( ) { this = "argument to modeled function" }
480508
481509 override predicate getEndpoints ( DataFlow:: Node n ) {
@@ -487,7 +515,9 @@ private class IsArgumentToModeledFunctionCharacteristic extends StandardEndpoint
487515 or
488516 CoreKnowledge:: isKnownStepSrc ( known )
489517 or
490- CoreKnowledge:: isOtherModeledArgument ( known , _)
518+ exists ( OtherModeledArgumentCharacteristic characteristic |
519+ characteristic .getEndpoints ( known )
520+ )
491521 )
492522 )
493523 }
0 commit comments