Skip to content

Commit 15023ce

Browse files
committed
display: Sanitize attributes for anchor tag in Display::url function
Refs advisory GHSA-gw58-89f7-4xgj
1 parent 89d2026 commit 15023ce

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main/inc/lib/display.lib.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,9 +917,10 @@ public static function tag($tag, $content, $additional_attributes = [])
917917
$attribute_list = '';
918918
// Managing the additional attributes
919919
if (!empty($additional_attributes) && is_array($additional_attributes)) {
920-
$attribute_list = '';
921920
foreach ($additional_attributes as $key => &$value) {
922-
$attribute_list .= $key.'="'.$value.'" ';
921+
$sanitized_key = htmlspecialchars($key, ENT_QUOTES, api_get_system_encoding());
922+
$sanitized_value = htmlspecialchars($value, ENT_QUOTES, api_get_system_encoding());
923+
$attribute_list .= $sanitized_key.'="'.$sanitized_value.'" ';
923924
}
924925
}
925926
//some tags don't have this </XXX>

0 commit comments

Comments
 (0)