Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
7948b0e0
Commit
7948b0e0
authored
14 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Allow to disable CSRF permission
parent
d29968a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/main.inc.php
+0
-12
0 additions, 12 deletions
htdocs/main.inc.php
htdocs/master.inc.php
+15
-3
15 additions, 3 deletions
htdocs/master.inc.php
with
15 additions
and
15 deletions
htdocs/main.inc.php
+
0
−
12
View file @
7948b0e0
...
...
@@ -111,18 +111,6 @@ function analyse_sql_and_script(&$var)
analyse_sql_and_script
(
$_GET
);
analyse_sql_and_script
(
$_POST
);
// Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
// when we post forms (we allow GET to allow direct link to access a particular page).
// TODO If CSRF check fails on some setup with proxy rewriting, we need to move this part into master.inc.php after include of conf.php
if
(
!
defined
(
'NOCSRFCHECK'
)
&&
empty
(
$dolibarr_nocsrfcheck
)
&&
!
empty
(
$_SERVER
[
'REQUEST_METHOD'
])
&&
$_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
"Access refused by CSRF protection in main.inc.php
\n
"
;
//print "If you access your server behind a proxy using url rewriting, you might add the line \$dolibarr_nocsrfcheck=1 into your conf.php file.";
exit
;
}
// This is to make Dolibarr working with Plesk
set_include_path
(
$_SERVER
[
'DOCUMENT_ROOT'
]
.
'/htdocs'
);
...
...
This diff is collapsed.
Click to expand it.
htdocs/master.inc.php
+
15
−
3
View file @
7948b0e0
...
...
@@ -64,11 +64,23 @@ error_reporting(E_ALL ^ E_NOTICE);
// Include configuration
$result
=@
include_once
(
"conf/conf.php"
);
if
(
!
$result
&&
$_SERVER
[
"GATEWAY_INTERFACE"
])
// If install not done and we are in a web session
if
(
!
$result
&&
!
empty
(
$_SERVER
[
"GATEWAY_INTERFACE"
])
)
// If install not done and we are in a web session
{
header
(
"Location: install/index.php"
);
exit
;
header
(
"Location: install/index.php"
);
exit
;
}
// Security: CSRF protection
// This test check if referrer ($_SERVER['HTTP_REFERER']) is same web site than Dolibarr ($_SERVER['HTTP_HOST'])
// when we post forms (we allow GET to allow direct link to access a particular page).
if
(
!
defined
(
'NOCSRFCHECK'
)
&&
empty
(
$dolibarr_nocsrfcheck
)
&&
!
empty
(
$_SERVER
[
'REQUEST_METHOD'
])
&&
$_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
"Access refused by CSRF protection in main.inc.php
\n
"
;
print
"If you access your server behind a proxy using url rewriting, you might add the line
\$
dolibarr_nocsrfcheck=1 into your conf.php file."
;
exit
;
}
if
(
empty
(
$dolibarr_main_db_host
))
{
print
'Dolibarr setup was run but was not completed.<br>'
.
"
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment