PUT /availability/status vervangt POST /availability/admin/status; de poort sluit alleen het lezen van de status vrij

De status is één resource: de publieke GET en de PUT van de beheerder delen het pad; de PUT geeft de bijgewerkte resource terug. De vrijstelling van de poort geldt nu alleen voor GET en HEAD, zodat de PUT als beheerroute gewoon achter de poort blijft. De oude route verdwijnt zonder alias, dus API en admin-app moeten als één release uit.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 13:39:40 +01:00
co-authored by Claude Sonnet 5.5
parent a3b67b6a36
commit 728fc08db8
16 changed files with 344 additions and 45 deletions
@@ -40,9 +40,12 @@ public class AvailabilityMiddleware
// on the bypass list, which only went unnoticed while another server (nginx) served the website and the SPA.
private const string GatedPrefix = "/api/";
// Reading the status stays open for everyone (GET/HEAD only). Changing it (PUT, same path) is an admin route and
// is NOT exempted: it follows the normal gate (a verified Owner/Administrator passes).
private const string StatusPath = "/api/v1/Availability/status";
private static readonly string[] _bypassPrefixes =
[
"/api/v1/Availability/status",
"/api/v1/Auth/",
"/api/v1/Setup/status",
"/api/v1/master/",
@@ -63,7 +66,9 @@ public class AvailabilityMiddleware
return;
}
if (_bypassPrefixes.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)))
var readsStatus = path.StartsWith(StatusPath, StringComparison.OrdinalIgnoreCase)
&& (HttpMethods.IsGet(context.Request.Method) || HttpMethods.IsHead(context.Request.Method));
if (readsStatus || _bypassPrefixes.Any(p => path.StartsWith(p, StringComparison.OrdinalIgnoreCase)))
{
await _next(context);
return;