1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-21 12:05:42 +01:00

Remove IP API response (#4771)

This commit is contained in:
Matt Bishop 2024-09-12 15:23:04 -04:00 committed by GitHub
parent aa361341bd
commit 95ba256511
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -17,18 +17,4 @@ public class InfoController : Controller
{
return Json(AssemblyHelpers.GetVersion());
}
[HttpGet("~/ip")]
public JsonResult Ip()
{
var headerSet = new HashSet<string> { "x-forwarded-for", "x-connecting-ip", "cf-connecting-ip", "client-ip", "true-client-ip" };
var headers = HttpContext.Request?.Headers
.Where(h => headerSet.Contains(h.Key.ToLower()))
.ToDictionary(h => h.Key);
return new JsonResult(new
{
Ip = HttpContext.Connection?.RemoteIpAddress?.ToString(),
Headers = headers,
});
}
}