Refactor app architecture and clean local artifacts

This commit is contained in:
AzuTear
2026-06-24 23:43:14 +02:00
parent 17134b3b82
commit fef1d36fe8
274 changed files with 37724 additions and 6065 deletions
@@ -0,0 +1,35 @@
namespace Backend.Security;
public sealed class SecurityHeadersMiddleware(RequestDelegate next)
{
public async Task InvokeAsync(HttpContext context)
{
context.Response.OnStarting(() =>
{
var headers = context.Response.Headers;
headers["X-Content-Type-Options"] = "nosniff";
headers["X-Frame-Options"] = "DENY";
headers["Referrer-Policy"] = "strict-origin-when-cross-origin";
headers["Permissions-Policy"] = "camera=(), microphone=(), geolocation=()";
headers["Cross-Origin-Opener-Policy"] = "same-origin";
if (!headers.ContainsKey("Content-Security-Policy"))
{
headers["Content-Security-Policy"] =
"default-src 'self'; " +
"img-src 'self' data: https:; " +
"font-src 'self' https://fonts.gstatic.com data:; " +
"style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; " +
"script-src 'self'; " +
"connect-src 'self' https:; " +
"frame-ancestors 'none'; " +
"base-uri 'self'; " +
"form-action 'self';";
}
return Task.CompletedTask;
});
await next(context);
}
}