Commit Graph
290 Commits
Author SHA1 Message Date
Pascal Bleser a359ef7e85 feat(graph): limit the length of tags
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
2026-11-18 00:29:40 +01:00
André Duffeck 2b77cb9a17 Bump reva to v3.0.1 2026-11-17 12:45:18 +01:00
Alexander Ackermann 9313c7cb19 fix(markdown): create toc anchors like github-slugger
toAnchor removed every character except ASCII letters, digits and spaces,
so headings like "Read-Only" got the anchor "readonly", while GitHub and
Docusaurus create "read-only". Keep hyphens, underscores and non-ASCII
letters, and add a -1, -2, ... suffix to duplicate anchors, the same way
github-slugger does.
2026-11-16 13:34:19 +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
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 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
2435420f69 [full-ci] chore: bump reva to 2.52.2 (#3955)
* chore: bump reva to 2.52.2

* Merge pull request #42 from opencloud-eu/fix-web-theme-merge

fix(web): merge copies of the theme sources so themeDefaults is never mutated

* Merge pull request #43 from opencloud-eu/fix-search-trailing-not

fix(search): handle missing operands in the bleve compiler

* Merge pull request #44 from opencloud-eu/fix-search-highlight-escaping

fix(search): escape file content in OpenSearch highlights

---------

Co-authored-by: Ralf Haferkamp <r.haferkamp@opencloud.eu>
Co-authored-by: Florian Schade <f.schade@icloud.com>
2026-11-11 14:14:34 +01:00
Alex Ababii 3fb1dd3f3f Merge pull request #3938 from maki5/fix/webfinger_panic
fix(webfinger): fix panic in OidcAuth middleware
2026-11-11 10:54:33 +01:00
Jörn Friedrich Dreyer 39493c1f37 Merge pull request #3937 from opencloud-eu/fix/client-ip-no-trusted-proxies
fix(middleware): do not build the XFF middleware without trusted proxies
2026-11-10 17:24: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
Jörn Friedrich Dreyer 73bfeb00d0 fix(middleware): do not build the XFF middleware without trusted proxies
Starting with chi v5.4.0, ClientIPFromXFF panics when no trusted prefix
is given, so ClientIP would crash the proxy and collaboration services at
startup when no trusted proxies are configured. Without trusted proxies
every request uses the network address anyway, so return
ClientIPFromRemoteAddr.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-10 13:00:28 +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
Alex Ababii c71ca6f699 fix(webfinger): fix panic in OidcAuth middleware 2026-11-09 14:33:55 +01:00
micbar 1eb3c738b1 fix: filter health checks from the pod ip
The health check calls the address the server listens on. For 0.0.0.0
that is the IP of the pod, not the loopback address. Compare the peer
with the local address of the connection instead.
2026-11-06 14:34:28 +01:00
micbar f558acdfdb fix: keep the health checks out of the access log 2026-11-05 23:00:19 +01:00
Jörn Friedrich Dreyer dc7f4433a1 fix(tracing): set the global text map propagator
The go-micro tracing wrappers and otelhttp inject and extract the trace
context with the global propagator. Nobody set it, so it stayed the
default no-op: no traceparent went over the wire and every go-micro
service (settings, policies, eventhistory, search) started a new trace
instead of joining the caller's.

GetTraceProvider now also sets the global propagator to the W3C
TraceContext and Baggage propagator we already use elsewhere.

fixes https://github.com/opencloud-eu/opencloud/issues/3856

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-11-05 16:20:47 +01:00
Jörn Friedrich Dreyer 8e83a0eebc Merge pull request #3464 from maki5/fix/upd_chi_real_ip
fix(chore): upd deprecated chi RealIP middelware
2026-11-03 11:05:58 +01:00
micbar b7bb4fbe8c fix: client address for clients in a private network and behind the proxy 2026-11-02 10:25:18 +01:00
Andre Duffeck 12d8edb6e7 Merge pull request #3858 from aduffeck/kql-quote-escaping
Support doubled quotes in KQL values
2026-11-02 08:56:40 +01:00
micbar 4e7ebd4f8c fix: only trust forwarding headers from trusted reverse proxies
chi's ClientIPFrom* header middlewares trust the header from anyone who can
  reach us. Pick the middleware per request instead: headers are only read
  when the peer is a trusted proxy, everyone else gets their network address.

  - PROXY_TRUSTED_PROXIES, defaults to loopback and private ranges
  - PROXY_CLIENT_IP_HEADER, defaults to X-Forwarded-For, e.g. CF-Connecting-IP
  - drop the strategy setting and xff_trusted_hops
  - pass the client address to the services in X-Forwarded-For instead of
    X-Client-Ip, reva reads it e.g. for OCM
  - same check in collaboration, traefik routes to it directly
  - OC_TRUSTED_PROXIES and OC_CLIENT_IP_HEADER set both services
  - the other services only drop RealIP, none of them reads the address

  Taken from #3864 and https://github.com/opencloud-eu/opencloud/pull/3464#issuecomment-6494799883

# Conflicts:
#	services/proxy/README.md
2026-10-30 15:15:22 +01:00
Alex Ababii cf0f06e060 select correct chi middleware to get real IP based on config values 2026-10-30 15:13:55 +01:00
Alex Ababii 850f1714a1 upd deprecated chi RealIP middelware 2026-10-30 15:13:54 +01:00
André Duffeck ff742249ba Only read a KQL value as a date, number or boolean when it is the whole value 2026-10-30 08:54:05 +01:00
Ralf Haferkamp 606fe4ee1b fix(storage): map legacy drivers to supported backends
Related: #3819
2026-10-29 16:59:11 +01:00
Ralf Haferkamp 5419a17fae fix(storage-users): use configured storage for stale node cleanup 2026-10-29 16:59:11 +01:00
André Duffeck fef2b7e3fa Support doubled quotes in KQL values
Fixes #3666
2026-10-29 10:00:59 +01:00
Viktor Scharf ae4970d92c chore: bump reva to 2.52.0 (#3820) 2026-10-27 12:46:43 +01:00
Florian Schade 385062271d feat(search): turn the query filter into a template 2026-10-22 22:46:06 +02:00
Florian Schade 3fe11ea60a feat(search): configurable query filter 2026-10-22 20:05:31 +02:00
micbar 3662a94ca7 fix: nats checks were missing the configured auth 2026-10-14 17:45:44 +02:00
Alex Ababii a51f79505d feat(authguest): renewal logic and publishing event 2026-10-13 09:30:52 +02:00
Alex Ababii 7117c4a672 feat(guestauth): global flag to disable the guest links feature 2026-10-13 09:30:51 +02:00
Alex Ababii 2c898250a9 feat(guestauth): upd file manager lock, addtional filetrs for shareExpired and shareRemoved events, common config loading fix 2026-10-06 08:08:28 +02:00
Alex Ababii c5879ca1b2 feat(guestauth): renaming guest ivitations to guest links for consistency with libre-graph-api 2026-10-06 08:08:28 +02:00
Alex Ababii a1a8221f68 feat(guestauth): global flag to disable the guest links feature 2026-10-06 08:08:26 +02:00
Alex Ababii cbf3ee8c0b feat(guestauth): guestauth service rename to auth-guest 2026-10-06 08:07:44 +02:00
Alex Ababii f86e339233 feat(guestauth): grantee email in GuestTokenCreated event 2026-10-06 08:07:44 +02:00
Alex Ababii a1cb335c37 feat(guestauth): register gusetauth service into opencloud config 2026-10-06 08:07:43 +02:00
Alex Ababii 7af24c09a8 feat(guestauth): handle events and a bit of cleanup 2026-10-06 08:07:43 +02:00
Viktor Scharf af425afb3b [full-ci] chore: bump reva to 2.51.0 (#3657)
* chore: bump reva to 2.51.0

* replaceversion placeholder
2026-10-05 17:08:52 +02:00
Pascal Bleser b8234f81d9 Merge pull request #3521 from pbleser-oc/feat/add-service-to-proxy-metrics
feat(proxy): add per-service metrics to the proxy service
2026-09-22 14:44:04 +02:00
Viktor Scharf 2ebd9635c3 chore: bump version to 8.0.1 (#3548) 2026-09-22 13:50:56 +02:00
Pascal Bleser d768a9b0f9 feat(proxy): add the service to the proxy metrics
Improve the metrics for the proxy service.

 * extend the instrumenter middleware to add a label with the name of
   the service the request is being dispatched to

 * add a native Prometheus histogram that tracks the durations and also
   includes a label for the name of the service the request is being
   dispatched to, as well as a 'result' label ('success',
   'client-error', 'server-error') based on the HTTP status code of the
   response

 * add per-service gauge functions to count the number of in-flight
   requests

 * add a counter for routing failures, for when an inbound request
   cannot be mapped to a route

 * extend the route.RoutingInfo struct with a service attribute, and a
   Service() getter

 * remove the 'routing_failure_count' metric, as it is redundant
2026-09-18 09:52:33 +02:00
Alex Ababii 66ec3765b0 userlog: reworked consumer and http disable/enable ability 2026-09-17 14:21:24 +02:00
Pascal Wengerter 002a2e43fb chore: regenerate mockery outputs 2026-09-16 14:57:41 +02:00
zerox80 2d22a2cf07 fix(oidc): reject invalid audience settings during client setup 2026-09-16 10:15:56 +02:00
zerox80 6f85ee5296 feat(oidc): add access token audience validation 2026-09-16 10:15:56 +02:00