File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
csharp/ql/lib/semmle/code/csharp/security/auth Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import csharp
4
4
import semmle.code.csharp.dataflow.flowsources.Remote
5
+ import DataFlow as DF
6
+ import TaintTracking as TT
5
7
import ActionMethods
6
8
7
9
/**
@@ -12,8 +14,6 @@ import ActionMethods
12
14
// Other queries check that there are authorization checks in place for admin methods.
13
15
private predicate needsChecks ( ActionMethod m ) { m .isEdit ( ) and not m .isAdmin ( ) }
14
16
15
- private Expr getParentExpr ( Expr ex ) { result .getAChildExpr ( ) = ex }
16
-
17
17
/**
18
18
* Holds if `m` has a parameter or access a remote flow source
19
19
* that may indicate that it's used as the ID for some resource
@@ -23,9 +23,10 @@ private predicate hasIdParameter(ActionMethod m) {
23
23
src .asParameter ( ) .getName ( ) .toLowerCase ( ) .matches ( [ "%id" , "%idx" ] )
24
24
or
25
25
// handle cases like `Request.QueryString["Id"]`
26
- exists ( StringLiteral idStr |
26
+ exists ( StringLiteral idStr , IndexerCall idx |
27
27
idStr .getValue ( ) .toLowerCase ( ) .matches ( [ "%id" , "%idx" ] ) and
28
- getParentExpr * ( src .asExpr ( ) ) = getParentExpr * ( idStr )
28
+ TT:: localTaint ( src , DataFlow:: exprNode ( idx .getQualifier ( ) ) ) and
29
+ DF:: localExprFlow ( idStr , idx .getArgument ( 0 ) )
29
30
)
30
31
)
31
32
}
You can’t perform that action at this time.
0 commit comments