Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/fix-edithtml-map-editing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FIX: Non-admin roles (e.g. Managers) can edit maps again - the editHtml permission is now only required to change HTML content, not for every map modification (#452)
17 changes: 16 additions & 1 deletion share/server/core/classes/ViewMapAddModify.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,24 @@ private function handleAddModify()
$perm_user = get_checkbox('perm_user');
$show_dialog = false;

// Only block when an HTML field (e.g. textbox "text") is actually
// changed, so regular map editing works without editHtml (CVE-2024-47090).
global $AUTHORISATION;
if (!$AUTHORISATION->isPermitted('Map', 'editHtml', '*')) {
throw new NagVisException(l('Cannot edit HTML. Please contact your administrator'));
$attrDefs = $this->MAPCFG->getValidObjectType($this->object_type);
foreach ($this->attrs as $key => $val) {
if (!isset($attrDefs[$key]['field_type']) || $attrDefs[$key]['field_type'] !== 'textarea') {
continue;
}

$current = ($this->object_id !== null && $this->MAPCFG->objExists($this->object_id))
? $this->MAPCFG->getValue($this->object_id, $key, true)
: null;

if ($val !== $current) {
throw new NagVisException(l('Cannot edit HTML. Please contact your administrator'));
}
}
}

// Modification/Creation?
Expand Down
5 changes: 4 additions & 1 deletion share/server/core/functions/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,10 @@ function textarea($name, $default = '', $class = '', $style = '')

global $AUTHORISATION;
if (!$AUTHORISATION->isPermitted('Map', 'editHtml', '*')) {
echo '<b>Cannot edit HTML. Please contact your administrator.</b>';
// No editHtml permission (CVE-2024-47090): hide the editor but keep the
// current value so the object can still be saved/moved unchanged.
hidden($name, $default);
echo '<b>' . l('Cannot edit HTML. Please contact your administrator') . '</b>';
return;
}
// plain <textarea>
Expand Down
Loading