Add a protection for bad syntax of api key
This commit is contained in:
parent
dc80e6b029
commit
657d964899
@ -106,6 +106,9 @@ class DolibarrApiAccess implements iAuthenticate
|
|||||||
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
if (isset($_SERVER['HTTP_DOLAPIKEY'])) { // Param DOLAPIKEY in header can be read with HTTP_DOLAPIKEY
|
||||||
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
$api_key = $_SERVER['HTTP_DOLAPIKEY']; // With header method (recommanded)
|
||||||
}
|
}
|
||||||
|
if (preg_match('/^dolcrypt:/i', $api_key)) {
|
||||||
|
throw new RestException(503, 'Bad value for the API key. An API key should not start with dolcrypt:');
|
||||||
|
}
|
||||||
|
|
||||||
if ($api_key) {
|
if ($api_key) {
|
||||||
$userentity = 0;
|
$userentity = 0;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user