Skip to content

Commit 845d598

Browse files
committed
TASK: Make sure cache is not used with cookies
1 parent c599187 commit 845d598

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Classes/Http/RequestInterceptorComponent.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use Neos\Flow\Http\Component\ComponentChain;
77
use Neos\Flow\Http\Component\ComponentContext;
88
use Neos\Flow\Http\Component\ComponentInterface;
9+
use Neos\Flow\Security\SessionDataContainer;
10+
use Neos\Flow\Session\SessionManagerInterface;
911
use function GuzzleHttp\Psr7\parse_response;
1012

1113
/**
@@ -25,6 +27,18 @@ class RequestInterceptorComponent implements ComponentInterface
2527
*/
2628
protected $enabled;
2729

30+
/**
31+
* @Flow\Inject(lazy=false)
32+
* @var SessionManagerInterface
33+
*/
34+
protected $sessionManager;
35+
36+
/**
37+
* @Flow\Inject
38+
* @var SessionDataContainer
39+
*/
40+
protected $sessionDataContainer;
41+
2842
/**
2943
* @inheritDoc
3044
*/
@@ -43,6 +57,10 @@ public function handle(ComponentContext $componentContext)
4357
return;
4458
}
4559

60+
if ($this->sessionManager->getCurrentSession()->isStarted() && !empty($this->sessionDataContainer->getSecurityTokens())) {
61+
return;
62+
}
63+
4664
$entryIdentifier = md5((string)$request->getUri());
4765

4866
$entry = $this->cacheFrontend->get($entryIdentifier);

Classes/Http/RequestStorageComponent.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ public function handle(ComponentContext $componentContext)
6060
return;
6161
}
6262

63+
if ($response->hasHeader('Set-Cookie')) {
64+
return;
65+
}
66+
6367
$entryIdentifier = md5((string)$request->getUri());
6468

6569
$lifetime = $this->contentCacheAspect->getShortestLifetime();

0 commit comments

Comments
 (0)