Skip to content

Commit bb716fb

Browse files
author
Daniel Neto
committed
fix: Correct variable name for playlist visibility checks and enhance permission handling in playlistsVideos endpoint
https://github.com/WWBN/AVideo/security/advisories/GHSA-75qq-68m8-pvfr#event-592247
1 parent 033e83a commit bb716fb

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

objects/playlist.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,16 +1198,16 @@ public static function canSee($playlist_id, $users_id)
11981198
{
11991199
global $playListCanSee;
12001200
$index = "$playlist_id, $users_id";
1201-
if (isset($playListCanSe[$index])) {
1202-
return $playListCanSe[$index];
1201+
if (isset($playListCanSee[$index])) {
1202+
return $playListCanSee[$index];
12031203
}
1204-
$playListCanSe[$index] = true;
1204+
$playListCanSee[$index] = true;
12051205
$obj = new PlayList($playlist_id);
12061206
$status = $obj->getStatus();
12071207
if ($status !== 'public' && $status !== 'unlisted' && $users_id !== $obj->getUsers_id()) {
1208-
$playListCanSe[$index] = false;
1208+
$playListCanSee[$index] = false;
12091209
}
1210-
return $playListCanSe[$index];
1210+
return $playListCanSee[$index];
12111211
}
12121212

12131213
public static function getEPG()

objects/playlistsVideos.json.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@
2525
die('Play List can not be empty');
2626
}
2727
require_once './playlist.php';
28-
$videos = PlayList::getVideosFromPlaylist($_REQUEST['playlists_id']);
28+
$_playlists_id = (int)$_REQUEST['playlists_id'];
29+
if (!PlayList::canSee($_playlists_id, User::getId())) {
30+
http_response_code(403);
31+
die(json_encode(['error' => 'You do not have permission to view this playlist']));
32+
}
33+
$videos = PlayList::getVideosFromPlaylist($_playlists_id);
2934
$objMob = AVideoPlugin::getObjectData("MobileManager");
3035
$index = 0;
3136
foreach ($videos as $key => $value) {
@@ -37,8 +42,8 @@
3742
$videos[$key]['imageClass'] = !empty($objMob->portraitImage) ? "portrait" : "landscape";
3843
$videos[$key]['VideoUrl'] = getVideosURL($videos[$key]['filename']);
3944
$videos[$key]['createdHumanTiming'] = humanTiming(strtotime($videos[$key]['created']));
40-
$videos[$key]['pageUrl'] = PlayLists::getLink($_REQUEST['playlists_id'], false, $index);
41-
$videos[$key]['embedUrl'] = PlayLists::getLink($_REQUEST['playlists_id'], true, $index);
45+
$videos[$key]['pageUrl'] = PlayLists::getLink($_playlists_id, false, $index);
46+
$videos[$key]['embedUrl'] = PlayLists::getLink($_playlists_id, true, $index);
4247
unset($_REQUEST['sort'], $_REQUEST['current'], $_REQUEST['searchPhrase']);
4348
$_REQUEST['rowCount'] = 10;
4449
$_REQUEST['sort']['created'] = "desc";

0 commit comments

Comments
 (0)