fix(security): Add security hardening and CSRF protection.
Added .htaccess rules to deny access to hidden files. Escaped JSON output in views to prevent XSS attacks. Converted delete links and forms to use POST with CSRF tokens. Enforced POST method on sensitive routes. Added tests to verify these security controls.
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
<?php
|
||||
|
||||
phpb_requires_authenticated();
|
||||
if (($_SERVER['REQUEST_METHOD'] ?? '') !== 'POST') {
|
||||
http_response_code(405);
|
||||
return;
|
||||
}
|
||||
if (!function_exists('phpb_validate_csrf') || !phpb_validate_csrf()) {
|
||||
http_response_code(403);
|
||||
return;
|
||||
}
|
||||
|
||||
$formsRepository = new \Plugi\Extensions\Form\DefinitionsRepository();
|
||||
|
||||
if(
|
||||
|
||||
Reference in New Issue
Block a user