Files
portal/app/tests/Feature/SecurityHeadersTest.php
T
Дмитрий 84936929eb feat(security): middleware безопасных HTTP-заголовков — закрытие ZAP Medium anti-clickjacking
X-Frame-Options SAMEORIGIN + X-Content-Type-Options nosniff + Referrer-Policy на все web-ответы (go-live аудит 17.06). CSP вынесен отдельно (SPA Vue+Vuetify). TDD-тест на публичном /.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 17:12:32 +03:00

22 lines
882 B
PHP

<?php
declare(strict_types=1);
/**
* SecurityHeaders middleware — безопасные HTTP-заголовки на всех web-ответах.
* Закрывает ZAP Medium «Missing Anti-clickjacking Header» (go-live аудит 17.06.2026).
* Бьём по публичному / (welcome SPA) — auth и БД не нужны.
*/
test('публичный / отдаёт заголовок X-Frame-Options SAMEORIGIN', function () {
$this->get('/')->assertHeader('X-Frame-Options', 'SAMEORIGIN');
});
test('публичный / отдаёт X-Content-Type-Options nosniff', function () {
$this->get('/')->assertHeader('X-Content-Type-Options', 'nosniff');
});
test('публичный / отдаёт Referrer-Policy strict-origin-when-cross-origin', function () {
$this->get('/')->assertHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
});