Path: redb-identity/tests/redb.Identity.Web.Tests/SecurityHeadersTests.cs Snapshot: redb-identity, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-identity Page: https://redbase.app/src/dev-2026-12-06/redb-identity/tests/redb.Identity.Web.Tests/SecurityHeadersTests.cs ---- using System.Net.Http; using AwesomeAssertions; using Microsoft.AspNetCore.Mvc.Testing; using Xunit; namespace redb.Identity.Web.Tests; /// /// F-2.5 regression: production-grade security response headers must be present /// on every response from the BFF. /// public sealed class SecurityHeadersTests : IClassFixture { private readonly WebHostFixture _factory; public SecurityHeadersTests(WebHostFixture factory) { _factory = factory; } [Fact] public async Task Health_endpoint_emits_security_headers() { var client = _factory.CreateClient(new WebApplicationFactoryClientOptions { AllowAutoRedirect = false }); var resp = await client.GetAsync("/health"); resp.EnsureSuccessStatusCode(); resp.Headers.Should().ContainKey("Content-Security-Policy"); resp.Headers.GetValues("Content-Security-Policy").Should() .ContainSingle().Which.Should().Contain("default-src 'self'"); resp.Headers.Should().ContainKey("X-Frame-Options"); resp.Headers.GetValues("X-Frame-Options").Should().ContainSingle().Which.Should().Be("DENY"); resp.Headers.Should().ContainKey("X-Content-Type-Options"); resp.Headers.GetValues("X-Content-Type-Options").Should().ContainSingle().Which.Should().Be("nosniff"); resp.Headers.Should().ContainKey("Referrer-Policy"); resp.Headers.Should().ContainKey("Permissions-Policy"); resp.Headers.Should().ContainKey("Cross-Origin-Opener-Policy"); } }