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:
@@ -58,9 +58,13 @@ $forms = $formsRepository->getAll();
|
||||
<a href="<?= phpb_url('website_manager', ['tab' => 'ext--form', 'action' => 'editForm', 'id' => $form['id']]) ?>" class="btn btn-ghost btn-square btn-sm" title="<?= phpb_trans('website-manager.edit') ?>" aria-label="<?= phpb_trans('website-manager.edit') ?> <?= phpb_e($form['name']) ?>">
|
||||
<i class="ph-duotone ph-pencil-line text-lg" aria-hidden="true"></i>
|
||||
</a>
|
||||
<a href="/ext--form/delete-form?id=<?= $form['id'] ?>" class="btn btn-ghost btn-square btn-sm text-error" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>">
|
||||
<i class="ph-duotone ph-trash text-lg" aria-hidden="true"></i>
|
||||
</a>
|
||||
<form action="/ext--form/delete-form" method="post">
|
||||
<?php phpb_csrf_field(); ?>
|
||||
<input type="hidden" name="id" value="<?= phpb_e((string) $form['id']) ?>">
|
||||
<button type="submit" class="btn btn-ghost btn-square btn-sm text-error" title="<?= phpb_trans('website-manager.remove') ?>" aria-label="<?= phpb_trans('website-manager.remove') ?> <?= phpb_e($form['name']) ?>">
|
||||
<i class="ph-duotone ph-trash text-lg" aria-hidden="true"></i>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user