Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion apps/dav/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getCapabilities() {
'search-files',
],
'propfind' => [
'depth_infinity' => $this->config->getSystemValue('dav.propfind.depth_infinity', true),
'depth_infinity' => $this->config->getSystemValue('dav.propfind.depth_infinity', false),
]
]
];
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/ServerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function createServer(
$server->on('beforeMethod:PROPFIND', function (Request $request) use ($config) {
$depthHeader = strtolower($request->getHeader('depth'));

if ($depthHeader === 'infinity' && !$config->getSystemValue('dav.propfind.depth_infinity', true)) {
if ($depthHeader === 'infinity' && !$config->getSystemValue('dav.propfind.depth_infinity', false)) {
throw new PreconditionFailed('Depth infinity not supported');
}
}, 0);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public function __construct(IRequest $request, $baseUri) {
$this->server->on('beforeMethod:PROPFIND', function (Request $request) use ($config) {
$depthHeader = strtolower($request->getHeader('depth'));

if ($depthHeader === 'infinity' && !$config->getSystemValue('dav.propfind.depth_infinity', true)) {
if ($depthHeader === 'infinity' && !$config->getSystemValue('dav.propfind.depth_infinity', false)) {
throw new Exception\PreconditionFailed('Depth infinity not supported');
}
}, 0);
Expand Down
7 changes: 7 additions & 0 deletions changelog/unreleased/40016
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: default for propfind depth infinity adjusted

Fixed potential cause for performance issues under certain conditions
with infinite propfind being enabled by default.

https://github.com/owncloud/core/pull/40016
https://github.com/owncloud/enterprise/issues/5154
7 changes: 4 additions & 3 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -1717,11 +1717,12 @@
/**
* Allow propfind depth infinity
*
* With this setting that defaults to true, propfind requests will now be streamed to reduce memory usage
* with large responses. It tells the clients whether `depth=infinity` is allowed for propfind requests.
* It tells the clients whether `depth=infinity` is allowed for propfind requests.
* Streamed infinite depth propfind requests can reduce memory usage
* with large responses.
* For details see: https://datatracker.ietf.org/doc/html/rfc4918#section-10.2
*/
'dav.propfind.depth_infinity' => true,
'dav.propfind.depth_infinity' => false,

/**
* Show the grace period popup
Expand Down
16 changes: 10 additions & 6 deletions tests/acceptance/features/apiWebdavOperations/listFiles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Feature: list files

Scenario Outline: Get the list of resources in the root folder with depth infinity
Given using <dav_version> DAV path
And the administrator has set depth_infinity_allowed to 1
When user "Alice" lists the resources in "/" with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
Expand Down Expand Up @@ -157,6 +158,7 @@ Feature: list files

Scenario Outline: Get the list of resources in a folder with depth infinity
Given using <dav_version> DAV path
And the administrator has set depth_infinity_allowed to 1
When user "Alice" lists the resources in "/simple-folder" with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
Expand Down Expand Up @@ -256,6 +258,7 @@ Feature: list files

Scenario Outline: Get the list of resources in a folder shared through public link with depth infinity
Given using <dav_version> DAV path
And the administrator has set depth_infinity_allowed to 1
And user "Alice" has created the following folders
| path |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
Expand Down Expand Up @@ -291,14 +294,14 @@ Feature: list files
| spaces |


Scenario Outline: Get the list of files in a folder in the trashbin with depth 0
Scenario Outline: Get the list of files in the trashbin with depth 0
Given using <dav_version> DAV path
And user "Alice" has deleted the following resources
| path |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
When user "Alice" lists the resources in the trashbin path "/" with depth "0" using the WebDAV API
When user "Alice" lists the resources in the trashbin with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should not contain these nodes
| name |
Expand All @@ -322,14 +325,14 @@ Feature: list files
| spaces |


Scenario Outline: Get the list of files in a folder in the trashbin with depth 1
Scenario Outline: Get the list of files in the trashbin with depth 1
Given using <dav_version> DAV path
And user "Alice" has deleted the following resources
| path |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
When user "Alice" lists the resources in the trashbin path "/" with depth "1" using the WebDAV API
When user "Alice" lists the resources in the trashbin with depth "1" using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should contain these nodes
| name |
Expand All @@ -355,14 +358,15 @@ Feature: list files
| spaces |


Scenario Outline: Get the list of files in a folder in the trashbin with depth infinity
Scenario Outline: Get the list of files in the trashbin with depth infinity
Given using <dav_version> DAV path
And the administrator has set depth_infinity_allowed to 1
And user "Alice" has deleted the following resources
| path |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
When user "Alice" lists the resources in the trashbin path "/" with depth "infinity" using the WebDAV API
When user "Alice" lists the resources in the trashbin with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should contain these nodes
| name |
Expand Down
4 changes: 3 additions & 1 deletion tests/acceptance/features/bootstrap/CommentsContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ public function followingPropertiesShouldBeListed(string $user, TableNode $expec
$responseXmlObject = $this->featureContext->getResponseXmlObject();
$responses = $responseXmlObject->xpath("//d:response");
$found = false;
$savedResponseXml = "UNKNOWN";
foreach ($responses as $response) {
foreach ($expectedProperties as $expectedProperty) {
$expectedProperty['propertyValue'] = $this->featureContext->substituteInLineCodes(
Expand All @@ -548,8 +549,9 @@ public function followingPropertiesShouldBeListed(string $user, TableNode $expec
if ($found) {
break;
}
$savedResponseXml = $response->asXML();
}
Assert::assertTrue($found, "Could not find expected properties in" . $response->asXML());
Assert::assertTrue($found, "Could not find expected properties in response " . $savedResponseXml);
}

/**
Expand Down
12 changes: 9 additions & 3 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1040,16 +1040,22 @@ public function theAdministratorHasSetTheDefaultFolderForReceivedSharesTo(string
/**
* @When the administrator has set depth_infinity_allowed to :depth_infinity_allowed
*
* @param int $depth_infinity_allowed
* @param int $depthInfinityAllowed
*
* @return void
* @throws Exception
*/
public function theAdministratorHasSetDepthInfinityAllowedTo($depth_infinity_allowed) {
public function theAdministratorHasSetDepthInfinityAllowedTo($depthInfinityAllowed) {
$depthInfinityAllowedString = (string) $depthInfinityAllowed;
$this->addSystemConfigKeyUsingTheOccCommand(
"dav.propfind.depth_infinity",
(string) $depth_infinity_allowed
$depthInfinityAllowedString
);
if ($depthInfinityAllowedString === "0") {
$this->featureContext->davPropfindDepthInfinityDisabled();
} else {
$this->featureContext->davPropfindDepthInfinityEnabled();
}
}

/**
Expand Down
Loading