@@ -138,12 +138,6 @@ private class AllowedPrefixSanitizer extends PathInjectionSanitizer {
138138 * been checked for a trusted prefix.
139139 */
140140private predicate dotDotCheckGuard ( Guard g , Expr e , boolean branch ) {
141- // Local taint-flow is used here to handle cases where the validated expression comes from the
142- // expression reaching the sink, but it's not the same one, e.g.:
143- // Path path = source();
144- // String strPath = path.toString();
145- // if (!strPath.contains("..") && strPath.startsWith("/safe/dir"))
146- // sink(path);
147141 pathTraversalGuard ( g , e , branch ) and
148142 exists ( Guard previousGuard |
149143 previousGuard .( AllowedPrefixGuard ) .controls ( g .getBasicBlock ( ) , true )
@@ -365,6 +359,12 @@ private predicate maybeNull(Expr expr) {
365359
366360/** Holds if `g` is a guard that checks for `..` components. */
367361private predicate pathTraversalGuard ( Guard g , Expr e , boolean branch ) {
362+ // Local taint-flow is used here to handle cases where the validated expression comes from the
363+ // expression reaching the sink, but it's not the same one, e.g.:
364+ // Path path = source();
365+ // String strPath = path.toString();
366+ // if (!strPath.contains("..") && strPath.startsWith("/safe/dir"))
367+ // sink(path);
368368 branch = g .( PathTraversalGuard ) .getBranch ( ) and
369369 localTaintFlowToPathGuard ( e , g )
370370}
0 commit comments