Byte order is the order in which search engines sort keyword values,
e.g. an OpenSearch terms aggregation ordered by key. With the same
order, the search can return just the first tags of every space, and
merging those lists still gives exactly the first tags overall. A
case-insensitive order would need an aggregation on a lowercased copy
of the field, with a mapping change, a reindex and the loss of the
original casing.
Assisted-by: Claude Code:claude-opus-5-5
GetTags collected the tags of all search results into a tags.Tags
object, which is meant for the tags of a single resource: it stops
accepting tags at 100 and puts new tags in front. So when more than 100
distinct tags were in use, the response held an arbitrary 100 of them,
and the order changed with the order of the search results.
Collect the distinct tags, sort them case-insensitively (ties in byte
order), and cut the list at the documented constant maxListedTags (100).
An empty list is still rendered as "value": [].
Fixes#3889
Assisted-by: Claude Code:claude-opus-5-5
Tags could be of any length. Assigning tags through the graph API now
rejects the whole request with 400 if one of the tags is longer than the
maximum, listing the tags that are too long. The length is counted in
characters, after the whitespace around each tag is removed. Tags that
already exist are not affected.
The maximum is 100 characters by default, and can be changed with
OC_MAX_TAG_LENGTH, or turned off with 0. The frontend service announces
it to clients as the graph.tags.max_tag_length capability, so that they
can check tags before sending them. Both services read the same
variable, without a service-specific alias, so that the announced limit
is always the one graph enforces.
Assisted-by: Claude Code:claude-opus-5-5
We now have two global opt-out switches that stop users from creating
new shares while everything that already exists keeps working:
OC_DISABLE_NEW_USER_SHARES rejects new user, group and federated shares
in graph and reva. Adding members to a space is still possible: graph
skips space roots, based on the stat result, like reva does.
OC_DISABLE_NEW_PUBLIC_LINKS rejects new public links and turning an
internal link into a public link in reva.
The frontend, graph, sharing and ocm services read them. Both default
to false.
We bump reva to 37496dc6abd3, which contains
https://github.com/opencloud-eu/reva/pull/1022
Ported from `owncloud/ocis#12542`, with the flags inverted.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Spaces and received shares can be marked as favorites, but the graph
API did not report it, so the web app could not show them.
drive.root and the sharedWithMe driveItems now carry
@libre.graph.me.following. The space root info only holds the requested
quota metadata, so the per-user flag is also read from the favorites
list the storage driver adds to the opaque.
Fixes#2511
For received shares, remoteItem.parentReference.driveId held the id of
the root item of the drive (<storage>$<space>!<root>) instead of the id
of the drive (<storage>$<space>), unlike all other drive items. Clients
had to cut off the root part themselves to request /drives/{drive-id}.
Use the drive id for user and OCM shares, and expect it in the
acceptance tests of the shared with me listing.
Fixes#3997
Assisted-by: Claude Code:claude-opus-5-5
A space image can be assigned with a PATCH of the drive on the v1beta1
route as well, and the size limit applies there the same way. Say so in
the README, and cover the refusal of a too large image on that route in
the tests.
Assisted-by: Claude Code:claude-opus-5-5
Under /graph/v1beta1, drives could only be listed. Getting, creating,
updating and deleting a single drive was only possible under v1.0,
which returns the permissions of a drive's root with the old role names
instead of the IDs of the unified roles.
Add GET, PATCH and DELETE on /graph/v1beta1/drives/{driveID}, and POST
on /graph/v1beta1/drives. They take the same requests as their v1.0
counterparts. GET, POST and PATCH return the drive in the v1beta1
format, like the v1beta1 list of drives does: with
$expand=root($expand=permissions), the permissions carry the unified
role IDs and grantedToV2. DELETE behaves the same in both versions.
The handlers for getting, creating and updating a drive now take the
API version as a parameter, and the v1.0 and v1beta1 routes call them
with their own version.
The acceptance test helpers for spaces can now use either version of
the Graph API.
Assisted-by: Claude Code:claude-opus-5-5
The variable that sets a lower size limit for space images alone was
named after the service, GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE,
which reads like a limit for thumbnails in general. Rename it to
OC_SPACE_IMAGE_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, and the yaml key
from thumbnails.max_input_image_file_size to
thumbnails.space_image_max_input_image_file_size.
The shared names OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and
THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE are unchanged. Neither renamed
setting has been released yet.
Assisted-by: Claude Code:claude-opus-5-5
A request to export the personal data beyond the rate limit got the
plain text 429 of httprate, while the other errors of graph, also those
of the same route, are JSON with an error code.
RateLimitPerAuthenticatedUser takes a handler for the response beyond
the limit now, so that a service can answer in its own format; nil
keeps the plain text 429. Graph answers with activityLimitReached. The
Retry-After header is set before the handler is called, so it stays.
Assisted-by: Claude Code:claude-opus-5-5
Each personal data export collects all events of the user and writes
them into the user's personal space, so starting exports over and over
puts load on the system. Limit how many exports a user can start to 5
per minute, configurable with GRAPH_EXPORT_PERSONAL_DATA_RATE_LIMIT
(0 disables the limit). Requests beyond it get a 429 with a
Retry-After header.
The limit uses a new middleware, RateLimitPerAuthenticatedUser. It
counts requests by the id of the authenticated user rather than by the
URL, so that variations of the URL, such as a trailing slash, can't get
around it. It comes after the check that users only export their own
data, so that requests for other users don't count against any limit.
The counters are kept in memory by every instance of the graph service.
This adds the dependency github.com/go-chi/httprate v0.16.1 (MIT), from
the authors of the chi router that the service already uses. It is used
instead of a limiter of our own, because counting requests in sliding
time windows correctly under concurrency is easy to get wrong, and the
library is maintained and tested for exactly that. It brings no further
modules: the two it needs are already required. There are no known
vulnerabilities in it, and govulncheck reports none.
Assisted-by: Claude Code:claude-opus-5-5
Check that a user exports only their own personal data in a new
middleware, RequireOwnUserID, so that the check can run before other
middlewares on the route, such as a rate limit. The route passes the
name of its user id parameter to it.
The handler keeps its own check as well, as a safety net: exporting the
data of one user to another must never happen, also when the route is
changed by mistake. When that check catches a request, it logs an error,
since the middleware must be missing.
Both unescape the user id from the path, like the other handlers of the
users endpoint do, and reject an empty one. The middleware answers 401
when there is no authenticated user. Requests for other users still get
a 400, now with a JSON error body instead of a plain text one.
Assisted-by: Claude Code:claude-opus-5-5
Creating a link on the root of the Shares drive was only caught later
by the permission check, and an internal link with the internal role
was not rejected at all. We now answer with a 400 "cannot create link
on shares space root" before even looking at the request body, just
like we do for the personal space root.
The acceptance scenarios now expect the new message for the Shares
drive, and the internal link scenario covers the Shares drive again.
ported from `owncloud/ocis#11543`
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
When the public share manager cannot access its metadata space, e.g.
after an upgrade, listing public shares fails with an already exists
error and the whole permissions request ended in a 500. The space
members dialog in web then just keeps spinning.
We now log a warning, skip the link permissions and still return the
user and space permissions.
Our reva currently replaces the original error with a generic "error
listing public shares", so this only takes effect together with the
port of `owncloud/reva#264`, which passes the error message through.
ported from `owncloud/ocis#11245`
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
A space image is only ever shown as a thumbnail. When a file larger
than the thumbnail generator accepts was set as the image of a space,
the PATCH of the drive succeeded, but no thumbnail could be made of the
file, so the space showed no image and nobody got an error.
Before setting the image, graph now looks up the size of the file, and
refuses a file above the limit with 413 Request Entity Too Large,
without changing the space. The limit is the one of the thumbnail
generator: graph reads it under the same names as the webdav and
thumbnails services (OC_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE and the
older THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE, 50MB by default, empty for
unlimited), so one setting keeps the three in agreement.
GRAPH_THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE sets a lower limit for space
images alone.
The default of 50MB is now one constant, which the graph, webdav and
thumbnails services all use.
Only the file size is checked: the dimension limits of the generator
would need the whole image to be read. The space readme has no limit,
and an empty image id is passed on unchecked, as before.
Assisted-by: Claude Code:claude-opus-5-5
Three follow-ups to the idempotent tag unassignment:
- A request whose tags are all empty, e.g. [""] or [","], is rejected
with 400 again. The tags are now split and cleaned up the same way as
the stored ones before checking that there are any.
- The TagsRemoved event lists only the tags that were actually removed,
and is empty when the resource had none of them. It is still sent in
that case, so that search reads the resource again. Search, the only
consumer, uses only the reference of the event.
- A locked resource is answered with 423, like assigning tags does,
instead of 500.
Assisted-by: Claude Code:claude-opus-5-5
Without $expand=memberOf, GET /me built the user from the CS3 user of
the request context. That user doesn't know the identities the user
signed in with, so identities[].issuerAssignedId contained the internal
user ID instead of the subject assigned by the identity provider, which
the identity backend stores when the user is provisioned. Only requests
with $expand=memberOf read the user from the identity backend and
returned the correct value.
GET /me now always reads the user from the identity backend. The group
memberships are still only looked up when $expand=memberOf asks for
them, so a plain /me costs one more user lookup in the identity
backend.
This changes the response of a plain GET /me in two cases:
- users for whom the identity backend has no stored identity, e.g.
users created through the API rather than signed in through an
identity provider, get no identities at all, instead of one that
wrongly carried the internal user ID
- when the identity backend doesn't know the user, /me answers with its
error (e.g. 404 instead of 200 with a model built from the request
context)
A failing identity backend is now logged at error level, a user it
doesn't know at debug level.
PERFORMANCE: every plain GET /me now runs one search in the identity
backend (LDAP), where it used to need none.
Assisted-by: Claude Code:claude-opus-5-5
Log the error text with every permission failure, at debug and error
level, and the texts of both errors when a fallback returns a different
error than the first attempt.
Log gateway selection failures in the share helpers at error level with
the request id and, where available, the permission id, so they can be
matched with the entry of the calling operation.
Use constants for the log keys, the recipient types and the tracer name,
log the space type of unsupported spaces and the user id of the shared
by me listing, and log an unknown permission type when deleting.
Assisted-by: Claude Code:claude-opus-5-5