File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
javascript/ql/src/semmle/javascript/frameworks Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -365,13 +365,25 @@ module JQuery {
365365 }
366366 }
367367
368+ /** A source of jQuery objects from the AST-based `JQueryObject` class. */
369+ private DataFlow:: Node legacyObjectSource ( ) {
370+ result = any ( JQueryObjectInternal e ) .flow ( )
371+ }
372+
368373 /** Gets a source of jQuery objects. */
369- private DataFlow:: SourceNode objectSource ( ) { result instanceof ObjectSource:: Range }
374+ private DataFlow:: SourceNode objectSource ( DataFlow:: TypeTracker t ) {
375+ t .start ( ) and
376+ result instanceof ObjectSource:: Range
377+ or
378+ exists ( DataFlow:: TypeTracker init |
379+ init .start ( ) and
380+ t = init .smallstep ( legacyObjectSource ( ) , result )
381+ )
382+ }
370383
371384 /** Gets a data flow node referring to a jQuery object. */
372385 private DataFlow:: SourceNode objectRef ( DataFlow:: TypeTracker t ) {
373- t .start ( ) and
374- result = objectSource ( )
386+ result = objectSource ( t )
375387 or
376388 exists ( DataFlow:: TypeTracker t2 | result = objectRef ( t2 ) .track ( t2 , t ) )
377389 }
@@ -394,6 +406,10 @@ module JQuery {
394406 this = dollar ( ) .getAMemberCall ( name )
395407 or
396408 this = objectRef ( ) .getAMethodCall ( name )
409+ or
410+ // Handle contributed JQuery objects that aren't source nodes (usually parameter uses)
411+ getReceiver ( ) = legacyObjectSource ( ) and
412+ this .( DataFlow:: MethodCallNode ) .getMethodName ( ) = name
397413 }
398414
399415 /**
You can’t perform that action at this time.
0 commit comments