Skip to content

Commit daca4ff

Browse files
author
Daniel Neto
committed
fix: Restrict access to admin-only for AD_Server JSON endpoints
GHSA-j36m-74g2-7m95
1 parent 061f242 commit daca4ff

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

plugin/AD_Server/getData.json.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
header('Content-Type: application/json');
33

44
require_once '../../videos/configuration.php';
5+
6+
if (!User::isAdmin()) {
7+
forbiddenPage('You must be Admin');
8+
}
9+
510
allowOrigin();
611
$obj = new stdClass();
712
$obj->error = true;

plugin/AD_Server/reports.json.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
require_once '../../videos/configuration.php';
66

7+
if (!User::isAdmin()) {
8+
forbiddenPage(__('You cannot do this'));
9+
}
10+
711
// Fetch request parameters with safety checks
812
$startDate = !empty($_REQUEST['startDate']) ? $_REQUEST['startDate'] . ' 00:00:00' : null;
913
$endDate = !empty($_REQUEST['endDate']) ? $_REQUEST['endDate'] . ' 23:59:59' : null;

plugin/AD_Server/view/campaigns.json.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
require_once $global['systemRootPath'] . 'plugin/AD_Server/Objects/VastCampaigns.php';
44
header('Content-Type: application/json');
55

6+
if (!User::isAdmin()) {
7+
forbiddenPage('You must be Admin');
8+
}
9+
610
$rows = VastCampaigns::getAll();
711
?>
8-
{"data": <?php echo json_encode($rows); ?>}
12+
{"data": <?php echo json_encode($rows); ?>}

plugin/AD_Server/view/campaignsVideos.json.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
require_once $global['systemRootPath'] . 'plugin/AD_Server/Objects/VastCampaignsVideos.php';
44
header('Content-Type: application/json');
55

6+
if (!User::isAdmin()) {
7+
forbiddenPage('You must be Admin');
8+
}
9+
610
$rows = VastCampaignsVideos::getAllFromCampaign(intval(@$_POST['id']), true);
711
?>
8-
{"data": <?php echo json_encode($rows); ?>}
12+
{"data": <?php echo json_encode($rows); ?>}

0 commit comments

Comments
 (0)