mirror of
https://github.com/github/codeql.git
synced 2026-03-20 22:46:47 +01:00
Remove unnecessary taint step and update qldoc
This commit is contained in:
@@ -21,12 +21,12 @@ private class ExactStringPathMatchGuard extends PathTraversalBarrierGuard instan
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the qualifier of a method call if it's a variable access, or the qualifier of the qualifier
|
||||
* if the qualifier itself is a method call, which helps to reduce FPs by handling scenarios such as
|
||||
* `!uri.getPath().contains("..")`.
|
||||
* Given input `e` = `v.method1(...).method2(...)...`, returns `v` where `v` is a `VarAccess`.
|
||||
*
|
||||
* This is used to look through field accessors such as `uri.getPath()`.
|
||||
*/
|
||||
private Expr getRealQualifier(Expr e) {
|
||||
result = getRealQualifier(e.(MethodAccess).getQualifier())
|
||||
private Expr getUnderlyingVarAccess(Expr e) {
|
||||
result = getUnderlyingVarAccess(e.(MethodAccess).getQualifier())
|
||||
or
|
||||
result = e.(VarAccess)
|
||||
}
|
||||
@@ -37,7 +37,7 @@ private class AllowListGuard extends Guard instanceof MethodAccess {
|
||||
not isDisallowedWord(super.getAnArgument())
|
||||
}
|
||||
|
||||
Expr getCheckedExpr() { result = getRealQualifier(super.getQualifier()) }
|
||||
Expr getCheckedExpr() { result = getUnderlyingVarAccess(super.getQualifier()) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ private class BlockListGuard extends Guard instanceof MethodAccess {
|
||||
isDisallowedWord(super.getAnArgument())
|
||||
}
|
||||
|
||||
Expr getCheckedExpr() { result = getRealQualifier(super.getQualifier()) }
|
||||
Expr getCheckedExpr() { result = getUnderlyingVarAccess(super.getQualifier()) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ class PathTraversalGuard extends Guard instanceof MethodAccess {
|
||||
super.getAnArgument().(CompileTimeConstantExpr).getStringValue() = ".."
|
||||
}
|
||||
|
||||
Expr getCheckedExpr() { result = getRealQualifier(super.getQualifier()) }
|
||||
Expr getCheckedExpr() { result = getUnderlyingVarAccess(super.getQualifier()) }
|
||||
}
|
||||
|
||||
/** A complementary sanitizer that protects against path traversal using path normalization. */
|
||||
|
||||
Reference in New Issue
Block a user