Skip to content
Snippets Groups Projects
Unverified Commit 2f87fb6b authored by Lukas Reschke's avatar Lukas Reschke
Browse files

Add Clear-Site-Data header

This adds a Clear-Site-Data header to the logout response which will delete all relevant data in the caches which may contain potentially sensitive content.

See https://w3c.github.io/webappsec-clear-site-data/#header for the definition of the types.

Ref https://twitter.com/mikewest/status/877149667909406723



Signed-off-by: default avatarLukas Reschke <lukas@statuscode.ch>
parent 60edf2f1
No related branches found
No related tags found
No related merge requests found
...@@ -107,7 +107,9 @@ class LoginController extends Controller { ...@@ -107,7 +107,9 @@ class LoginController extends Controller {
} }
$this->userSession->logout(); $this->userSession->logout();
return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm')); $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
$response->addHeader('Clear-Site-Data', '"cache", "cookies", "storage", "executionContexts"');
return $response;
} }
/** /**
......
...@@ -95,6 +95,7 @@ class LoginControllerTest extends TestCase { ...@@ -95,6 +95,7 @@ class LoginControllerTest extends TestCase {
->willReturn('/login'); ->willReturn('/login');
$expected = new RedirectResponse('/login'); $expected = new RedirectResponse('/login');
$expected->addHeader('Clear-Site-Data', '"cache", "cookies", "storage", "executionContexts"');
$this->assertEquals($expected, $this->loginController->logout()); $this->assertEquals($expected, $this->loginController->logout());
} }
...@@ -124,6 +125,7 @@ class LoginControllerTest extends TestCase { ...@@ -124,6 +125,7 @@ class LoginControllerTest extends TestCase {
->willReturn('/login'); ->willReturn('/login');
$expected = new RedirectResponse('/login'); $expected = new RedirectResponse('/login');
$expected->addHeader('Clear-Site-Data', '"cache", "cookies", "storage", "executionContexts"');
$this->assertEquals($expected, $this->loginController->logout()); $this->assertEquals($expected, $this->loginController->logout());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment