Skip to content

Commit d8d7688

Browse files
committed
C#: Fix another bad join
1 parent 6aa4c5c commit d8d7688

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

csharp/ql/src/Security Features/CWE-352/MissingAntiForgeryTokenValidation.ql

+7-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ class AntiForgeryAuthorizationFilter extends AuthorizationFilter {
2727
AntiForgeryAuthorizationFilter() { this.getOnAuthorizationMethod() = getAValidatingMethod() }
2828
}
2929

30+
private Method getAStartedMethod() {
31+
result = any(WebApplication wa).getApplication_StartMethod()
32+
or
33+
getAStartedMethod().calls(result)
34+
}
35+
3036
/**
3137
* Holds if the project has a global anti forgery filter.
3238
*/
@@ -38,9 +44,7 @@ predicate hasGlobalAntiForgeryFilter() {
3844
// The filter is an antiforgery filter
3945
addGlobalFilter.getArgumentForName("filter").getType() instanceof AntiForgeryAuthorizationFilter and
4046
// The filter is added by the Application_Start() method
41-
any(WebApplication wa)
42-
.getApplication_StartMethod()
43-
.calls*(addGlobalFilter.getEnclosingCallable())
47+
getAStartedMethod() = addGlobalFilter.getEnclosingCallable()
4448
)
4549
}
4650

0 commit comments

Comments
 (0)