Commit Graph
1163 Commits
Author SHA1 Message Date
Pascal Bleser 8fe28aaae1 Merge pull request #3993 from pbleser-oc/fix/graph-space-image-limit-name
fix(graph): name the space image size limit after space images
2026-11-13 22:52:15 +01:00
Jörn Friedrich Dreyer 0cef1028c1 Merge pull request #3950 from pbleser-oc/fix/graph-idempotent-tag-unassign
fix(graph): succeed when unassigning tags a resource doesn't have
2026-11-13 20:37:35 +01:00
Jörn Friedrich Dreyer 8ba2c3c581 Merge pull request #3973 from pbleser-oc/feat/graph-export-personal-data-rate-limit
graph: rate limit the personal data export
2026-11-13 20:17:34 +01:00
Pascal Bleser dd93fd4d43 docs(graph): mention the v1beta1 route for space images
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
2026-11-13 19:15:45 +01:00
Pascal Bleser 67e210a541 feat(graph): add the v1beta1 endpoints for a single drive
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
2026-11-13 19:14:34 +01:00
Pascal Bleser ad140be6eb fix(graph): name the space image size limit after space images
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
2026-11-13 19:01:53 +01:00
Jörn Friedrich Dreyer 55b5e7db73 Merge pull request #3944 from opencloud-eu/backport-wp2-batch-e
fix(graph): port share permission and link fixes
2026-11-13 18:50:37 +01:00
Jörn Friedrich Dreyer c88d94ea2b Merge pull request #3986 from pbleser-oc/fix/graph-space-image-size
fix(graph): refuse space images too large for a thumbnail
2026-11-13 18:28:35 +01:00
Pascal Bleser 0169f3b0a5 graph: answer the export rate limit in the graph error format
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
2026-11-13 18:25:47 +01:00
Pascal Bleser a7789f8462 graph: rate limit the personal data export
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
2026-11-13 18:25:47 +01:00
Pascal Bleser b257a651ee graph: check the user id of exportPersonalData in a middleware
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
2026-11-13 18:25:17 +01:00
Jörn Friedrich Dreyer 8a56177b82 fix(graph): reject links on the shares space root
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>
2026-11-13 18:18:31 +01:00
Jörn Friedrich Dreyer 5cfb0fca1a fix(graph): list permissions when public shares are inaccessible
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>
2026-11-13 18:18:31 +01:00
Jörn Friedrich Dreyer 4bb1feef67 Merge pull request #3964 from opencloud-eu/backport-wp2-753
fix(graph): apply the role allowlist to permission updates
2026-11-13 18:13:41 +01:00
Michael Barz db7ffa7a40 Merge pull request #3899 from asaah262/feat/898-allow-setting-spaceid
feat(graph): allow client-supplied drive IDs when creating spaces
2026-11-13 16:27:29 +01:00
Pascal Bleser 51b92da2e5 fix(graph): refuse space images too large for a thumbnail
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
2026-11-13 15:55:12 +01:00
Sara Ahmadi 768cd264d7 feat(graph): reject drive ids that belong to existing users
Assisted-by: Claude Code:claude-opus-5-5
2026-11-13 13:22:24 +01:00
Pascal Bleser 2bb40b631b fix(graph): reject empty tags and report only removed tags on unassign
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
2026-11-12 23:28:45 +01:00
Pascal Bleser acb16b538a fix(graph): return the identities of the identity backend on /me
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
2026-11-12 18:04:58 +01:00
Sara Ahmadi 3999ed0de8 Merge pull request #3881 from asaah262/feat/895-improve-graph-logging-and-tracing
feat(graph): improve logging and tracing for drive item permissions
2026-11-12 15:36:53 +01:00
Sara Ahmadi f12a02b007 feat(graph): log error text and correlate gateway selection failures
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
2026-11-12 11:58:30 +01:00
Pascal Bleser c3c2a8b99c fix(graph): succeed when unassigning tags a resource doesn't have
Removing a tag that the resource doesn't have failed with 400 and a
message about assigning tags ("no new tags in createtagsrequest or
maximum reached"). The tags of the resource are then already as
requested, so it now succeeds instead, without writing the unchanged
tags back.

The TagsRemoved event is published in that case too, so that the search
index drops tags that it has but the resource doesn't, which could
otherwise only be removed by assigning them first.

A request without any tags is still rejected with 400, now before
looking up the resource.

The log entries of the request now carry the requested resource id and
the tags, and a failure to store the tags logs the status of the
storage. The log message for a failed TagsRemoved event no longer calls
it TagsAdded.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-12 10:24:20 +01:00
Jörn Friedrich Dreyer 04ac120dca fix(graph): apply the role allowlist to permission updates
Updating a permission or a space root permission did not check the
roles an administrator enabled with GRAPH_AVAILABLE_ROLES. An invite
with a disabled role was rejected, but the same role could be set by
updating an existing share. We now validate updates against the
allowlist, same as invites.

The three "without enabling it" scenarios now expect a 400. Their
removed lines are padded with blank lines so the line numbers of the
scenarios stay the same.

ported from `owncloud/ocis#12540`. The reva half
(`owncloud/reva#653`) is https://github.com/opencloud-eu/reva/pull/993

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-11 13:32:56 +01:00
Jörn Friedrich Dreyer 9c7ecc1755 Merge pull request #3946 from pbleser-oc/fix/graph-reject-empty-drive-name
fix(graph): reject empty and invisible drive names on update
2026-11-11 13:31:32 +01:00
Sara Ahmadi 84c784ae67 feat(graph): improve logging and tracing for drive item permissions 2026-11-11 12:19:00 +01:00
Sara Ahmadi cb3a906cb6 Merge pull request #3928 from asaah262/feat/899-get-single-sharing-permission
feat(graph): add GET endpoints for single sharing permissions
2026-11-11 12:14:42 +01:00
Jörn Friedrich Dreyer a2c24749a6 Merge branch 'main' into workpagages 2026-11-11 11:54:21 +01:00
Sara Ahmadi 64a1ac8339 feat(graph): add GET endpoints for single sharing permissions
Assisted-by: Claude Code:claude-opus-5-5
2026-11-10 18:18:01 +01:00
Pascal Bleser 0e265282d2 fix(graph): reject empty and invisible drive names on update
Updating a drive with an empty name ("name": "") succeeded and silently
kept the old name, because the name was only validated when it was
non-empty. Validate it whenever the request contains it, so an empty
name is rejected with 400 like on create. A request without a name, or
with "name": null, still leaves the name unchanged.

Space names were trimmed with strings.TrimSpace, which only removes
Unicode whitespace. Invisible formatting characters such as the
zero-width space (U+200B), the word joiner (U+2060) or the byte order
mark (U+FEFF) aren't whitespace, so a name made only of them was
accepted on create and on update, and showed up as an empty name in
every client. Trim these characters from both ends of the name as
well. Inside a name they are still allowed, since some of them are
needed there, e.g. the zero-width joiner in emoji sequences.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-10 17:16:37 +01:00
Roman Perekhod 1e9919f9ae fix: Fix space root handling in a graph sharedByMe
The drive item name was derived from the resource path. Space roots
have no path ("."), so e.g. the sharedByMe response reported "." as
the name of a shared project space. Use the name provided by the
storage provider and fall back to the base of the path if it is empty.

Adjust the sharedByMe acceptance scenario for link shares of a
project space accordingly: the space root item now carries the name of
the space.
2026-11-10 14:16:07 +01:00
Sara Ahmadi 5ea6b25e22 feat(graph): allow client-supplied drive IDs when creating spaces 2026-11-10 13:41:51 +01:00
Andre Duffeck 318991481a Merge pull request #3936 from aduffeck/idcache-nats-only
Remove redis-sentinel from store descriptions
2026-11-10 13:32:52 +01:00
André Duffeck 487313d06c Remove redis-sentinel from store descriptions
Redis isn't supported anymore. Also note that the posix driver needs
nats-js-kv for the id cache.
2026-11-10 12:26:09 +01:00
Jörn Friedrich Dreyer 9f6df0cebe Merge branch 'main' into feat/userlog_event_handler_on_demand
Keep main's shared.AllComponentsDisabledError name and use it in
userlog and eventhistory as well.

Assisted-by: Claude Opus 5.5
2026-11-09 15:20:21 +01:00
opencloudeu 5ccce9c7e7 [tx] updated from transifex 2026-10-31 23:17:01 +00:00
Andre Duffeck 120750d8d5 Merge pull request #3476 from opencloud-eu/fix/graph-children-allowed-values
fix(graph): expose allowedValues on driveItem children
2026-10-30 11:11:32 +01:00
opencloudeu cb585561b3 [tx] updated from transifex 2026-10-29 23:17:07 +00:00
Ralf Haferkamp 4e1ea5371b test(graph): wait for event metrics before asserting
The mock backend finished before the event counter was incremented,
allowing the assertion to run too early. Wait for the counter and stop
the consumer during cleanup.
2026-10-29 16:59:11 +01:00
opencloudeu b806773a08 [tx] updated from transifex 2026-10-28 23:17:12 +00:00
Viktor Scharf ae4970d92c chore: bump reva to 2.52.0 (#3820) 2026-10-27 12:46:43 +01:00
micbar 01a6365dcb log errors when a personal space is deleted 2026-10-26 11:51:19 +01:00
Dominik Schmidt 8e508e56c2 refactor: name the settings that extend a default list additional_*
They are merged onto the built-in defaults, the way the proxy's additional_policies and OC_ADD_RUN_SERVICES are, so the name says it: env variable, yaml key and field all carry the prefix. The two that take key:value entries are named in the plural like the other map-shaped settings in this repo, and the README says which of the three takes bare mime types.
2026-10-23 10:18:30 +02:00
Dominik Schmidt f7e8817433 refactor(webdav,graph,frontend): put the thumbnail settings in a thumbnails block
Every service that configures thumbnails now carries one thumbnails section whose keys are named like the setting itself, so webdav's thumbnails.max_input_image_file_size and the thumbnails service's thumbnail.max_input_image_file_size read the same, and a key's path matches its env name. Env names are unchanged.
2026-10-21 13:11:40 +02:00
Dominik Schmidt 16aadb4988 Merge remote-tracking branch 'origin/main' into imagor
# Conflicts:
#	tests/acceptance/expected-failures-decomposed-storage.md
#	tests/acceptance/expected-failures-posix-storage.md
2026-10-20 20:12:56 +02:00
Dominik Schmidt c490926ce3 refactor: name the thumbnail config fields like their yaml keys
Internal only: the fields in webdav, graph and frontend now read Thumbnails like the keys and the variables they carry. The generator keeps its released thumbnail block, field and key alike.
2026-10-20 18:40:39 +02:00
Dominik Schmidt a5dd8143a5 refactor: name the thumbnail yaml keys like their variables
The keys are new in this PR, nothing has them set: a yaml file configures webdav's thumbnail settings under the webdav section, so the key now reads like the variable without its service prefix.
2026-10-20 18:37:44 +02:00
Dominik Schmidt c6ac8748d8 refactor: name the thumbnail settings after the service, THUMBNAILS
The service is thumbnails and its released variables say so; the new ones said THUMBNAIL. None of them has shipped yet, so they are renamed rather than aliased. The input file size gains the shared OC_THUMBNAILS_ name, because webdav and the generator have to agree on it.
2026-10-20 18:08:34 +02:00
Alexander Ackermann 79a4499ca8 refactor: read the default quota only from OC_SPACES_DEFAULT_QUOTA and deprecate GRAPH_SPACES_DEFAULT_QUOTA 2026-10-19 16:13:42 +02:00
Alexander Ackermann 6adeacf8ce feat: expose the default project space quota in the capabilities 2026-10-19 16:13:42 +02:00
Dominik Schmidt 32f4ee02e8 feat(webdav): let a deployment add the types a preview is made of
webdav, graph and ocdav read the same list, so a configured type is
announced and attempted by all three. A type the generator cannot answer
is refused at startup, and ocdav takes the types from its own
configuration instead of importing an OpenCloud package, which the
vendored reva carries until opencloud-eu/reva#885 lands.
2026-10-19 14:57:35 +02:00