security: add CSRF protection and harden core handling
Add CSRF token validation and include tokens in authentication, website manager, and GrapesJS forms and requests. Harden login with password hash verification and session ID regeneration, validate database identifiers and charset, and secure upload MIME detection and filename generation. Update nullable type declarations and PHP syntax across core contracts and modules, switch the Docker image to PHP 8.4, and move the theme script asset to the end of the page. Refresh the PageBuilderBody distribution assets.
This commit is contained in:
@@ -217,7 +217,7 @@ class WebsiteManager implements WebsiteManagerContract
|
||||
*
|
||||
* @param PageContract $page
|
||||
*/
|
||||
public function renderPageSettings(PageContract $page = null)
|
||||
public function renderPageSettings(?PageContract $page = null)
|
||||
{
|
||||
$action = isset($page) ? 'edit' : 'create';
|
||||
$theme = phpb_instance('theme', [
|
||||
|
||||
@@ -10,6 +10,7 @@ $pageTranslations = $page ? $page->getTranslations() : [];
|
||||
|
||||
<div class="manager-panel p-8 w-full">
|
||||
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'page_settings', 'action' => $action]) ?><?= $pageUrlParam ?>">
|
||||
<?php phpb_csrf_field(); ?>
|
||||
<div class="text-center text-3xl font-bold mb-8 mt-2">
|
||||
<?php
|
||||
if ($action === 'create'):
|
||||
|
||||
@@ -14,6 +14,7 @@ use Plugi\Setting;
|
||||
<th>Database</th>
|
||||
<td>
|
||||
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'database', 'action' => 'update']) ?>">
|
||||
<?php phpb_csrf_field(); ?>
|
||||
<?php
|
||||
global $phpb_db;
|
||||
$diff = $phpb_db->diffDB();
|
||||
|
||||
@@ -8,6 +8,7 @@ $pages = $pageRepository->getAll();
|
||||
?>
|
||||
|
||||
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'menus', 'action' => 'update', 'tab' => 'menus']) ?>">
|
||||
<?php phpb_csrf_field(); ?>
|
||||
|
||||
<div class="main-spacing" x-data="{menus: <?= phpb_e($menusJson) ?>, pages: <?= phpb_e($menuPagesJson) ?>}">
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ $settingIns = phpb_instance('setting');
|
||||
?>
|
||||
|
||||
<form method="post" action="<?= phpb_url('website_manager', ['route' => 'settings', 'action' => 'update', 'tab' => 'settings']) ?>">
|
||||
<?php phpb_csrf_field(); ?>
|
||||
<div class="" x-data="{activeTab: 0, tabs: ['Website','Language','Theme','Extensions']}">
|
||||
<div class="tabs mb-6">
|
||||
<div class="border-b border-base-300 grow"></div>
|
||||
|
||||
Reference in New Issue
Block a user