Skip to content

Commit 953e679

Browse files
authored
Merge pull request #1020 from nextcloud/backport/1014/stable19
[stable19] Harden check when using token from memcache
2 parents 1572f7b + eb82bb0 commit 953e679

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

lib/Service/SessionService.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,14 @@ public function getSession($documentId, $sessionId, $token) {
152152

153153
$data = $this->cache->get($token);
154154
if ($data !== null) {
155-
return Session::fromRow(json_decode($data, true));
155+
$session = Session::fromRow(json_decode($data, true));
156+
if ($session->getId() !== $sessionId || $session->getDocumentId() !== $documentId) {
157+
$this->cache->remove($token);
158+
$this->session = false;
159+
return false;
160+
}
161+
162+
return $session;
156163
}
157164

158165
try {

0 commit comments

Comments
 (0)