mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
C#: Re-factor to avoid multiple explicit casts.
This commit is contained in:
@@ -115,17 +115,21 @@ class HttpServerTransferSink extends Sink {
|
||||
}
|
||||
}
|
||||
|
||||
private predicate isLocalUrlSanitizer(Guard g, Expr e, AbstractValue v) {
|
||||
(
|
||||
g.(MethodCall).getTarget().hasName("IsLocalUrl") and
|
||||
e = g.(MethodCall).getArgument(0)
|
||||
private predicate isLocalUrlSanitizerMethodCall(MethodCall guard, Expr e, AbstractValue v) {
|
||||
exists(Method m | m = guard.getTarget() |
|
||||
m.hasName("IsLocalUrl") and
|
||||
e = guard.getArgument(0)
|
||||
or
|
||||
g.(MethodCall).getTarget().hasName("IsUrlLocalToHost") and
|
||||
e = g.(MethodCall).getArgument(1)
|
||||
m.hasName("IsUrlLocalToHost") and
|
||||
e = guard.getArgument(1)
|
||||
) and
|
||||
v.(AbstractValues::BooleanValue).getValue() = true
|
||||
}
|
||||
|
||||
private predicate isLocalUrlSanitizer(Guard g, Expr e, AbstractValue v) {
|
||||
isLocalUrlSanitizerMethodCall(g, e, v)
|
||||
}
|
||||
|
||||
/**
|
||||
* A URL argument to a call to `UrlHelper.IsLocalUrl()` or `HttpRequestBase.IsUrlLocalToHost()` that
|
||||
* is a sanitizer for URL redirects.
|
||||
|
||||
Reference in New Issue
Block a user