diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-30 20:03:41 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-05-30 20:18:19 +0200 |
commit | a52d2066841e43ea0f0cb5072788afdc0217872e (patch) | |
tree | a7f7d07e730481e4d62a0c87bb2d994c4aa4043f /lib/private | |
parent | 2dd49206c74eaa8e9149b117775f4747483ba5bd (diff) | |
download | nextcloud-server-a52d2066841e43ea0f0cb5072788afdc0217872e.tar.gz nextcloud-server-a52d2066841e43ea0f0cb5072788afdc0217872e.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/private')
-rw-r--r-- | lib/private/Log.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php index 69705c49e87..4170acbb69a 100644 --- a/lib/private/Log.php +++ b/lib/private/Log.php @@ -233,8 +233,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; } } |