Baustein 10: Deployment-Haertung (Kapitel 10)
- Rate Limiting ueber ASP.NET Cores eingebautes Microsoft.AspNetCore.RateLimiting (keine neue Paketabhaengigkeit): /api/auth/login auf 5 Versuche/Minute begrenzt (Brute-Force-Schutz), alle Endpunkte zusaetzlich global auf 120 Anfragen/Minute je IP - Kestrel MaxRequestBodySize auf 15 MB gedeckelt (Anhaenge sind clientseitig ohnehin auf 10 MB begrenzt) - Neu docker/backup.sh: Tar-Archiv von ./data (Ereignis-Logs, Snapshots, Anhaenge, Nutzer), raeumt Archive aelter als 30 Tage auf, laeuft direkt auf dem Host - docker/README.md um Backup- und Rate-Limit-Dokumentation ergaenzt Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Text;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Sync.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.RateLimiting;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
||||
namespace LehrerApp.Api;
|
||||
@@ -21,7 +22,7 @@ public static class Endpoints
|
||||
if (!store.VerifyPassword(req.Username, req.Password))
|
||||
return Results.Unauthorized();
|
||||
return Results.Ok(new { token = Jwt(req.Username, secret), userId = req.Username });
|
||||
});
|
||||
}).RequireRateLimiting("login");
|
||||
}
|
||||
|
||||
// ── Sync ──────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user