CSRF chek is not done on GET methods as this breaks way to have links to a direct page.
This commit is contained in:
parent
17a1ae5c3c
commit
ee3cae8c38
@ -111,8 +111,9 @@ analyse_sql_and_script($_GET);
|
|||||||
analyse_sql_and_script($_POST);
|
analyse_sql_and_script($_POST);
|
||||||
|
|
||||||
// Security: CSRF protection
|
// Security: CSRF protection
|
||||||
// The test to do is to check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST']).
|
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
|
||||||
if (! defined('NOCSRFCHECK') && ! empty($_SERVER['HTTP_HOST']) && ! empty($_SERVER['HTTP_REFERER']) && ! preg_match('/'.preg_quote($_SERVER['HTTP_HOST'],'/').'/i', $_SERVER['HTTP_REFERER']))
|
// when we post forms (we allow GET to allow direct link to access a particular page).
|
||||||
|
if (! defined('NOCSRFCHECK') && $_SERVER['REQUEST_METHOD'] != 'GET' && ! empty($_SERVER['HTTP_HOST']) && ! empty($_SERVER['HTTP_REFERER']) && ! preg_match('/'.preg_quote($_SERVER['HTTP_HOST'],'/').'/i', $_SERVER['HTTP_REFERER']))
|
||||||
{
|
{
|
||||||
//print 'HTTP_POST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
|
//print 'HTTP_POST='.$_SERVER['HTTP_HOST'].' HTTP_REFERER='.$_SERVER['HTTP_REFERER'];
|
||||||
print 'Access refused by CSRF protection in main.inc.php.';
|
print 'Access refused by CSRF protection in main.inc.php.';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user