Skip to content

Commit

Permalink
Merge pull request #51184 from nextcloud/backport/51173/master
Browse files Browse the repository at this point in the history
[master] Fix A+ rating when checking with Nextcloud Security Scan.
  • Loading branch information
AndyScherzinger authored Mar 2, 2025
2 parents 0717412 + e1e0b68 commit 933c36d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,13 +363,6 @@ private static function printUpgradePage(\OC\SystemConfig $systemConfig): void {
public static function initSession(): void {
$request = Server::get(IRequest::class);

// Do not initialize sessions for 'status.php' requests
// Monitoring endpoints can quickly flood session handlers
// and 'status.php' doesn't require sessions anyway
if (str_ends_with($request->getScriptName(), '/status.php')) {
return;
}

// TODO: Temporary disabled again to solve issues with CalDAV/CardDAV clients like DAVx5 that use cookies
// TODO: See https://github.com/nextcloud/server/issues/37277#issuecomment-1476366147 and the other comments
// TODO: for further information.
Expand All @@ -388,6 +381,13 @@ public static function initSession(): void {
// prevents javascript from accessing php session cookies
ini_set('session.cookie_httponly', 'true');

// Do not initialize sessions for 'status.php' requests
// Monitoring endpoints can quickly flood session handlers
// and 'status.php' doesn't require sessions anyway
if (str_ends_with($request->getScriptName(), '/status.php')) {
return;
}

// set the cookie path to the Nextcloud directory
$cookie_path = OC::$WEBROOT ? : '/';
ini_set('session.cookie_path', $cookie_path);
Expand Down

0 comments on commit 933c36d

Please sign in to comment.