@@ -907,13 +907,15 @@ module Routing {
907907 /**
908908 * Like `getAnAccessPathRhs` but with `base` mapped to its root node.
909909 */
910+ pragma [ nomagic]
910911 private DataFlow:: Node getAnAccessPathRhsUnderRoot ( RootNode root , int n , string path ) {
911912 result = getAnAccessPathRhs ( root .getADescendant ( ) , n , path )
912913 }
913914
914915 /**
915916 * Like `getAnAccessPathRead` but with `base` mapped to its root node.
916917 */
918+ pragma [ nomagic]
917919 private DataFlow:: SourceNode getAnAccessPathReadUnderRoot ( RootNode root , int n , string path ) {
918920 result = getAnAccessPathRead ( root .getADescendant ( ) , n , path )
919921 }
@@ -928,7 +930,7 @@ module Routing {
928930 private predicate middlewareApiStep ( DataFlow:: SourceNode pred , DataFlow:: SourceNode succ ) {
929931 exists ( RootNode root , int n , string path |
930932 pred = getAnAccessPathRhsUnderRoot ( root , n , path ) and
931- succ = getAnAccessPathReadUnderRoot ( root , n , path )
933+ succ = getAnAccessPathReadUnderRoot ( root , n , pragma [ only_bind_out ] ( path ) )
932934 )
933935 or
934936 // We can't augment the call graph as this depends on type tracking, so just
@@ -947,13 +949,21 @@ module Routing {
947949 }
948950 }
949951
952+ pragma [ nomagic]
953+ private predicate potentialAccessPathStep (
954+ Node writer , DataFlow:: SourceNode pred , Node reader , DataFlow:: SourceNode succ , int n ,
955+ string path
956+ ) {
957+ pred = getAnAccessPathRhs ( writer , n , path ) and
958+ succ = getAnAccessPathRead ( reader , n , pragma [ only_bind_out ] ( path ) )
959+ }
960+
950961 /**
951962 * Holds if `pred -> succ` is a data-flow step between access paths on request input objects.
952963 */
953964 private predicate middlewareDataFlowStep ( DataFlow:: Node pred , DataFlow:: Node succ ) {
954965 exists ( Node writer , Node reader , int n , string path |
955- pred = getAnAccessPathRhs ( writer , n , path ) and
956- succ = getAnAccessPathRead ( reader , n , path ) and
966+ potentialAccessPathStep ( writer , pred , reader , succ , n , path ) and
957967 pragma [ only_bind_out ] ( reader ) .isGuardedByNode ( pragma [ only_bind_out ] ( writer ) )
958968 )
959969 or
0 commit comments