feat: Spamschutz für Kontakt-Widget und Registrierung mit Cloudflare Turnstile
- Turnstile für Gäste und unbestätigte Konten (TurnstileVerifier, <x-turnstile>); ist Cloudflare nicht erreichbar, wird durchgelassen und im Verlauf, in der Kontakt-Queue und in der Betriebsüberwachung markiert - Inhaltsfilter des Kontaktformulars (fremde Links, Floskel mit Seitentitel, Zeichensalat, Sperrliste, Absenden unter 3 Sekunden); Treffer landen in der Spam-Quarantäne ohne Mail, Löschung nach 30 Tagen - Admin: Filter „Spam“, Sammelaktion, „Kein Spam“ holt die Mail nach - Registrierung lehnt Zufallsnamen ab; users:prune-bot-registrations (täglicher Lauf erst mit USERS_PRUNE_BOT_REGISTRATIONS=true) - contact-messages:quarantine-spam für den Altbestand - CSP erlaubt challenges.cloudflare.com, Log-Kanal spam - Datenschutzerklärung: Abschnitt 6a Cloudflare Turnstile (Vorschlag) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
61f449f483
commit
06d2889a4d
40 changed files with 1992 additions and 40 deletions
21
tests/Unit/GibberishDetectorTest.php
Normal file
21
tests/Unit/GibberishDetectorTest.php
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use App\Services\Spam\GibberishDetector;
|
||||
|
||||
test('bot names are recognised as random person names', function (string $name) {
|
||||
expect(GibberishDetector::isRandomPersonName($name))->toBeTrue();
|
||||
})->with(['ruLrlotwaCoVStmZetSxD', 'VBwauClhcuUvMvksdgWnjr', 'iOmGRYDQjETnnHmPKzjgGe']);
|
||||
|
||||
test('real person names are never random', function (string $name) {
|
||||
expect(GibberishDetector::isRandomPersonName($name))->toBeFalse();
|
||||
})->with(['Paula Presse', 'MacGregor', 'Anna-Lena Müller', 'McDonaldSmith', 'RobertHix', 'ABCDEFGHIJKLMN']);
|
||||
|
||||
test('the contact name check spares company names but catches bot tokens', function (string $value, bool $random) {
|
||||
expect(GibberishDetector::isRandomToken($value))->toBe($random);
|
||||
})->with([
|
||||
'company with camel case' => ['StammZellenPowerTeam', false],
|
||||
'company with caps' => ['KUUNSTPavillon', false],
|
||||
'bot name' => ['ruLrlotwaCoVStmZetSxD', true],
|
||||
'letter-digit block' => ['NAEWTRER2720160NEYRTHYT', true],
|
||||
'normal sentence' => ['Guten Tag, ich habe eine Frage.', false],
|
||||
]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue