Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/api-tests/SecurityHeaderTests.cs
diff options
context:
space:
mode:
authorLeitwolf2026-10-15 18:44:01 +0300
committerGitHub2026-10-15 18:44:01 +0300
commit3877e3318e875cdebc3d7b9bc970b4496e5183a9 (patch)
treed6390125eb9045ab3496f6cee7544f26a183c4ba /apps/api-tests/SecurityHeaderTests.cs
parenta7604e755e5bb77729a309daea75b14522d22afe (diff)
parentbd83e9e0fba03a4436e4fcfdde33c1e04d1a9c8f (diff)
downloadprogmaweb-3877e3318e875cdebc3d7b9bc970b4496e5183a9.tar.gz
Merge pull request #37 from Progmasoft/fix/hsts-preload
Treat progmasoft.com as an HSTS-preloaded domain
Diffstat (limited to 'apps/api-tests/SecurityHeaderTests.cs')
-rw-r--r--apps/api-tests/SecurityHeaderTests.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/apps/api-tests/SecurityHeaderTests.cs b/apps/api-tests/SecurityHeaderTests.cs
index 2d53ecf..e355035 100644
--- a/apps/api-tests/SecurityHeaderTests.cs
+++ b/apps/api-tests/SecurityHeaderTests.cs
@@ -4,6 +4,7 @@
using System.Net;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.HttpOverrides;
+using Microsoft.AspNetCore.Mvc.Testing;
using Progmasoft.Progmaweb.Api.Security;
namespace Progmasoft.Progmaweb.Api.Tests;
@@ -41,4 +42,21 @@ public sealed class SecurityHeaderTests
Assert.Contains("frame-ancestors 'none'",
Assert.Single(response.Headers.GetValues("Content-Security-Policy")), StringComparison.Ordinal);
}
+
+ [Fact]
+ public async Task HttpsResponsesCarryThePreloadPolicyNginxSends()
+ {
+ await using AccountApiFactory factory = new();
+ using HttpClient client = factory.CreateClient(new WebApplicationFactoryClientOptions
+ {
+ AllowAutoRedirect = false,
+ BaseAddress = new Uri("https://account.progmasoft.com"),
+ });
+
+ HttpResponseMessage response =
+ await client.GetAsync("/api/v1/status", TestContext.Current.CancellationToken);
+
+ Assert.Equal("max-age=63072000; includeSubDomains; preload",
+ Assert.Single(response.Headers.GetValues("Strict-Transport-Security")));
+ }
}