summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-05-30 20:16:18 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2018-05-30 20:16:18 +0200
commit188a41a2befea4e34dcb3d1a7b9e4499e2312f7f (patch)
tree761b00afc7e9399af540df088cc08537a099c1fb /lib
parent4c1f88efb16564798efbce62153a7eebc174a640 (diff)
downloadnextcloud-server-188a41a2befea4e34dcb3d1a7b9e4499e2312f7f.tar.gz
nextcloud-server-188a41a2befea4e34dcb3d1a7b9e4499e2312f7f.zip
Make sure the log doesn't try to read from PUT if it can't
If a PUT request comes in that is not JSON or from encoded. Then we can only read it (exactly) once. If that is the case we must assume no shared secret is set. If we don't then we either are the first to read it, thus causing the real read of the data to fail. Or we are later and then it throws an exception (also failing the request). Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Log.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php
index bed0321bef3..418d388e380 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -293,8 +293,16 @@ class Log implements ILogger {
if(isset($logCondition['shared_secret'])) {
$request = \OC::$server->getRequest();
+ if ($request->getMethod() === 'PUT' &&
+ strpos($request->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false &&
+ strpos($request->getHeader('Content-Type'), 'application/json') === false) {
+ $logSecretRequest = '';
+ } else {
+ $logSecretRequest = $request->getParam('log_secret', '');
+ }
+
// if token is found in the request change set the log condition to satisfied
- if($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
+ if ($request && hash_equals($logCondition['shared_secret'], $logSecretRequest)) {
$this->logConditionSatisfied = true;
}
}