Skip to content

Commit

Permalink
Security: Agenda: Strictly filter event content
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelFQC committed Apr 12, 2024
1 parent 2b83d15 commit 42566a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions main/inc/lib/agenda.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ public function addEvent(
$attributes = [
'user' => api_get_user_id(),
'title' => $title,
'text' => $content,
'text' => Security::remove_XSS($content),
'date' => $start,
'enddate' => $end,
'all_day' => $allDay,
Expand Down Expand Up @@ -320,7 +320,7 @@ public function addEvent(
case 'course':
$attributes = [
'title' => $title,
'content' => $content,
'content' => Security::remove_XSS($content),
'start_date' => $start,
'end_date' => $end,
'all_day' => $allDay,
Expand Down Expand Up @@ -476,7 +476,7 @@ public function addEvent(
if (api_is_platform_admin()) {
$attributes = [
'title' => $title,
'content' => $content,
'content' => Security::remove_XSS($content),
'start_date' => $start,
'end_date' => $end,
'all_day' => $allDay,
Expand Down Expand Up @@ -1876,7 +1876,7 @@ public function get_event($id)
if (Database::num_rows($result)) {
$event = Database::fetch_array($result, 'ASSOC');
$event['description'] = $event['text'];
$event['content'] = $event['text'];
$event['content'] = Security::remove_XSS($event['text'], STUDENT);
$event['start_date'] = $event['date'];
$event['end_date'] = $event['enddate'];
}
Expand Down Expand Up @@ -1904,7 +1904,7 @@ public function get_event($id)
'agenda_event_invitation_id' => $event->getInvitation()->getId(),
'collective' => $event->isCollective(),
'description' => $event->getText(),
'content' => $event->getText(),
'content' => Security::remove_XSS($event->getText(), STUDENT),
'start_date' => $event->getDate()->format('Y-m-d H:i:s'),
'end_date' => $event->getEndDate()->format('Y-m-d H:i:s'),
];
Expand All @@ -1919,7 +1919,7 @@ public function get_event($id)
$result = Database::query($sql);
if (Database::num_rows($result)) {
$event = Database::fetch_array($result, 'ASSOC');
$event['description'] = $event['content'];
$event['description'] = Security::remove_XSS($event['content'], STUDENT);

// Getting send to array
$event['send_to'] = $this->getUsersAndGroupSubscribedToEvent(
Expand Down Expand Up @@ -1952,7 +1952,7 @@ public function get_event($id)
$result = Database::query($sql);
if (Database::num_rows($result)) {
$event = Database::fetch_array($result, 'ASSOC');
$event['description'] = $event['content'];
$event['description'] = Security::remove_XSS($event['content']);
}
break;
}
Expand Down

0 comments on commit 42566a0

Please sign in to comment.