// SPDX-FileCopyrightText: 2026 Progmasoft // SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.0 namespace Progmasoft.Progmaweb.Api.Security; internal sealed class SecurityHeadersMiddleware(RequestDelegate next) { public async Task InvokeAsync(HttpContext context) { IHeaderDictionary headers = context.Response.Headers; headers["Content-Security-Policy"] = "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'"; headers["Referrer-Policy"] = "no-referrer"; headers["X-Content-Type-Options"] = "nosniff"; headers["X-Frame-Options"] = "DENY"; headers.Append("Permissions-Policy", "camera=(), microphone=(), geolocation=()"); headers["Cache-Control"] = "no-store"; await next(context); } }