File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
ruby/ql/lib/codeql/ruby/security Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -285,14 +285,22 @@ private module OrmTracking {
285285 * A data flow configuration to track flow from finder calls to field accesses.
286286 */
287287 private module Config implements DataFlow:: ConfigSig {
288- predicate isSource ( DataFlow:: Node source ) { source instanceof OrmInstantiation }
288+ predicate isSource ( DataFlow:: Node source ) {
289+ // We currently only use ORM instances that come from a call site, so restrict the sources
290+ // to calls. This works around a performance issue that would arise from using 'self' as a source
291+ // in ActiveRecord models. Over time, library models should stop relying on OrmInstantiation and instead
292+ // use API graphs or type-tracking the same way we track other types.
293+ source instanceof OrmInstantiation and source instanceof DataFlow:: CallNode
294+ }
289295
290296 // Select any call receiver and narrow down later
291297 predicate isSink ( DataFlow:: Node sink ) { sink = any ( DataFlow:: CallNode c ) .getReceiver ( ) }
292298
293299 predicate isAdditionalFlowStep ( DataFlow:: Node node1 , DataFlow:: Node node2 ) {
294300 Shared:: isAdditionalXssFlowStep ( node1 , node2 )
295301 }
302+
303+ predicate isBarrierIn ( DataFlow:: Node node ) { node instanceof DataFlow:: SelfParameterNode }
296304 }
297305
298306 import DataFlow:: Global< Config >
You can’t perform that action at this time.
0 commit comments