Close admin trust audit gaps and stabilize live sweeps

This commit is contained in:
master
2026-03-12 10:14:00 +02:00
parent a00efb7ab2
commit 6964a046a5
50 changed files with 5968 additions and 2850 deletions

View File

@@ -26,6 +26,7 @@ public sealed class RouteDispatchMiddleware
// ReverseProxy paths that are legitimate browser navigation targets (e.g. OIDC flows)
// and must NOT be redirected to the SPA fallback.
private static readonly string[] BrowserProxyPaths = ["/connect", "/.well-known"];
private static readonly string[] SpaRoutesWithDocumentExtensions = ["/docs", "/docs/"];
public RouteDispatchMiddleware(
RequestDelegate next,
@@ -134,7 +135,7 @@ public sealed class RouteDispatchMiddleware
var spaFallback = route.Headers.TryGetValue("x-spa-fallback", out var spaValue) &&
string.Equals(spaValue, "true", StringComparison.OrdinalIgnoreCase);
if (spaFallback && !System.IO.Path.HasExtension(relativePath))
if (spaFallback && ShouldServeSpaFallback(relativePath))
{
var indexFile = fileProvider.GetFileInfo("/index.html");
if (indexFile.Exists && !indexFile.IsDirectory)
@@ -646,4 +647,22 @@ public sealed class RouteDispatchMiddleware
var accept = request.Headers.Accept.ToString();
return accept.Contains("text/html", StringComparison.OrdinalIgnoreCase);
}
private static bool ShouldServeSpaFallback(string relativePath)
{
if (!System.IO.Path.HasExtension(relativePath))
{
return true;
}
foreach (var prefix in SpaRoutesWithDocumentExtensions)
{
if (relativePath.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}