mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Restrict Append calls to string arguments
This commit is contained in:
@@ -82,7 +82,8 @@ predicate nonHttpOnlyCookieCall(Call c) {
|
|||||||
or
|
or
|
||||||
// IResponseCookies.Append(String, String) was called, `HttpOnly` is set to `false` by default
|
// IResponseCookies.Append(String, String) was called, `HttpOnly` is set to `false` by default
|
||||||
mc = c and
|
mc = c and
|
||||||
mc.getNumberOfArguments() < 3
|
mc.getNumberOfArguments() < 3 and
|
||||||
|
mc.getTarget().getParameter(0).getType() instanceof StringType
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
or
|
or
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ predicate insecureCookieAppend(Expr sink) {
|
|||||||
exists(MethodCall mc, MicrosoftAspNetCoreHttpResponseCookies iResponse |
|
exists(MethodCall mc, MicrosoftAspNetCoreHttpResponseCookies iResponse |
|
||||||
mc = sink and
|
mc = sink and
|
||||||
iResponse.getAppendMethod() = mc.getTarget() and
|
iResponse.getAppendMethod() = mc.getTarget() and
|
||||||
mc.getNumberOfArguments() < 3
|
mc.getNumberOfArguments() < 3 and
|
||||||
|
mc.getTarget().getParameter(0).getType() instanceof StringType
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user