Repository navigation
Description
GET …/permissions (drive items and space roots) ignores $select, $filter and $count when the request also has $top, unless it is exactly $top=0 together with $count=true. The request then succeeds with status 200 and returns the full, unfiltered listing, as if no query options had been sent.
The web client sends $top=0 with every permissions request (listPermissions in packages/web-client/src/graph/permissions/permissions.ts passes options?.top || 0), so its $select and $filter requests are affected:
- The external share roles (OCM enabled) are requested with the federated roles
$filter. The filter is dropped, so the server returns the roles for internal users instead of the roles for federated users. - The allowed actions of each space are requested with
[email protected]. The selection is dropped, so every call lists all shares and public links of the space, although only the actions are used.
Steps to reproduce
- As user A, share a folder with user B (role Viewer).
- As user A:
GET /graph/v1beta1/drives/{driveId}/items/{itemId}/[email protected]/rolePermissions/any(p:contains(p/condition, '@Subject.UserType=="Federated"'))&[email protected] - The same request with
&$top=0added, as the web client sends it.
Expected
Both responses contain only @libre.graph.permissions.roles.allowedValues, with the roles for federated users ("Can view", "Can edit"). Alternatively, the second request fails with 400, if $top without $count=true is not supported.
Actual
The first response is as expected. The second response (status 200) also contains @libre.graph.permissions.actions.allowedValues and value with all permissions of the folder, and its roles are the ones for internal users: "Can view", "Can upload", "Can edit".
The same happens with [email protected]&$top=0 on /drives/{driveId}/root/permissions: the response also contains the roles, and the share lookups run, although only the actions were selected.
Where
getListPermissionsQueryOptions in services/graph/pkg/service/v0/api_driveitem_permissions.go: for $top other than 0, and for $top=0 without $count=true, it returns ListPermissionsQueryOptions{} together with err. At that point err is always nil (it is the already checked result of odata.GetSelectValues). So the handler gets empty options and no error.
Returning a 400 there would break the web client, which always sends $top=0. Either the server keeps the other options for $top=0, or the web client stops sending $top when it doesn't count.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity