Fix #GHSA-px39-mwcr-hvxp
This commit is contained in:
parent
3aff6cded3
commit
4bfda08f7f
3 changed files with 14 additions and 1 deletions
|
|
@ -989,7 +989,11 @@ print '<strong>MAIN_ALLOW_SVG_FILES_AS_EXTERNAL_LINKS</strong> = '.getDolGlobalS
|
|||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_ALLOW_OBFUSCATION_METHODS_IN_DOL_EVAL</strong> = '.getDolGlobalString('MAIN_ALLOW_OBFUSCATION_METHODS_IN_DOL_EVAL', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Recommended").": 0 - The value 1 allows the use of concatenation functions like . or dol_concat into extra fields conditions or formula but is not secured)</span><br>";
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Recommended").": ".$langs->trans("Undefined").' '.$langs->trans("or")." 0 - The value 1 allows the use of concatenation functions like . or dol_concat into extra fields conditions or formula but is not secured)</span><br>";
|
||||
print '<br>';
|
||||
|
||||
print '<strong>MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER</strong> = '.getDolGlobalString('MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER', '<span class="opacitymedium">'.$langs->trans("Undefined").'</span>');
|
||||
print ' <span class="opacitymedium">('.$langs->trans("Recommended").": 1 - The value 0 allows the use of subrequests into extrafields conditions. It remains not possible in API filters to avoid bind SQL injections whatever is this value)</span><br>";
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -118,6 +118,10 @@ require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
|
|||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
|
||||
// In API context, we force the protection to avoid forging of criteria including bind SQL injection
|
||||
$conf->global->MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER = 1;
|
||||
|
||||
|
||||
$url = $_SERVER['PHP_SELF'];
|
||||
if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
|
||||
$url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
|
||||
|
|
|
|||
|
|
@ -1350,6 +1350,11 @@ class Conf extends stdClass
|
|||
$this->global->MAIN_RESTRICTHTML_ONLY_VALID_HTML_TIDY = 1;
|
||||
}
|
||||
|
||||
if (!isset($this->global->MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER)) {
|
||||
// Note value is always forced to 1 in API context to avoid bind SQL injection into API filters.
|
||||
$this->global->MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER = 0; // TODO Move this into 1 by default
|
||||
}
|
||||
|
||||
// For backward compatibility
|
||||
if (!empty($this->global->LDAP_SYNCHRO_ACTIVE)) {
|
||||
if ($this->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue