Fix prevent edit by external users - reported by VulnCheck

This commit is contained in:
Laurent Destailleur 2026-08-16 06:29:55 +02:00
parent 2c74444b1d
commit fc1d868fc6

View file

@ -2432,6 +2432,10 @@ class Thirdparties extends DolibarrApi
throw new RestException(403);
}
if (!DolibarrApi::_checkAccessToResource('societe', $id)) {
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$sql = "SELECT rowid, fk_user_creat, date_creation FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".((int) $id)." AND site = '".$this->db->escape($site)."'";
$result = $this->db->query($sql);
@ -2530,6 +2534,10 @@ class Thirdparties extends DolibarrApi
throw new RestException(403);
}
if (!DolibarrApi::_checkAccessToResource('societe', $id)) {
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".((int) $id)." AND site = '".$this->db->escape($site)."'";
$result = $this->db->query($sql);
@ -2594,6 +2602,10 @@ class Thirdparties extends DolibarrApi
throw new RestException(403);
}
if (!DolibarrApi::_checkAccessToResource('societe', $id)) {
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
$sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_account WHERE fk_soc = ".((int) $id)." AND site = '".$this->db->escape($site)."'";
$result = $this->db->query($sql);