The legacy FCKeditor file manager connector (config.inc.php, also included by browser/default/browser.php and connectors/php/connector.php) only called main.inc.php and never checked any module right on 21.0 and 22.0, so any authenticated user, even one with no permission, could reach the connector, browse the medias directory and upload files. The permission check already present on 23.0 and develop was never backported. This adds the same guard so a non-admin without website write right is refused. Reported by Abderrahmane Aksoum. Signed-off-by: Dolicraft <contact@dolicraft.com> Co-authored-by: Dolicraft <contact@dolicraft.com>
This commit is contained in:
parent
61899bb8cd
commit
ef6631e9bd
1 changed files with 8 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ require_once '../../../../main.inc.php';
|
|||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var User $user
|
||||
*
|
||||
* @var string $dolibarr_main_data_root
|
||||
* @var string $dolibarr_main_url_root
|
||||
|
|
@ -49,6 +50,13 @@ if ($pos == '/') {
|
|||
//define('DOL_URL_ROOT', $pos);
|
||||
$entity = ((!empty($_SESSION['dol_entity']) && $_SESSION['dol_entity'] > 1) ? $_SESSION['dol_entity'] : null);
|
||||
|
||||
// This connector browses and writes into the medias directory, so it must be
|
||||
// restricted the same way as on the newer branches. Without this check any
|
||||
// authenticated user (even with no module right) could reach the file manager.
|
||||
if (empty($user->admin) && !$user->hasRight('website', 'write')) {
|
||||
accessforbidden('Need to be admin or having write permission on website module');
|
||||
}
|
||||
|
||||
// SECURITY: You must explicitly enable this "connector". (Set it to "true").
|
||||
// WARNING: don't just set "$Config['Enabled'] = true ;", you must be sure that only
|
||||
// authenticated users can access this file or use some kind of session checking.
|
||||
|
|
|
|||
Loading…
Reference in a new issue