Skip to content

Commit

Permalink
fix(middleware): Fix header injection for bruteforce middleware
Browse files Browse the repository at this point in the history
Calling setHeaders(getHeaders()) breaks the CSP nonce for unknown reasons
So shifting back to old standard practise for now

Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Aug 22, 2023
1 parent e42d82f commit 381c350
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,7 @@ public function afterController($controller, $methodName, Response $response) {
}

if ($this->delaySlept) {
$headers = $response->getHeaders();
if (!isset($headers['X-Nextcloud-Bruteforce-Throttled'])) {
$headers['X-Nextcloud-Bruteforce-Throttled'] = $this->delaySlept . 'ms';
$response->setHeaders($headers);
}
$response->addHeader('X-Nextcloud-Bruteforce-Throttled', $this->delaySlept . 'ms');
}

return parent::afterController($controller, $methodName, $response);
Expand Down

0 comments on commit 381c350

Please sign in to comment.