@@ -21,12 +21,12 @@ private class ExactStringPathMatchGuard extends PathTraversalBarrierGuard instan
2121}
2222
2323/**
24- * Returns the qualifier of a method call if it's a variable access, or the qualifier of the qualifier
25- * if the qualifier itself is a method call, which helps to reduce FPs by handling scenarios such as
26- * `! uri.getPath().contains(".." )`.
24+ * Given input `e` = `v.method1(...).method2(...)...`, returns `v` where `v` is a `VarAccess`.
25+ *
26+ * This is used to look through field accessors such as ` uri.getPath()`.
2727 */
28- private Expr getRealQualifier ( Expr e ) {
29- result = getRealQualifier ( e .( MethodAccess ) .getQualifier ( ) )
28+ private Expr getUnderlyingVarAccess ( Expr e ) {
29+ result = getUnderlyingVarAccess ( e .( MethodAccess ) .getQualifier ( ) )
3030 or
3131 result = e .( VarAccess )
3232}
@@ -37,7 +37,7 @@ private class AllowListGuard extends Guard instanceof MethodAccess {
3737 not isDisallowedWord ( super .getAnArgument ( ) )
3838 }
3939
40- Expr getCheckedExpr ( ) { result = getRealQualifier ( super .getQualifier ( ) ) }
40+ Expr getCheckedExpr ( ) { result = getUnderlyingVarAccess ( super .getQualifier ( ) ) }
4141}
4242
4343/**
@@ -84,7 +84,7 @@ private class BlockListGuard extends Guard instanceof MethodAccess {
8484 isDisallowedWord ( super .getAnArgument ( ) )
8585 }
8686
87- Expr getCheckedExpr ( ) { result = getRealQualifier ( super .getQualifier ( ) ) }
87+ Expr getCheckedExpr ( ) { result = getUnderlyingVarAccess ( super .getQualifier ( ) ) }
8888}
8989
9090/**
@@ -155,7 +155,7 @@ class PathTraversalGuard extends Guard instanceof MethodAccess {
155155 super .getAnArgument ( ) .( CompileTimeConstantExpr ) .getStringValue ( ) = ".."
156156 }
157157
158- Expr getCheckedExpr ( ) { result = getRealQualifier ( super .getQualifier ( ) ) }
158+ Expr getCheckedExpr ( ) { result = getUnderlyingVarAccess ( super .getQualifier ( ) ) }
159159}
160160
161161/** A complementary sanitizer that protects against path traversal using path normalization. */
0 commit comments