Setup-pagina verschijnt niet meer als de setup-status niet te lezen is
De route-guard las elke fout (429, 500, 503, 404) als 'niet geinitialiseerd' en stuurde naar de setup-pagina. Nu geen gok: bij een onleesbare status geen doorverwijzing. De statuslezing valt onder de ruimere limiter in plaats van de strikte login-limiter (die 5 per minuut deelt met echte inlogpogingen). De loginpagina meldt als het CMS uitgeschakeld of in onderhoud is. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using FluentAssertions;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using SlpModularCms.Modules.Identity.Controllers;
|
||||
|
||||
namespace SlpModularCms.Modules.Identity.Tests.Controllers;
|
||||
|
||||
public class SetupRateLimitTests
|
||||
{
|
||||
private static string? PolicyOf(string method) =>
|
||||
typeof(SetupController).GetMethod(method)!.GetCustomAttribute<EnableRateLimitingAttribute>()?.PolicyName;
|
||||
|
||||
[Fact]
|
||||
public void TheStatusRead_IsNotUnderTheStrictLoginLimiter()
|
||||
{
|
||||
// The admin reads it on every page load. Under the login limiter (5 a minute, shared with real login
|
||||
// attempts) a few reloads used it up and the 429 that followed was read as "not set up".
|
||||
PolicyOf(nameof(SetupController.GetStatus)).Should().Be("refresh");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreatingTheOwner_StaysUnderTheStrictLoginLimiter()
|
||||
{
|
||||
PolicyOf(nameof(SetupController.CreateOwner)).Should().Be("login");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user