From bab59deb717b107dbcb852748c3852a8377fcd4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn=20Friedrich=20Dreyer?= Date: Wed, 18 Nov 2026 13:08:45 +0100 Subject: [PATCH] test(acceptance): cover resources reachable via several share jail paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The desktop client syncs the share jail via the Windows Cloud Files API, which needs a 1:1 mapping between file id and path. Today a resource can show up in the jail under more than one path: - a share of /foo/bar next to a share of /foo becomes a second mountpoint, so foo/bar/baz.txt is also reachable as bar/baz.txt - a share from a project space the sharee is a member of shows up in the jail although the resource is already reachable via the space The new scenarios describe the behavior we want: the jail only lists subtrees the user cannot reach otherwise, permissions follow the effective grants on the node (Editor on bar allows writing foo/bar/baz.txt even though foo was shared as Viewer), and the graph sharedWithMe list keeps listing every share. Both scenarios fail today and are listed as expected failures. related: https://github.com/opencloud-eu/opencloud/issues/4055 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Jörn Friedrich Dreyer --- .../expected-failures-decomposed-storage.md | 5 + .../expected-failures-posix-storage.md | 5 + .../shareJailContainment.feature | 123 ++++++++++++++++++ 3 files changed, 133 insertions(+) create mode 100644 tests/acceptance/features/apiSharingNg1/shareJailContainment.feature diff --git a/tests/acceptance/expected-failures-decomposed-storage.md b/tests/acceptance/expected-failures-decomposed-storage.md index e0cbc0735f..b6bb863427 100644 --- a/tests/acceptance/expected-failures-decomposed-storage.md +++ b/tests/acceptance/expected-failures-decomposed-storage.md @@ -182,6 +182,11 @@ - [apiSharingNg1/propfindShares.feature:149](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/propfindShares.feature#L149) +#### [Share jail should not expose the same resource under several paths](https://github.com/opencloud-eu/opencloud/issues/4055) + +- [apiSharingNg1/shareJailContainment.feature:14](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature#L14) +- [apiSharingNg1/shareJailContainment.feature:80](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature#L80) + #### [Readiness check for some services returns 500 status code](https://github.com/owncloud/ocis/issues/10661) - [apiServiceAvailability/serviceAvailabilityCheck.feature:123](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L123) diff --git a/tests/acceptance/expected-failures-posix-storage.md b/tests/acceptance/expected-failures-posix-storage.md index f676394a93..8faed6161f 100644 --- a/tests/acceptance/expected-failures-posix-storage.md +++ b/tests/acceptance/expected-failures-posix-storage.md @@ -182,6 +182,11 @@ - [apiSharingNg1/propfindShares.feature:149](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/propfindShares.feature#L149) +#### [Share jail should not expose the same resource under several paths](https://github.com/opencloud-eu/opencloud/issues/4055) + +- [apiSharingNg1/shareJailContainment.feature:14](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature#L14) +- [apiSharingNg1/shareJailContainment.feature:80](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature#L80) + #### [Readiness check for some services returns 500 status code](https://github.com/owncloud/ocis/issues/10661) - [apiServiceAvailability/serviceAvailabilityCheck.feature:123](https://github.com/opencloud-eu/opencloud/blob/main/tests/acceptance/features/apiServiceAvailability/serviceAvailabilityCheck.feature#L123) diff --git a/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature b/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature new file mode 100644 index 0000000000..8ce56504b8 --- /dev/null +++ b/tests/acceptance/features/apiSharingNg1/shareJailContainment.feature @@ -0,0 +1,123 @@ +Feature: share jail only lists resources the sharee cannot reach otherwise + As a user syncing the share jail with a desktop client + I want every received resource to show up under exactly one path + So that a file id maps to a single path on disk + + Background: + Given these users have been created with default attributes: + | username | + | Alice | + | Brian | + And using spaces DAV path + + @issue-4055 + Scenario: a share nested inside another received share is not listed as its own mountpoint + Given group "grp1" has been created + And user "Brian" has been added to group "grp1" + And user "Alice" has created folder "foo" + And user "Alice" has created folder "foo/bar" + And user "Alice" has uploaded file with content "hello world" to "foo/bar/baz.txt" + And user "Alice" has sent the following resource share invitation: + | resource | foo | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | Viewer | + And user "Brian" has a share "foo" synced + And user "Alice" has sent the following resource share invitation: + | resource | foo/bar | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + And user "Brian" has a share "bar" synced + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": ["name"], + "properties": { + "name": { "const": "foo" } + } + }, + { + "type": "object", + "required": ["name"], + "properties": { + "name": { "const": "bar" } + } + } + ] + } + } + } + } + """ + And for user "Brian" the space "Shares" should contain these entries: + | foo | + And for user "Brian" the space "Shares" should not contain these entries: + | bar | + And for user "Brian" folder "foo/bar" of the space "Shares" should contain these files: + | baz.txt | + When user "Brian" uploads a file inside space "Shares" with content "edited by Brian" to "foo/bar/baz.txt" using the WebDAV API + Then the HTTP status code should be "204" + And for user "Brian" the content of the file "foo/bar/baz.txt" of the space "Shares" should be "edited by Brian" + + @issue-4055 + Scenario: a share from a project space the sharee is a member of is not listed in the share jail + Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + And user "Alice" has created a space "new-space" with the default quota using the Graph API + And user "Alice" has created a folder "folder" in space "new-space" + And user "Alice" has uploaded a file inside space "new-space" with content "hello world" to "folder/file.txt" + And user "Alice" has sent the following space share invitation: + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Space Viewer | + And user "Alice" has sent the following resource share invitation: + | resource | folder | + | space | new-space | + | sharee | Brian | + | shareType | user | + | permissionsRole | Editor | + And user "Brian" has a share "folder" synced + When user "Brian" lists the shares shared with him using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["name"], + "properties": { + "name": { "const": "folder" } + } + } + } + } + } + """ + And for user "Brian" folder "folder" of the space "new-space" should contain these files: + | file.txt | + And for user "Brian" the space "Shares" should not contain these entries: + | folder |