mirror of
https://github.com/whoswhip/Sharpbin.git
synced 2026-12-06 02:48:43 +00:00
feat: implement rate limiting policy for site info endpoints in Auth and Paste controllers
This commit is contained in:
@@ -148,6 +148,7 @@ namespace SharpbinV3.Server.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableRateLimiting("NoLimit")]
|
||||||
[Route("info")]
|
[Route("info")]
|
||||||
public IActionResult GetSiteInfo()
|
public IActionResult GetSiteInfo()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -399,6 +399,7 @@ namespace SharpbinV3.Server.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
[EnableRateLimiting("NoLimit")]
|
||||||
[Route("info")]
|
[Route("info")]
|
||||||
public IActionResult GetCreatePasteOptions()
|
public IActionResult GetCreatePasteOptions()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ namespace SharpbinV3.Server
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
|
options.AddPolicy("NoLimit", _ => RateLimitPartition.GetNoLimiter());
|
||||||
|
|
||||||
options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext =>
|
options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(httpContext =>
|
||||||
{
|
{
|
||||||
var remoteIp = httpContext.GetRequestIP();
|
var remoteIp = httpContext.GetRequestIP();
|
||||||
|
|||||||
Reference in New Issue
Block a user