security: faza 4 - ochrona CSRF panelu administracyjnego

- Nowa klasa \Shared\Security\CsrfToken (generate/validate/regenerate)
- Token CSRF we wszystkich formularzach edycji (form-edit.php)
- Walidacja CSRF w FormRequestHandler::handleSubmit()
- Token CSRF w formularzu logowania i formularzach 2FA
- Walidacja CSRF w App::special_actions() dla żądań POST
- Regeneracja tokenu po udanym logowaniu (bezpośrednia i przez 2FA)
- Fix XSS: htmlspecialchars na $alert w unlogged-layout.php
- 7 nowych testów CsrfTokenTest (817 testów łącznie)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jacek
2026-03-12 10:06:40 +01:00
parent 83f55f8d00
commit 0677e75b25
11 changed files with 139 additions and 8 deletions

View File

@@ -23,10 +23,10 @@ composer test # standard
## Aktualny stan
```text
OK (810 tests, 2264 assertions)
OK (817 tests, 2271 assertions)
```
Zweryfikowano: 2026-03-10 (ver. 0.333)
Zweryfikowano: 2026-03-12 (ver. 0.337)
## Konfiguracja
@@ -71,6 +71,9 @@ tests/
| | |-- Transport/TransportRepositoryTest.php
| | |-- Update/UpdateRepositoryTest.php
| | `-- User/UserRepositoryTest.php
| |-- Shared/
| | `-- Security/
| | `-- CsrfTokenTest.php
| `-- admin/
| `-- Controllers/
| |-- ArticlesControllerTest.php