Fix unescaped error messages (#5329)

In both cases the input, which wasn't escaped before, comes from a form
element that doesn't allow any user to change its content. An ordinary
user would need to access the DOM in order to do that.

Both forms are protected by CSRF, so this mitigates any potential
exploit as well.

(cherry picked from commit acfad5ae5290d349c0ca4fe10b329e56c23201a0)
This commit is contained in:
Johannes Meyer 2025-03-20 16:20:21 +01:00
parent 64dcc33f6d
commit 244adf61b2
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@
<?= $this->tabs->render($this); ?>
<br/>
<div>
<h1>Could not <?= $action; ?> module "<?= $moduleName; ?>"</h1>
<h1>Could not <?= $action; ?> module "<?= $this->escape($moduleName); ?>"</h1>
<p>
While operation the following error occurred:
<br />

View File

@ -227,7 +227,7 @@ class BackendConfigForm extends ConfigForm
'autosubmit' => true
)
);
$resourceName = isset($formData['resource']) ? $formData['resource'] : $this->getValue('resource');
$resourceName = $this->getView()->escape($formData['resource'] ?? $this->getValue('resource'));
$this->addElement(
'note',
'resource_note',