Commit Graph
24597 Commits
Author SHA1 Message Date
Dominik Schmidt d5aba495ee docs(search): describe what paging and counts promise
Pages are stable on an unchanged index only, and a resource reachable through several shares or spaces is counted once per route.
2026-11-27 15:52:46 +01:00
Dominik Schmidt 98e0a2ed20 fix(search): send the searches of a user to the same opensearch shard copies
Replicas keep their own statistics and may score a document differently, so consecutive pages of one search could come in a different order from an unchanged index. The user id is the preference of the search request now.
2026-11-27 15:52:36 +01:00
Dominik Schmidt 6431df692f fix(graph): give a share root among the search hits no parent path
The share root is the root of the mountpoint drive. Described as a child of / there, driveId, path and name led to a folder of the same name inside the share.
2026-11-27 15:52:25 +01:00
Dominik Schmidt d1eda59b34 fix(search): exclude the scope folder of a search by its id
A search scoped to a folder (scope:<id>) restricts the engine query to the path of that folder. The path filter matches the folder itself as well as everything below it, so the folder is a match of its own search whenever it fits the query.

Until now the service dropped it after the engine had answered, by comparing names: a match was removed when "/" + its name equalled the path of the scope. That had three effects:

- The total and the aggregation buckets still counted the folder, so they were one higher than the list of matches.
- It only worked for a scope directly below the space root. With a scope of /a/b the path is never "/" + "b", so the folder b stayed in the results of a search inside b.
- With a scope of /a every match named "a" was removed, also a file or folder of that name further down, which is a legitimate match.

The id of the scope folder is known from the Stat that resolves the scope. It now goes into the engine query as NOT id:"<id>", the same way the default query template already excludes the personal space root, and the name comparison is gone. Matches, total and buckets agree, on every depth, for the WebDAV report and for the graph search.

Example, searching "urlaub" inside /Urlaub, which holds urlaub-2024.jpg and a sub folder Urlaub: before, 1 match (the jpg) and a total of 3. Now, 2 matches (the sub folder and the jpg) and a total of 2.
2026-11-27 15:52:16 +01:00
Dominik Schmidt c40173a5c4 fix(graph): place the parent of a search hit in a share in the mountpoint drive
The path of such a hit is relative to the mountpoint, the driveId pointed to the drive of the owner.
2026-11-27 15:52:04 +01:00
Dominik Schmidt cfe3b17038 fix(search): limit the shape of aggregation requests
At most 16 aggregations and 3 bucket levels per request and 5 requests per query. The bleve collector stops at the bucket limit instead of checking after the walk, and the limit also holds for the result merged across spaces.
2026-11-27 15:51:55 +01:00
Dominik Schmidt f228110fdf feat(search): add aggregation filter tokens
Server-issued aggregationFilterToken on buckets, consumed verbatim via searchRequest.aggregationFilters. The graph layer decodes a filter into its buckets (a term, a range, or an or(...) of them), the proto carries them as AggregationFilter, and the engines match them natively: a key as the exact value of the field, a range from-inclusive and to-exclusive, so a drilldown returns exactly the matches the bucket counted. Filters are validated like aggregations, in both layers. Range tokens use the MS Graph spelling (range(min, 1980), range(2010, max, to="le")). AGG-22 to AGG-33, 36, 38 and 45 in the parity suite.
2026-11-27 15:51:45 +01:00
Dominik Schmidt 1c15b904d7 feat(search): add nested aggregations
Sub-aggregations on both engines: bleve folds child buckets below their parent through the same collector, OpenSearch nests them natively, so a request stays one search per space. The proto gains sub_aggregations on the option and on the bucket; merge, finalize, validation and the bucket limit walk every level, results are positional at every level, a metric has no buckets to nest in. AGG-10 to AGG-15, 20, 35, 40 and 44 in the parity suite, AGG-14 as a known OpenSearch divergence.
2026-11-27 15:51:35 +01:00
Dominik Schmidt 48867e07f1 feat(search): add metric aggregations
sum/min/max/avg over a numeric field: bleve folds the accumulators from doc values, OpenSearch reads them from a stats aggregation, the service layer reduces them to the value of the kind after the cross-space merge. The proto gains MetricDefinition, MetricKind and Metric, which travels as accumulators (sum, count, min, max) so the merge works whatever the kind; value is set after the merge and absent for a metric without a single value. A metric is only valid on a numeric field, and only one of bucketDefinition and metricDefinition at a time. AGG-06, 18 and 21 in the parity suite.
2026-11-27 15:51:25 +01:00
Dominik Schmidt b4ef68114b feat(search): add range aggregations
Numeric and date ranges on both engines: bleve folds them from doc values, OpenSearch uses range and date_range aggregations. The proto gains BucketRange and bucketDefinition.ranges, the aggregation package the range parser (bounds are numbers or RFC3339 dates, one kind per aggregation, anything else is rejected), the kind of an option and the validation of ranges against the field type. Every requested range is answered in request order, an empty one with a count of zero, with no space answering too; size does not cut ranges, keyAsNumber sorts them by their lower bound. Range keys read from..to. AGG-04, 05 and 07 to 09 in the parity suite.
2026-11-27 15:51:16 +01:00
Dominik Schmidt 2df07bfcdc feat(search): add terms aggregations
Term buckets on both engines: bleve folds them from doc values (its facets read numbers as prefix-coded terms), OpenSearch uses terms aggregations. A request gets every bucket, up to 65535 per space (the OpenSearch default for search.max_buckets, held on bleve as well); beyond that it is refused. The proto gains AggregationOption, BucketDefinition (sort, minimum count), AggregationResult and Bucket. The new aggregation package merges the per-space results by position, so several aggregations on one field stay apart, and shapes them per BucketDefinition (minimum count, sort, size). It also validates aggregations against the index mapping (a field the index knows and a client may name, of a type whose values are buckets; the mapping overrides mark the internal fields): the search service relies on it, the graph endpoint asks it first to save the round trip, next to its own checks against the spec, and with the field names of the request so an error reads like the request. A request names a field like the driveItem property, exactly so. A number is keyed as it is, a bool as true or false on both engines, an empty value is no bucket. Pinned in the parity suite as AGG-01 to 03, 17, 34, 37 and 39; the paging rows AGG-41 to 43 pin the first commit through the same matrix machinery, which also shortens long answer lists in the README.
2026-11-27 15:51:07 +01:00
Dominik Schmidt 87fc8cdb55 refactor(search): move the opensearch facet bridge to mapping.ToProto
convert.copyFacet rebuilt every facet by hand on the way into the index; mapping.ToProto is the generic counterpart of the FromProto the graph endpoint uses, so both directions share one bridge.
2026-11-27 15:50:55 +01:00
Dominik Schmidt de8a518157 feat(graph): add POST /search/query
MS Graph style search endpoint: searchRequest with KQL queryString, from/size pagination (values outside the spec's bounds are rejected), entityTypes validated to driveItem, hits as driveItems with webUrl, parentReference, remoteItem for shares, the facets and @libre.graph.permissions.actions.allowedValues, which the search service now projects onto the Entity from the same permission set as the WebDAV report. Properties the endpoint does not evaluate yet (aggregations, aggregationFilters, sortProperties) answer 501 instead of being ignored, an unknown $expand answers 400, and a failing search service keeps its status. Hits reuse what the drive item listing has, which moves a little: the thumbnails helper is named for the drive item it fills (setDriveItemThumbnailsByID, it served shares only), the web URL of an id gets a helper (webURLForID), and the facets come out of the proto through one generic mapping.FromProto instead of a copy per facet.
2026-11-27 15:50:43 +01:00
Dominik Schmidt 3abf08b85f feat(search): offset paging with a stable order
The search service takes a `from` offset next to the page size and applies it after the cross-space merge; every space answers the full prefix up to from+size, since an offset cannot be distributed. Pages are stable: both engines and the merge break score ties by id, and OpenSearch counts every match (track_total_hits). No engine pages beyond the first 10000 matches, the OpenSearch result window, so a from and size reaching beyond it are rejected on both engines. `page_size` becomes optional on the wire: absent is the default of 200, 0 asks for no matches, -1 for all; WebDAV and the tags listing set it accordingly, and the WebDAV report's `<oc:offset>`, parsed since the report exists and never read, now pages the merged list. The gRPC wrapper passes the request through and keys its cache by the whole request.
2026-11-27 15:50:35 +01:00
Dominik Schmidt 3f2355d76b Merge pull request #3836 from opencloud-eu/chore/search-drop-index-provider-proto
chore(search): drop the IndexProvider service from the proto
2026-11-27 15:28:08 +01:00
Dominik Schmidt df18630f19 chore(search): drop the IndexProvider messages from the proto 2026-11-27 14:53:50 +01:00
Dominik Schmidt 84d85b5660 refactor(search): give the engine Go types instead of the proto messages 2026-11-27 14:53:19 +01:00
Dominik Schmidt 46630ef1d8 chore(search): drop the IndexProvider service from the proto 2026-11-27 14:52:58 +01:00
Florian Schade d65aa3270c Merge pull request #4130 from dragonchaser/backport-wp3-793
fix(graph): keep shares visible in sharedWithMe when a resource cannot be statted
2026-11-27 13:40:01 +01:00
Jörn Friedrich Dreyer d6c15b2f5e Merge pull request #4141 from opencloud-eu/fix/audit-legacy-upgrade
[full-ci] fix: audit log follow-ups from the review
2026-11-27 12:20:18 +01:00
Andre Duffeck fd9bb83f78 Merge pull request #3243 from opencloud-eu/fix/graph-get-user-drive-id-or-name
feat(graph): accept user name or id in GetUserDrive
2026-11-27 11:27:19 +01:00
micbar fe15575227 fix(audit): report ignored file settings, audit members added by PATCH
Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 11:20:58 +01:00
Andre Duffeck b68b12d487 Merge pull request #4149 from opencloud-eu/feat/graph-link-creator
feat(graph): return the creator of a public link
2026-11-27 10:14:30 +01:00
Andre Duffeck a7cfefecaf Merge pull request #3270 from opencloud-eu/extract-config-binder
refactor(config): extract BindSourcesToStructs into pkg/config/binder
2026-11-27 09:18:20 +01:00
Viktor Scharf ce5643786e test(guest-link): check share types of resources shared with a guest (#4128)
* test(guest-link): check share types of resources shared with a guest

* test(guest-link): rename the share types scenarios as suggested in the review

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 08:02:29 +00:00
Viktor Scharf 67d63d608e tests: remove unused tags, run the search properties scenarios as expected failures (#4142)
* tests: remove unused tags from the acceptance tests

Remove the tags that neither the CI of opencloud nor the one of reva
filters on, and that no hook uses: @smokeTest, @skipOnStorage:ceph,
@skipOnStorage:scality, @skipOnOpencloud-decomposeds3-Storage (the CI only
runs posix and decomposed), @sqliteDB, @notification and @skip-local-run.
A tag line left empty becomes an empty line, so that the line numbers of
the scenarios, which the expected failures of opencloud and reva refer to,
stay the same.

Also fix the typo @@skipOnReva, and write the issue tags the same way:
@issues-<n> becomes @issue-<n>, @web-issue-<n> becomes @issue-web-<n>.

Assisted-by: Claude Code:claude-opus-5-5

* tests: run the search properties scenarios as expected failures

The two scenarios that check the properties of search results were
skipped, since the search REPORT returns an empty d:getetag (#3501) and
the step retried the whole check for 20 seconds, which made them too slow
as expected failures.

- retry the search only until the entry is indexed, then check its
  properties once: once found, the entry is complete, so a wrong value
  fails right away
- check what the search returns: d:getcontentlength for files, the real
  size of 12 bytes, a file id of the form <uuid>$<uuid>!<uuid>, anchored
  patterns, and no oc:owner-id and oc:owner-display-name, which the
  search response never contains
- list them as expected failures of #3501 instead of skipping them

Without the d:getetag check, both scenarios pass.

Assisted-by: Claude Code:claude-opus-5-5

* lint fix
2026-11-27 08:01:41 +00:00
Alexander Ackermann 175d5681bc feat(graph): return the creator of a public link
Link permissions now carry their creator as invitation.invitedBy.user,
like user and group shares do.

Fixes #4148

Assisted-by: Claude Code:claude-opus-5-5
2026-11-27 08:24:20 +01:00
Florian Schade 8315120894 Merge pull request #4136 from fschade/search-optimize-index
feat(search): add a command to optimize the search index
2026-11-26 20:15:41 +01:00
Viktor Scharf 1a9ae68995 tests: use mailpit instead of inbucket as the email server (#4138)
The local dev setup of web switched from inbucket to mailpit
(opencloud-eu/web#4059). Use mailpit for the acceptance tests too, in the
CI, the docker setup and the README, so that one mail catcher is used
everywhere.

The tests now read and delete the emails through the API of mailpit
(port 8025), and the server sends them via SMTP to port 1025. mailpit's
search also matches parts of addresses, so EmailHelper narrows the results
down to the mailbox (the local part of the address), as inbucket did.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-26 17:26:47 +01:00
micbar 0a36e91f0c fix: audit log follow-ups from the review
Assisted-by: Claude Code:claude-opus-5-5
2026-11-26 17:26:25 +01:00
micbar 8d42270543 refactor(audit): build the audit emitter in one place 2026-11-26 16:52:55 +01:00
micbar 6b21f018dc docs(adr): add the audit decisions from the first implementation
target and path semantics, the public link as actor, roles and recipients in share records, one login per OIDC session, the link access dedupe, the output ordering and why strict comes later.
2026-11-26 16:52:55 +01:00
micbar 1b3790e6f1 feat: pass the audit settings to the reva services
frontend, sharing and storage-users pass the audit settings and the service version to the reva audit emitters. `best_effort` is the only mode for now, any other value stops the service. The frontend keeps the events endpoint the archiver needs for its records.
2026-11-26 16:52:55 +01:00
micbar c684897e3e feat(graph): audit user, group and role changes
Also records denied space creation and data exports of other users.
2026-11-26 16:52:55 +01:00
micbar 1edcc57d88 feat(proxy): audit logins, public link access and backchannel logouts
The proxy builds the audit request context: client address (PROXY_CLIENT_IP_HEADER behind trusted proxies), user agent, auth method, session and OIDC client. A value a client sent in X-Audit-Context is dropped.

A login is recorded once per OIDC session and client, not per access token. Public link access is recorded with the client address, failed attempts every time.
2026-11-26 16:52:55 +01:00
micbar a12cca9a5f feat: read the audit request context in the HTTP services
The HTTP services put the X-Audit-Context header of the proxy into the request context, so it reaches reva with the next call.
2026-11-26 16:52:55 +01:00
micbar 2b8bd6c51a feat(audit): write audit records from the audit stream
The audit service reads the JetStream stream `audit` and writes every record as one line of JSON to stdout and, if configured, to an OTLP endpoint, with the emitting service in the resource. A record is acknowledged only when all outputs have it, so an output outage keeps the records in the stream, in order and without duplicates. The old audit log stays available with AUDIT_LEGACY_ENABLED.

Adds the OpenTelemetry log packages for the OTLP output.
2026-11-26 16:52:55 +01:00
Florian Schade d275718077 feat(search): add a command to optimize the search index 2026-11-26 15:24:55 +01:00
Michael Barzandv.scharf 0629702ecf docs: label reva bumps by the changes they bring in (#4135)
* docs: label reva bumps by the changes they bring in

Assisted-by: Claude Code:claude-opus-5-5

* docs: label web bumps by the changes they bring in

Assisted-by: Claude Code:claude-opus-5-5

---------

Co-authored-by: v.scharf <v.scharf@opencloud.eu>
2026-11-26 15:00:36 +01:00
Michael Barz 8a88976436 build: bump reva to the first part of the audit log (#4134)
Assisted-by: Claude Code:claude-opus-5-5
2026-11-26 13:28:08 +00:00
Florian Schade 335e482a96 Merge pull request #4133 from fschade/search-oversized-metadata
fix(search): extract the metadata of files over the size limit
2026-11-26 13:46:59 +01:00
Viktor Scharf 993a616ae9 tests: renew the bearer token on 401 instead of checking it before each request (#4126)
Before each request with a bearer token, the test helper sent a
GET /graph/v1.0/me to check that the cached token is still valid, which
doubled the number of requests. Now the request is sent with the cached
token right away, and on a 401 the token is renewed and the request sent
once more.

Also drop the retry while the share manager is migrating, which is no
longer needed.
2026-11-26 13:43:10 +01:00
Sara Ahmadi 5587308559 Merge pull request #4125 from asaah262/fix/868-web-asset-index-fallback
fix(web): serve the index fallback without recursion and handle file errors
2026-11-26 12:22:53 +01:00
Sara Ahmadi 3158e83185 fix(web): check for a NUL byte in the asset name instead of treating EINVAL as no file
Assisted-by: Claude Code:claude-opus-5-5
2026-11-26 10:47:19 +01:00
Viktor Scharf 21123271d3 tests: set the response only in When steps (#4121)
Helpers and Given/Then steps no longer store their response, so a Then
step can't pass on a response left over from an earlier step:
- favorite helpers, used by Given steps too, return the response
- the preview Given/Then steps and the space entry Then steps pass their
  response explicitly instead of storing it
- the rename by file id and set property steps are When steps
- the wopi, trashbin, colon path and revisions cleanup helpers return the
  response to their When steps
2026-11-26 08:47:07 +00:00
David Walter 37e9c18989 fix(graph): keep shares visible in sharedWithMe when a resource cannot be statted (#12430) 2026-11-26 09:40:31 +01:00
Dominik Schmidt a541fac41d feat(graph): accept user name or id in GetUserDrive
GetUserDrive only resolved the personal drive when the {user-id} path
segment was the user's opaque id; a user name (which GetUser accepts)
returned 404. Resolve the segment through the identity backend first
(skipping the /me/drive self case), so both an id and a name work. Also
add GetUserDrive to the Service interface, consistent with the other
user handlers.
2026-11-25 23:23:36 +01:00
Sara Ahmadi ac365de8db fix(web): log file errors of the asset server and answer server errors with 500
Assisted-by: Claude Code:claude-opus-5-5
2026-11-25 18:24:51 +01:00
Florian Schade 701a26dfb0 fix(search): extract the metadata of files over the size limit 2026-11-25 15:50:10 +01:00
Pascal Bleser a6806bb603 Merge pull request #4120 from pbleser-oc/fix/867-https-redirect-trusted-host
fix(proxy): redirect to HTTPS on the host of OC_URL
2026-11-25 14:48:34 +01:00