Skip to content

Commit 78bc0da

Browse files
committed
Security: Filter actions to avoid XSS in personal courses sorting - refs BT#22085
1 parent 814672b commit 78bc0da

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Diff for: main/auth/sort_my_courses.php

+13-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,19 @@
1212
$user_course_categories = CourseManager::get_user_course_categories(api_get_user_id());
1313
$courses_in_category = $auth->getCoursesInCategory(false);
1414

15-
$action = isset($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : '';
15+
// Only authorized actions
16+
$authorizedActions = [
17+
'edit_category',
18+
'edit_course_category',
19+
'deletecoursecategory',
20+
'createcoursecategory',
21+
'set_collapsable',
22+
'unsubscribe'
23+
];
24+
if (in_array(trim($_REQUEST['action']), $authorizedActions)) {
25+
$action = trim($_REQUEST['action']);
26+
}
27+
1628
$currentUrl = api_get_self();
1729

1830
$interbreadcrumb[] = [

0 commit comments

Comments
 (0)