- Patch-/Minor-Updates (guzzle, commonmark, flysystem, excel, phpspreadsheet, phpseclib, laravel/framework 11.x) - barryvdh/laravel-dompdf 3.1 (dompdf 3.1.6), Test fuer den PDF-Weg inkl. eingebettetem PHP und Briefpapier - Rueckport des Laravel-12.60-Fixes gegen CRLF in der email-Regel - Protokoll: Ergebnis composer audit, offene Punkte Laravel 12 und PDF-Seitenzahlen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
33 lines
1.2 KiB
PHP
33 lines
1.2 KiB
PHP
<?php
|
|
|
|
use App\Support\Validation\Validator as SafeEmailValidator;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Tests\TestCase;
|
|
|
|
uses(TestCase::class);
|
|
|
|
/**
|
|
* Rückportierter Fix aus Laravel 12.60 (GHSA-5vg9-5847-vvmq): Adressen mit
|
|
* Zeilenumbruch sind nach RFC teils gültig, ermöglichen aber das Einschleusen
|
|
* von Mail-Headern. Die email-Regel muss sie in jeder Variante ablehnen.
|
|
*/
|
|
test('the application uses the validator with the line break check', function () {
|
|
expect(Validator::make([], []))->toBeInstanceOf(SafeEmailValidator::class);
|
|
});
|
|
|
|
test('addresses with line breaks are rejected', function (string $email, string $rule) {
|
|
expect(Validator::make(['email' => $email], ['email' => $rule])->fails())->toBeTrue();
|
|
})->with([
|
|
'quoted local part' => "\"a\r\n b\"@example.com",
|
|
'folded local part' => "a\r\n @example.com",
|
|
'comment' => "(c\r\n )a@example.com",
|
|
'bare line feed' => "\"a\n b\"@example.com",
|
|
])->with(['email', 'email:rfc', 'required|email|max:191']);
|
|
|
|
test('ordinary addresses stay valid', function (string $email) {
|
|
expect(Validator::make(['email' => $email], ['email' => 'email'])->passes())->toBeTrue();
|
|
})->with([
|
|
'kunde@example.com',
|
|
'vor.name+shop@sub.example.de',
|
|
'müller@example.de',
|
|
]);
|