Contactmodule: token- en inzendroute met spamafhandeling, idempotentie en retentietaak

Nieuwe module SlpModularCms.Modules.Contact met eigen DbContext en migratie InitialCreate. GET contact-messages/token en POST contact-messages zijn publiek ([PublicSiteEndpoint]), geven bij echte inzendingen, spam en herhalingen hetzelfde 202 en slaan spam apart op (30 dagen, dagplafond). Standaard staat de module uit (Contact:Enabled=false, 404 met lege body, geen databasetoegang) totdat de rate limiting per client op de basisbranch staat; de rate-limit-sleutel zit in een enkele functie zodat dat later een regel wijzigen is. Mail zit achter een seam (nog een no-op).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 13:07:27 +01:00
co-authored by Claude Sonnet 5.5
parent 0f6f5475a1
commit 7748bbe9c9
37 changed files with 3266 additions and 9 deletions
@@ -0,0 +1,3 @@
// Exposes the top-level-statements Program class so WebApplicationFactory<Program> can start the
// composed host in tests (same approach as SlpModularCms.Api/Program.Coverage.cs).
public partial class Program { }
@@ -20,6 +20,7 @@
<ItemGroup>
<ProjectReference Include="..\SlpModularCms.Core\SlpModularCms.Core.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Availability\SlpModularCms.Modules.Availability.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Contact\SlpModularCms.Modules.Contact.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Identity\SlpModularCms.Modules.Identity.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Master\SlpModularCms.Modules.Master.csproj" />
<ProjectReference Include="..\SlpModularCms.Modules.Offerings\SlpModularCms.Modules.Offerings.csproj" />
@@ -61,6 +61,22 @@
"Cors": {
"AllowedOrigins": []
},
"Contact": {
// OFF by default. Do not enable on a public host until per-client rate limiting is on the
// base branch (see ContactRateLimitPartition): until then the contact rate limits are one
// bucket shared by all visitors.
"Enabled": false,
"SiteId": "slpsoftware",
"MinSeconds": 3,
"TokenLifetimeMinutes": 120,
"RetentionMonths": 12,
"SpamRetentionDays": 30,
"MaxSpamRowsPerDay": 200,
"MaxBodyBytes": 16384,
"Captcha": {
"Enabled": false
}
},
"RateLimiting": {
"Login": {
"PermitLimit": 5,
@@ -77,6 +93,14 @@
"OfferingsPublic": {
"PermitLimit": 120,
"WindowSeconds": 60
},
"ContactForm": {
"PermitLimit": 5,
"WindowSeconds": 600
},
"ContactToken": {
"PermitLimit": 20,
"WindowSeconds": 600
}
},
"SecurityHeaders": {