If httpContext.GetCurrentRequestIpAddress is called with a spoofed HTTP context then IP returns null

This commit is contained in:
Richard Ockerby
2020-05-30 23:18:56 +01:00
committed by Sebastiaan Janssen
parent 9829d4abef
commit 8af1e2bcf3

View File

@@ -68,7 +68,7 @@ namespace Umbraco.Core.Compose
{
var httpContext = HttpContext.Current == null ? (HttpContextBase) null : new HttpContextWrapper(HttpContext.Current);
var ip = httpContext.GetCurrentRequestIpAddress();
if (ip.ToLowerInvariant().StartsWith("unknown")) ip = "";
if (ip == null || ip.ToLowerInvariant().StartsWith("unknown")) ip = "";
return ip;
}
}