FIX Contact documents were readable by any external user (#39516)
dol_check_secure_access_document() built its protection query against a table
named socpepople, which does not exist. The query therefore always failed, so
document.php and viewimage.php never iterated its result and never lowered
$accessallowed back to 0.
Any external user having the permission to read contacts could consequently
download the documents of any contact, including the contacts of other third
parties.
Note that this also restores the intended behaviour for the contacts having no
third party: an external user no longer has access to their documents, since
the query returns a NULL fk_soc that cannot match their own.
The typo was introduced in 0dd9e6acc2 on 2026-07-20, so only develop and the
24.0 branch are affected, no released version is.
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
parent
750145e663
commit
f20581cf86
1 changed files with 1 additions and 1 deletions
|
|
@ -3445,7 +3445,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity,
|
|||
$accessallowed = 1;
|
||||
}
|
||||
$original_file = $conf->societe->multidir_output[$entity].'/contact/'.$original_file;
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."socpepople WHERE rowid = ".((int) $refname)." AND entity IN (".getEntity('contact').")";
|
||||
$sqlprotectagainstexternals = "SELECT fk_soc FROM ".MAIN_DB_PREFIX."socpeople WHERE rowid = ".((int) $refname)." AND entity IN (".getEntity('contact').")";
|
||||
} elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->invoice->multidir_output[$entity])) {
|
||||
// Wrapping for invoices
|
||||
if ($fuser->hasRight('facture', $lire) || preg_match('/^specimen/i', $original_file)) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue