Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/private/AppFramework/Middleware/Security/CSPMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ public function afterController($controller, $methodName, Response $response): R
$defaultPolicy->useJsNonce($this->csrfTokenManager->getToken()->getEncryptedValue());
}

// Loosen security presets in debug mode to enable development
// tools functionality
$debugging = \OC::$server->getConfig()->getSystemValue('debug', false);
Copy link
Member

@skjnldsv skjnldsv Feb 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use dependency injection in the construct :)
\OC::$server->getConfig() is deprecated

if ($debugging) {
// Allow vue dev tool to work on Firefox.
$defaultPolicy->allowEvalScript(true);
// Unblock HMR requests.
$defaultPolicy->addAllowedConnectDomain('*');
$defaultPolicy->addAllowedScriptDomain('*');
}

$response->setContentSecurityPolicy($defaultPolicy);

return $response;
Expand Down