Compare commits

...
Author SHA1 Message Date
nabim777 3be12a45c6 test: add tests for post processing command for different steps
Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
2026-10-15 12:19:18 +05:45
Matteo fba139fdec fix(web): [OCISDEV-1543] show details preview for public link files with spaces in the name (#13150) 2026-10-14 14:03:08 +02:00
Lukas Hirt e0dd0e4348 fix(web): [OCISDEV-1527] disable vertical page overscroll in file apps (#13140)
Scrolling inside an app such as OnlyOffice could make the whole page bounce
with it, exposing the blank page background behind the app frame. Set
overscroll-behavior-y: none on the root element while AppWrapper is mounted
and restore the previous value on unmount. The logic lives in a new
useDisableRootOverscroll composable, which is covered by unit tests.

Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-10-13 21:18:12 +02:00
Matteo 710bdf380a fix(web): [OCISDEV-1513] clean up trash view in the Safe (#13136) 2026-10-13 15:42:01 +02:00
Michal Klos 7b83f36060 fix(proxy): [OCISDEV-1517] add missing /vault/graph routes for activities and invitations (#13109) 2026-10-13 13:15:20 +00:00
Michal Klos 2a23956a8b fix(web): [OCISDEV-1518] show correct message when Safe access is denied for lacking permission (#13111)
* fix(web): [OCISDEV-1518] show correct message when Safe access is denied for lacking permission

* chore: changelog
2026-10-13 11:29:58 +00:00
Prajwol Amatya 9269643c0e [tests-only][full-ci][k8s] test: run e2e app-provider with k8s setup (#13046)
* test: run e2e app-provider with k8s setup

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: limit app-registry mimetypes

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: add host for onlyoffice

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: enable secure view

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

* test: add available unified roles

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>

---------

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
2026-10-13 16:23:20 +05:45
Matteo 6c8fe4ebf7 fix(web): [OCISDEV-1511] refresh files stuck in processing after upload or copy (#13134)
* fix(web): [OCISDEV-1511] refresh files stuck in processing after upload or copy

A postprocessing-finished event that arrives while a folder reload or a
fetch after copy is still in flight is dropped, because the resource is
not in the store yet. The response then adds the resource as processing
and nothing clears it until a page reload.

Remember finished items for a short time and refetch them when they show
up in the store as processing.

* chore: [OCISDEV-1511] add changelog
2026-10-13 12:22:01 +02:00
kobergjandClaude Opus 5 037ac76d26 ci(release): remove the disabled docker jobs from the release pipeline (#13129)
ci(release): remove the disabled docker jobs from the release pipeline (#13128)

Tagging v9.0.0-rc.1 produced a startup_failure: the workflow was rejected
before any job ran. owncloud pins Actions to an org allowlist
(owncloud/admin:actions-allowlist.yml, allowed_actions: selected with
sha_pinning_required), and three pins in this file are not on it:

  docker/setup-buildx-action @f87e5991 v4.4.1 (allowlist has v4.0.0)
  docker/login-action        @dbcb8138 v4.6.0 (allowlist has v4.1.0)
  docker/build-push-action   @c3c9e263 v7.4.0 (allowlist has v7.0.0)

Allowlist validation happens at parse time, so it does not care that all
three only appear in jobs already marked `if: false`.

Rather than pin them back, drop the jobs. Building, scanning and publishing
the production image moved to owncloud-docker/ocis, which is why these were
disabled in the first place; the image Trivy scan now runs there on every PR.
That leaves nothing to maintain here and removes all three offending pins.

Removes docker-build, docker-scan (dead too: it needs docker-build),
docker-manifest and docker-readme. Nothing outside that subgraph depended on
them, so the `docker_repos` and `is_production` outputs, the
PRODUCTION_RELEASE_TAGS / DOCKER_REPO_ROLLING / DOCKER_REPO_PRODUCTION env
vars and the REPOS computation go with them. is_prerelease stays, as
create-github-release still reads it.

The filesystem scan in security-scan-trivy is untouched.



(cherry picked from commit aab12d018e)

Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-13 09:12:10 +02:00
owncloud-translations-bot[bot] 9faaefa83a chore: update translations from transifex (#13130)
Co-authored-by: owncloud-translations-bot[bot] <274778013+owncloud-translations-bot[bot]@users.noreply.github.com>
2026-10-13 07:11:18 +00:00
Prajwol Amatya 85700efcd1 [tests-ony][full-ci][k8s] test: update storageusersvault setup for k8s (#13131)
test: update storageusersvault settings for k8s

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
2026-10-13 10:52:53 +05:45
dependabot[bot] 91a8c76bdb build(deps): bump actions/setup-node from 6.4.0 to 7.1.0 (#13118)
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 6.4.0 to 7.1.0.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v6.4.0...949feb2413d6458794dcd2491c4babbbce0c15c1)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-12 19:44:39 +02:00
dependabot[bot] 88e2780a54 build(deps): bump actions/upload-artifact from 4.6.2 to 7.0.2 (#13117)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 7.0.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.6.2...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-12 16:22:42 +02:00
dependabot[bot] 60fcb2e214 build(deps): bump actions/download-artifact from 4.3.0 to 8.0.2 (#13119)
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4.3.0 to 8.0.2.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4.3.0...9000827ccba6bdab643e8b6fd33ac0654aef8333)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-12 16:22:20 +02:00
dependabot[bot] c8224fd434 build(deps): bump the minor-and-patch group across 1 directory with 7 updates (#13126)
Bumps the minor-and-patch group with 7 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [github.com/go-chi/httprate](https://github.com/go-chi/httprate) | `0.16.0` | `0.16.1` |
| [github.com/go-ldap/ldap/v3](https://github.com/go-ldap/ldap) | `3.4.14` | `3.4.15` |
| [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) | `2.15.0` | `2.15.1` |
| [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) | `1.24.1` | `1.25.0` |
| [github.com/tidwall/gjson](https://github.com/tidwall/gjson) | `1.19.1` | `1.20.0` |
| [go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp](https://github.com/open-telemetry/opentelemetry-go-contrib) | `0.71.0` | `0.72.0` |
| [golang.org/x/sync](https://github.com/golang/sync) | `0.23.0` | `0.24.0` |



Updates `github.com/go-chi/httprate` from 0.16.0 to 0.16.1
- [Release notes](https://github.com/go-chi/httprate/releases)
- [Commits](https://github.com/go-chi/httprate/compare/v0.16.0...v0.16.1)

Updates `github.com/go-ldap/ldap/v3` from 3.4.14 to 3.4.15
- [Release notes](https://github.com/go-ldap/ldap/releases)
- [Commits](https://github.com/go-ldap/ldap/compare/v3.4.14...v3.4.15)

Updates `github.com/nats-io/nats-server/v2` from 2.15.0 to 2.15.1
- [Release notes](https://github.com/nats-io/nats-server/releases)
- [Changelog](https://github.com/nats-io/nats-server/blob/main/RELEASES.md)
- [Commits](https://github.com/nats-io/nats-server/compare/v2.15.0...v2.15.1)

Updates `github.com/prometheus/client_golang` from 1.24.1 to 1.25.0
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/v1.25.0/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.24.1...v1.25.0)

Updates `github.com/tidwall/gjson` from 1.19.1 to 1.20.0
- [Commits](https://github.com/tidwall/gjson/compare/v1.19.1...v1.20.0)

Updates `go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp` from 0.71.0 to 0.72.0
- [Release notes](https://github.com/open-telemetry/opentelemetry-go-contrib/releases)
- [Changelog](https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CHANGELOG.md)
- [Commits](https://github.com/open-telemetry/opentelemetry-go-contrib/compare/zpages/v0.71.0...zpages/v0.72.0)

Updates `golang.org/x/sync` from 0.23.0 to 0.24.0
- [Commits](https://github.com/golang/sync/compare/v0.23.0...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/httprate
  dependency-version: 0.16.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: github.com/go-ldap/ldap/v3
  dependency-version: 3.4.15
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: github.com/nats-io/nats-server/v2
  dependency-version: 2.15.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: minor-and-patch
- dependency-name: github.com/prometheus/client_golang
  dependency-version: 1.25.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: github.com/tidwall/gjson
  dependency-version: 1.20.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
  dependency-version: 0.72.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
- dependency-name: golang.org/x/sync
  dependency-version: 0.24.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: minor-and-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-12 16:13:34 +02:00
Firas Frikha 69433426be chore(deps): [OCISDEV-901] bump reva to the legacy upload removal (#13112)
Signed-off-by: Firas Frikha <firas.frikha@kiteworks.com>
2026-10-12 11:51:14 +02:00
Matteo 9015eec558 fix(vault): [OCISDEV-1503] fix signed URL downloads in vault mode (#13097)
Save the MFA status after the user is resolved so signed-URL downloads
inherit it, and check its age on read. Build the signing-key URL with
the URL API so it works with the vault base URL.
2026-10-12 10:28:49 +02:00
owncloud-translations-bot[bot] 5129853267 chore: update translations from transifex (#13114)
Co-authored-by: owncloud-translations-bot[bot] <274778013+owncloud-translations-bot[bot]@users.noreply.github.com>
2026-10-12 09:36:26 +02:00
Michal Klos a669541b13 fix(notifications): [OCISDEV-1515] redact file/space names in vault share and membership emails (#13099) 2026-10-12 09:32:19 +02:00
Prajwol Amatya c0c15f8cab chore: bump golang.org/x/net version (#13120) 2026-10-12 09:31:15 +02:00
Roman PerekhodandClaude Sonnet 5 2e377bde67 fix: [OCISDEV-1476] fix AuthApp requests failing with a custom PROXY_… (#13078) (#13107)
* fix: [OCISDEV-1476] fix AuthApp requests failing with a custom PROXY_USER_OIDC_CLAIM

* fix: [OCISDEV-1476] map ErrAccountNotFound to 401 in verifyUser

AccountResolver.verifyUser only mapped ErrAccountDisabled to 401 before
falling through to a generic 500. The identity backend excludes disabled
accounts from by-username lookups and returns ErrAccountNotFound instead,
so a disabled user authenticating via AppAuth or basic auth got a 500
instead of a 401, caught by the acceptance test suite.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09 13:37:34 +00:00
Roman PerekhodandClaude Sonnet 5 703bbe1113 fix: [OCISDEV-1523] fix the LDAP master-ID filter for an empty base filter (#13100)
* fix: [OCISDEV-1523] fix the LDAP master-ID filter for an empty base filter

EnhanceFilterWithMasterID replaced an empty LDAP filter with a master-ID-only
filter. This action restricted an unrestricted search to master-ID users
only. The bug broke the cross-instance user search in multi-instance
deployments. The function now keeps an empty filter unchanged.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix: [OCISDEV-1523] require an explicit LDAP user filter with a master ID

EnhanceFilterWithMasterID in ocis-pkg/ldap/filter.go now keeps an empty
LDAP filter unchanged instead of restricting it to master-ID users only.
The auth-basic, users, groups, and graph services reuse this function to
compute their default LDAP user filter at startup.

An unset filter now means these services resolve or authenticate every
user in the shared LDAP directory, not only master-ID users. This action
is a behavior change for a deployment that sets
OCIS_MULTI_INSTANCE_MASTER_ID without an explicit OCIS_LDAP_USER_FILTER.

Each service now rejects startup when OCIS_MULTI_INSTANCE_MASTER_ID is
set and its own user filter is empty. This action keeps a multi-instance
deployment scoped to its own users by default.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* refactor: [OCISDEV-1523] simplify EnhanceFilterWithMasterID guard clauses

The function collapses three early-return guards into one condition.
This action removes a duplicated rationale comment between filter.go
and filter_test.go.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* docs: [OCISDEV-1523] point the changelog entry at the master backport PR

The changelog entry pointed at PR 13096, the stable-8.2 backport. This
commit points the entry at the master-branch PR number instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-09 15:27:27 +02:00
Paul FaureandClaude Opus 5.5 1347e3607d fix(proxy): don't log an error when create-home finds no user (#13102)
Requests on unprotected routes can carry a reva token without a resolved
user: reva's internal downloads to the data gateway (/data) are sent with
the caller's token. create_home logged "no user in context" at error level
for each of them, so every download added an error line. Log at debug with
the path instead; the request is passed on unchanged, as before.

Fixes #13101


Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT

Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 13:50:55 +02:00
isha 9e2a79d0f2 [full-ci][tests-only][k8s] test: run part-2 e2e suites on k8s deployment (#13037)
test: run e2e suites on k8s deployment
2026-10-09 17:08:00 +05:45
Matteo 841dd9b948 fix(web): [OCISDEV-1509] show error instead of empty message when space trash is not accessible (#13105) 2026-10-09 13:22:28 +02:00
887796c36d fix(audit): record the acting user in the audit log's User field (#13051)
The file and folder converters filled User from the event's Owner, which
reva does not set, so the field was empty on every upload, download, move,
delete, restore and version restore; where Owner was set it named the owner
instead of the actor. Space, user and group converters hard-coded User to
an empty string although every one of those events carries the Executant.

User now comes from the event's Executant everywhere an actor exists. The
Owner field of file events is unchanged; the failed public-link access
event has no actor and keeps an empty User.

Tests give the fixtures different owner and actor ids so they can tell the
two apart (they fail on the previous code), and add cases for the user and
group converters. The group member added/removed messages passed the user
and group ids in swapped order; fixed.

Fixes #4789

Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Juan Pablo Villafañez <jpvillafanez@izertis.com>
2026-10-09 11:44:39 +02:00
owncloud-translations-bot[bot] 02c52130bb chore: update translations from transifex (#13103)
Co-authored-by: owncloud-translations-bot[bot] <274778013+owncloud-translations-bot[bot]@users.noreply.github.com>
2026-10-09 08:25:48 +00:00
kobergjandClaude Opus 5 76a9cb8042 docs: replace envvar introductionVersion 8.3.0 with 9.0.0 (#13106)
The next oCIS release is 9.0.0, so all envvars that were annotated with
the previously planned 8.3.0 introduction version need to be updated.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-10-09 10:20:09 +02:00
Paul FaureandClaude Opus 5.5 b5f843e99b feat(search): add a --timeout flag to the index command (#13053)
* feat(search): add a --timeout flag to the index command

ocis search index called the search service with a hard-coded 10 minute
request timeout. The service walks the whole space inside that request, so
when the timeout expired the walk was cancelled (error walking the tree:
context canceled) and everything after that point stayed unindexed. A space
whose walk takes longer than ten minutes could never be fully indexed from
the command line.

The timeout is now a flag: --timeout takes a duration, default 10m so the
behaviour is unchanged out of the box; 0 waits indefinitely (go-micro treats
a zero RequestTimeout as an already-expired deadline, so a far-off one is
substituted).

Fixes #13052

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Paul Faure <paul@faure.ca>

* docs(search): say the index command needs the running search service

The index command is a gRPC client of the search service and never opens
the Bleve index, so it works with the default exclusive lock
(SEARCH_ENGINE_BLEVE_SCALE=false) but needs the service running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT
Signed-off-by: Paul Faure <paul@faure.ca>

---------

Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 09:54:38 +02:00
Paul FaureandClaude Opus 5.5 be21f76688 feat(audit): record tag changes in the audit log (#13055)
* feat(audit): record tag changes in the audit log

Graph publishes TagsAdded and TagsRemoved on every tag assign and unassign,
but only the search service listened, so a tag change left no trace in the
audit log.

The audit service now registers both events and logs them as file_tags_add
and file_tags_remove, with the acting user (Executant), the space owner, the
file id and path, and the comma-separated tags. Graph sets the Timestamp on
both events, which it left unset. Two test cases use different owner and
actor ids; the audit README documents the two actions.

Fixes #13054

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Paul Faure <paul@faure.ca>

* fix(audit): record only the tags that actually changed; skip no-op tag events

Review follow-up for #13055:
- graph: TagsAdded/TagsRemoved now carry the tags that were actually added
  or removed (requesting an existing tag, or removing an absent one, is not
  a change). Search only uses the event's Ref, so it is unaffected.
- audit: skip tag events whose tag list is empty. Graph still publishes
  TagsRemoved for search when nothing was present; that is not an audit event.
- audit: document why User is the executant for tag events; describe Tags
  as carried by the event; remove a stray copy-pasted doc comment.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT
Signed-off-by: Paul Faure <paul@faure.ca>

* fix(audit): carry the requested tags in tag events, as before

Per review: TagsAdded/TagsRemoved go back to carrying the tags as
requested, and the audit log records every request, including tags that
were already present (or absent, for a removal), so repeated requests stay
visible. Computing the actual delta belongs in the tags package, not here.

Removes the graph-side tagsDiff helper and its test, and the audit
service's skip for empty tag lists. The other review fixes stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpoeSoKYEdgQcWjEzTVKpT
Signed-off-by: Paul Faure <paul@faure.ca>

---------

Signed-off-by: Paul Faure <paul@faure.ca>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-09 09:54:17 +02:00
Firas Frikha d90dfa7085 refactor(storage-users): [OCISDEV-1382] list upload sessions through the coordinator (#13098)
* refactor(storage-users): [OCISDEV-1382] list upload sessions through the coordinator

Signed-off-by: Firas Frikha <firas.frikha@kiteworks.com>

* fix(storage-users): [OCISDEV-1382] use a safe type assertion for the driver config

Signed-off-by: Firas Frikha <firas.frikha@kiteworks.com>

---------

Signed-off-by: Firas Frikha <firas.frikha@kiteworks.com>
2026-10-09 08:58:54 +02:00
Matteo f7453530f6 chore(web): [OCISDEV-1501] remove vault MFA session extension popup (#13085)
Remove the "Session expiring" extend/dismiss popup and its expiry
worker. Drop the frontend session_duration capability and config;
OCIS_MFA_SESSION_DURATION stays in use by the proxy.
2026-10-08 18:54:57 +02:00
337 changed files with 16922 additions and 10216 deletions

No files matched your search

+21 -21
View File
@@ -62,7 +62,7 @@ jobs:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
@@ -165,7 +165,7 @@ jobs:
exit $FAILED
- name: Upload build artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ocis-build-artifacts
path: |
@@ -280,7 +280,7 @@ jobs:
'
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -294,7 +294,7 @@ jobs:
- name: Upload raw coverage data
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: api-coverage-${{ matrix.suite }}
path: ${{ env.GOCOVERDIR }}
@@ -328,7 +328,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -342,7 +342,7 @@ jobs:
- name: Upload raw coverage data
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: api-coverage-cli-${{ matrix.suite }}
path: ${{ env.GOCOVERDIR }}
@@ -376,7 +376,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -390,7 +390,7 @@ jobs:
- name: Upload raw coverage data
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: api-coverage-ldap-pool-${{ matrix.suite }}
path: ${{ env.GOCOVERDIR }}
@@ -468,7 +468,7 @@ jobs:
'
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -485,7 +485,7 @@ jobs:
- name: Upload raw coverage data
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: api-coverage-core-${{ matrix.suite }}
path: ${{ env.GOCOVERDIR }}
@@ -534,7 +534,7 @@ jobs:
vault_storage: true
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
# 24.16.0 breaks playwright install (yauzl zip extraction hangs); pin to last known good.
# https://github.com/microsoft/playwright/issues/40724
@@ -551,7 +551,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -683,7 +683,7 @@ jobs:
- name: Upload tracing result
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-traces-${{ matrix.suite }}-${{ github.run_attempt }}
path: web/reports/e2e
@@ -691,7 +691,7 @@ jobs:
- name: Upload a11y result
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-a11y-result-${{ matrix.suite }}-${{ github.run_attempt }}
path: web/reports/e2e/a11y-report.json
@@ -712,7 +712,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -737,7 +737,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -762,7 +762,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -787,7 +787,7 @@ jobs:
sudo NEEDRESTART_MODE=a apt-get install -y libvips42t64
- name: Download build artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: ocis-build-artifacts
@@ -809,7 +809,7 @@ jobs:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
@@ -842,7 +842,7 @@ jobs:
go-version-file: go.mod
cache: true
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: "24"
@@ -876,7 +876,7 @@ jobs:
cache: true
- name: Download raw coverage data
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
pattern: api-coverage-*
path: ${{ env.GOCOVERDIR }}
+109 -7
View File
@@ -447,7 +447,7 @@ jobs:
e2e-tests:
name: e2e-${{ matrix.suite }}-k8s
runs-on: ubuntu-latest
timeout-minutes: 60
timeout-minutes: 120
if: >-
github.event_name == 'schedule' ||
@@ -459,14 +459,45 @@ jobs:
fail-fast: false
matrix:
include:
- suite: smoke
# - suite: part-1
# args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc,vault-storage --run-part 1"
- suite: part-2
args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc,vault-storage --run-part 2"
# - suite: part-3
# args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc,vault-storage --run-part 3"
# - suite: part-4
# args: "--type playwright --total-parts 4 --xsuites search,app-provider,ocm,keycloak,mfa,oidc,vault-storage --run-part 4"
# - suite: search
# args: "--type playwright --suites search"
# tika: true
# - suite: keycloak
# args: "--type playwright --suites journeys,keycloak"
# keycloak: true
# - suite: mfa
# args: "--type playwright --suites mfa"
# mfa: true
# - suite: oidc
# args: "--type playwright specs/oidc/refreshToken.spec.ts"
# oidc: true
# - suite: oidc-iframe
# args: "--type playwright specs/oidc/iframeTokenRenewal.spec.ts"
# oidc_iframe: true
- suite: app-provider
args: "--type playwright --suites app-provider"
collaboration: true
# - suite: ocm
# args: "--type playwright --suites ocm"
# federated: true
# - suite: vault-storage
# args: "--type playwright --suites vault-storage"
# vault_storage: true
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
# 24.16.0 breaks playwright install (yauzl zip extraction hangs); pin to last known good.
# https://github.com/microsoft/playwright/issues/40724
@@ -509,14 +540,84 @@ jobs:
run: make -C tests/config/k8s create-cluster
- name: Prepare Helm Charts
env:
ENABLE_WOPI: ${{ matrix.suite == 'app-provider' }}
run: make -C tests/config/k8s prepare-charts
- name: Deploy Suite-Specific External Backends
run: |
if [[ "${{ matrix.suite }}" == "app-provider" ]]; then
# Start Collabora
docker run -d \
--name collabora \
--network host \
--entrypoint bash \
-e DONT_GEN_SSL_CERT=set \
-e "extra_params=--o:ssl.enable=true --o:ssl.termination=true --o:welcome.enable=false --o:net.frame_ancestors=https://127.0.0.1:9200" \
collabora/code:25.04.7.3.1 \
-c "coolconfig generate-proof-key && bash /start-collabora-online.sh"
timeout 150 bash -c 'until curl -kfsSL https://localhost:9980/hosting/discovery > /dev/null; do sleep 5; done'
echo "collabora ready."
# Start OnlyOffice
docker run -d \
--name onlyoffice \
-p 7443:443 \
--add-host "$TEST_SERVER_DOMAIN:host-gateway" \
-e WOPI_ENABLED=true \
-e USE_UNAUTHORIZED_STORAGE=true \
-v "$(pwd)/tests/config/ci/only-office.json:/tmp/local.json:ro" \
--entrypoint /bin/sh \
onlyoffice/documentserver:9.2.1 \
-c "set -e
cp /tmp/local.json /etc/onlyoffice/documentserver/local.json
openssl req -x509 -newkey rsa:4096 -keyout onlyoffice.key -out onlyoffice.crt -sha256 -days 365 -batch -nodes
mkdir -p /var/www/onlyoffice/Data/certs
cp onlyoffice.key /var/www/onlyoffice/Data/certs/
cp onlyoffice.crt /var/www/onlyoffice/Data/certs/
chmod 400 /var/www/onlyoffice/Data/certs/onlyoffice.key
/app/ds/run-document-server.sh"
timeout 150 bash -c 'until curl -kfsSL https://localhost:7443/hosting/discovery > /dev/null; do sleep 5; done'
echo "onlyoffice ready."
#Start FakeOffice
docker run -d --name fakeoffice --network host \
-v "$(pwd):/ocis:ro" \
python:3-alpine \
python3 -c "
import http.server, pathlib
body = pathlib.Path('/ocis/tests/config/ci/hosting-discovery.xml').read_bytes()
class H(http.server.BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-Type', 'text/xml')
self.end_headers()
self.wfile.write(body)
def log_message(self, *a): pass
http.server.HTTPServer(('', 8080), H).serve_forever()
"
timeout 60 bash -c 'until curl -fsSL http://localhost:8080/hosting/discovery > /dev/null; do sleep 5; done'
echo "fakeoffice ready."
bash tests/config/k8s/expose-external-svc.sh collabora:9980
bash tests/config/k8s/expose-external-svc.sh onlyoffice:7443
bash tests/config/k8s/expose-external-svc.sh fakeoffice:8080
fi
- name: Deploy oCIS
run: |
cd tests/config/k8s
kubectl get pods -n "$TEST_SERVER_DOMAIN" -Aw &
make deploy-ocis
- name: Expose node ports
if: ${{ matrix.suite == 'app-provider' }}
run: |
bash tests/config/k8s/expose-nodeports.sh collaboration-collabora 9300 30300
bash tests/config/k8s/expose-nodeports.sh collaboration-fakeoffice 9300 30301
bash tests/config/k8s/expose-nodeports.sh collaboration-onlyoffice 9300 30302
bash tests/config/k8s/expose-nodeports.sh collaboration-fakeoffice 9304 30304
- name: Wait for oCIS to be ready
env:
FILE_URL: ${{ env.TEST_SERVER_URL }}/remote.php/dav/files/admin/hello1.txt
@@ -584,14 +685,15 @@ jobs:
- name: Run e2e ${{ matrix.suite }} tests
env:
E2E_ARGS: "--suites ${{ matrix.suite }}"
E2E_ARGS: "${{ matrix.args }}"
K8S: ${{ env.K8S }}
TEST_SERVER_URL: ${{ env.TEST_SERVER_URL }}
COLLABORATION_NEEDED: ${{ matrix.collaboration == true && 'true' || 'false' }}
run: python3 tests/acceptance/run-e2e.py
- name: Upload Playwright traces
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-traces-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
path: web/reports/e2e
@@ -599,7 +701,7 @@ jobs:
- name: Upload a11y result
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: playwright-a11y-result-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
path: web/reports/e2e/a11y-report.json
@@ -607,7 +709,7 @@ jobs:
- name: Upload oCIS logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: ocis-logs-${{ matrix.suite }}-k8s-${{ github.run_attempt }}
path: tests/config/k8s/logs
+1 -1
View File
@@ -29,7 +29,7 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.15.0
registry-url: "https://registry.npmjs.org"
+15 -186
View File
@@ -14,9 +14,6 @@ on:
default: ''
env:
PRODUCTION_RELEASE_TAGS: '5.0,7,8'
DOCKER_REPO_ROLLING: owncloud/ocis-rolling
DOCKER_REPO_PRODUCTION: owncloud/ocis
NODE_VERSION: '24'
PNPM_VERSION: '10.28.1'
GOLANG_BUILD_IMAGE: 'golang:1.26.8-alpine3.23@sha256:a8fa79c5bd40d880b52bd3b6d7669ecdcfd00e85facdd427d279efb5ddd79cb1'
@@ -27,9 +24,7 @@ jobs:
timeout-minutes: 10
outputs:
version: ${{ steps.info.outputs.version }}
is_production: ${{ steps.info.outputs.is_production }}
is_prerelease: ${{ steps.info.outputs.is_prerelease }}
docker_repos: ${{ steps.info.outputs.docker_repos }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
if: ${{ github.ref_type == 'branch' || (github.event_name == 'workflow_dispatch' && inputs.version_override == '') }}
@@ -75,23 +70,10 @@ jobs:
exit 1
fi
IS_PRODUCTION=false
for TAG in ${PRODUCTION_RELEASE_TAGS//,/ }; do
[[ "$VERSION" == "$TAG"* ]] && IS_PRODUCTION=true && break
done
[[ "$VERSION" == *"-"* ]] && IS_PRERELEASE=true || IS_PRERELEASE=false
if [[ "$IS_PRODUCTION" == "true" && "$IS_PRERELEASE" == "false" ]]; then
REPOS=[\"$DOCKER_REPO_ROLLING\",\"$DOCKER_REPO_PRODUCTION\"]
else
REPOS=[\"$DOCKER_REPO_ROLLING\"]
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "is_production=$IS_PRODUCTION" >> $GITHUB_OUTPUT
echo "is_prerelease=$IS_PRERELEASE" >> $GITHUB_OUTPUT
echo "docker_repos=$REPOS" >> $GITHUB_OUTPUT
generate-code:
runs-on: ubuntu-latest
@@ -102,7 +84,7 @@ jobs:
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
- run: npm install --silent -g yarn npx --force
@@ -119,7 +101,7 @@ jobs:
run: |
VERSION="${{ needs.determine-release-type.outputs.version }}"
sed -i "s/LatestTag = \".*\"/LatestTag = \"$VERSION\"/" ocis-pkg/version/version.go
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: generated-code
path: |
@@ -128,159 +110,6 @@ jobs:
!web
retention-days: 1
docker-build:
if: false
name: docker-build (${{ matrix.arch }}, ${{ matrix.repo }})
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }}
timeout-minutes: 120
needs: [determine-release-type, generate-code, security-scan-trivy]
strategy:
matrix:
arch: [amd64, arm64]
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: generated-code
path: .
- uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- id: goversion
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- run: |
ALPINE_VERSION=$(grep '^FROM.*alpine:' ocis/docker/Dockerfile.linux.${{ matrix.arch }} | grep -o 'alpine:[0-9.]*' | cut -d: -f2 | cut -d. -f1,2)
docker run --rm \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
"golang:${{ steps.goversion.outputs.go-version }}-alpine${ALPINE_VERSION}" \
sh -c "apk add --no-cache bash gcc musl-dev vips-dev make git && \
git config --global --add safe.directory /workspace && \
CGO_ENABLED=1 ENABLE_VIPS=true VERSION=${{ needs.determine-release-type.outputs.version }} \
make -C ocis release-linux-docker-${{ matrix.arch }}"
- id: tags
run: |
VERSION="${{ needs.determine-release-type.outputs.version }}"
REPO="${{ matrix.repo }}"
ARCH="${{ matrix.arch }}"
printf "tags<<EOF\n%s\nEOF\n" \
"${REPO}:${VERSION}-linux-${ARCH}" >> $GITHUB_OUTPUT
- id: build
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
context: ocis
file: ocis/docker/Dockerfile.linux.${{ matrix.arch }}
platforms: linux/${{ matrix.arch }}
load: true
push: false
provenance: false
build-args: |
REVISION=${{ github.sha }}
VERSION=${{ needs.determine-release-type.outputs.version }}
tags: ${{ steps.tags.outputs.tags }}
- id: trivy
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
continue-on-error: true
with:
image-ref: ${{ steps.tags.outputs.tags }}
format: table
exit-code: 1
severity: HIGH,CRITICAL
ignore-unfixed: true
skip-files: /usr/bin/gomplate,/usr/bin/wait-for
hide-progress: true
env:
TRIVY_IGNOREFILE: .trivyignore
- name: Block on vulnerabilities
if: steps.trivy.outcome == 'failure'
run: |
echo "::error title=Security scan blocked release::Image ${{ steps.tags.outputs.tags }} has HIGH or CRITICAL vulnerabilities (see Trivy report above). Fix all findings before releasing."
exit 1
- name: push
if: steps.trivy.outcome == 'success'
run: docker push ${{ steps.tags.outputs.tags }}
docker-scan:
name: docker-scan (${{ matrix.arch }}, ${{ matrix.repo }})
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [determine-release-type, docker-build]
strategy:
matrix:
arch: [amd64]
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
id: trivy
continue-on-error: true
with:
image-ref: ${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-${{ matrix.arch }}
format: table
exit-code: 1
severity: HIGH,CRITICAL
ignore-unfixed: true
skip-files: /usr/bin/gomplate,/usr/bin/wait-for
hide-progress: true
env:
TRIVY_IGNOREFILE: .trivyignore
- name: Block on vulnerabilities
if: steps.trivy.outcome == 'failure'
run: |
echo "::error title=Security scan blocked release::Image ${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-${{ matrix.arch }} has HIGH or CRITICAL vulnerabilities (see Trivy report above). Fix all findings before releasing."
exit 1
docker-manifest:
if: false
name: docker-manifest (${{ matrix.repo }})
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [determine-release-type, docker-build, docker-scan]
strategy:
matrix:
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
steps:
- uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- if: ${{ contains(matrix.repo, 'rolling') }}
run: |
docker buildx imagetools create \
-t "${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}" \
"${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-amd64" \
"${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-arm64"
- if: ${{ !contains(matrix.repo, 'rolling') }}
run: |
docker buildx imagetools create \
-t "${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}" \
"${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-amd64" \
"${{ matrix.repo }}:${{ needs.determine-release-type.outputs.version }}-linux-arm64"
docker-readme:
if: false
name: docker-readme (${{ matrix.repo }})
runs-on: ubuntu-latest
timeout-minutes: 15
needs: [determine-release-type, docker-manifest]
strategy:
matrix:
repo: ${{ fromJSON(needs.determine-release-type.outputs.docker_repos) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: peter-evans/dockerhub-description@1b9a80c056b620d92cedb9d9b5a223409c68ddfa # v5.0.0
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ matrix.repo }}
readme-filepath: ocis/README.md
build-binaries:
name: build-binaries (${{ matrix.os }})
runs-on: ubuntu-latest
@@ -291,7 +120,7 @@ jobs:
os: [linux, darwin]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: generated-code
path: .
@@ -304,7 +133,7 @@ jobs:
if [[ "${{ matrix.os }}" == "linux" ]]; then
cp assets/End-User-License-Agreement-for-ownCloud-Infinite-Scale.pdf ocis/dist/release/
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: binaries-${{ matrix.os }}
path: ocis/dist/release/*
@@ -329,11 +158,11 @@ jobs:
needs: [determine-release-type, generate-code]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: generated-code
path: .
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: ${{ env.NODE_VERSION }}
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
@@ -347,7 +176,7 @@ jobs:
- run: make ci-node-check-licenses && make ci-node-save-licenses
- run: make ci-go-check-licenses && make ci-go-save-licenses
- run: tar -czf third-party-licenses.tar.gz -C third-party-licenses .
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: third-party-licenses
path: third-party-licenses.tar.gz
@@ -371,7 +200,7 @@ jobs:
if [[ $(wc -l < ocis/dist/CHANGELOG.md) -lt 5 ]]; then
echo "Development release — no release notes yet. See [unreleased changes](https://github.com/owncloud/ocis/tree/master/changelog/unreleased/)." > ocis/dist/CHANGELOG.md
fi
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: changelog
path: ocis/dist/CHANGELOG.md
@@ -382,19 +211,19 @@ jobs:
timeout-minutes: 30
needs: [determine-release-type, build-binaries, license-check, generate-changelog, security-scan-trivy]
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: binaries-linux
path: release-assets
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: binaries-darwin
path: release-assets
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: third-party-licenses
path: release-assets
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: changelog
path: .
@@ -419,15 +248,15 @@ jobs:
- create-github-release
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: binaries-linux
path: release-assets
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: binaries-darwin
path: release-assets
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: third-party-licenses
path: release-assets
+1 -1
View File
@@ -77,7 +77,7 @@ jobs:
version: 10.33.3
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24.15.0
cache: pnpm
@@ -0,0 +1,13 @@
Bugfix: Fix AuthApp and basic auth requests with custom PROXY_USER_OIDC_CLAIM
We fixed AuthApp (app password) and HTTP basic auth requests returning an
internal server error whenever PROXY_USER_OIDC_CLAIM was set to anything
other than its default value. Both authenticators put the already
authenticated user directly into the request context instead of faking
incomplete claims for the account resolver to re-resolve. We also made sure
a user who only ever authenticates this way still gets a default role
assigned, and that these requests keep getting rejected on deployments with
multiple instances enabled, since neither carries tenant-membership
information.
https://github.com/owncloud/ocis/pull/13107
@@ -0,0 +1,20 @@
Bugfix: Record the acting user in the audit log's User field
The audit log's `User` field is documented as the UID of the user performing
the action, but the file and folder converters filled it from the event's
`Owner`, which reva does not set, so the field was empty on every upload,
download, move, delete, restore and version restore. Where an event did carry
an owner, `User` named the owner rather than the person acting, for example a
share recipient uploading into a shared folder. Space, user and group events
hard-coded the field to an empty string although every one of those events
carries the actor.
`User` is now taken from the event's `Executant` for all of these events. The
`Owner` field of file events is unchanged. The failed public-link access event
still has no actor and keeps an empty `User`.
While adding tests for the user and group events, the group member added and
removed messages turned out to pass the user and group ids in the wrong order,
naming the group as the user and the user as the group; that is fixed too.
https://github.com/owncloud/ocis/issues/4789
@@ -0,0 +1,9 @@
Bugfix: Show image preview for files with spaces in the name on public links
The preview in the details panel was not shown for files opened via a public
link when the file name contained spaces. The preview URL was used unquoted in a
CSS `url()`, so the browser dropped it and never requested the thumbnail. The
URL is now quoted.
https://github.com/owncloud/ocis/issues/13137
https://github.com/owncloud/ocis/pull/13150
@@ -0,0 +1,10 @@
Bugfix: Disable rubber-band overscroll of the page in file apps
Scrolling to the top or bottom of the content in a file app such as
OnlyOffice, Collabora or the text editor could make the whole page bounce
along with it, including the top bar and the app frame, briefly revealing the
blank page background behind them. The vertical elastic overscroll of the page
is now disabled while a file is open in one of these apps, so the surrounding
layout stays in place.
https://github.com/owncloud/ocis/pull/13140
@@ -0,0 +1,11 @@
Bugfix: Files no longer stay in processing after upload or copy
After uploading or copying files, some of them sometimes stayed greyed out as
"processing" until the page was reloaded. This happened when processing
finished while the file list was still being loaded: the update from the
server was ignored and the list then showed the file as still processing.
Files whose processing has finished are now refreshed automatically when they
show up in the file list as processing.
https://github.com/owncloud/ocis/pull/13134
@@ -0,0 +1,25 @@
Bugfix: Fix the LDAP master-ID filter when the base filter is empty
The function `EnhanceFilterWithMasterID` in `ocis-pkg/ldap/filter.go` adds a
master-ID clause to an LDAP filter with OR. An empty filter means "no
restriction". Before this fix, the function replaced an empty filter with a
master-ID-only filter. This action restricted an unrestricted search to
master-ID users only.
The bug broke the search for a user on another instance in multi-instance
deployments. This search uses the Graph API endpoint `/graph/v1.0/users`.
Multi-instance deployments use this search to find a user to share a resource
with.
Now the function keeps an empty filter unchanged. The function still adds a
master-ID clause to a filter that is not empty.
The `graph`, `auth-basic`, `users`, and `groups` services also use this
function to compute their default LDAP user filter when
`OCIS_MULTI_INSTANCE_MASTER_ID` is set. An empty user filter now means these
services resolve or authenticate every user in the shared LDAP directory,
not only master-ID users. Each of these services now rejects startup when
`OCIS_MULTI_INSTANCE_MASTER_ID` is set and its own user filter is empty.
Set an explicit `OCIS_LDAP_USER_FILTER` for every multi-instance deployment.
https://github.com/owncloud/ocis/pull/13100
@@ -0,0 +1,8 @@
Bugfix: Stop logging "no user in context" for data gateway requests
The proxy's create-home middleware logged an error for every request that
carried a reva token but no user. reva's internal downloads through the data
gateway (`/data`) are such requests, so every file download added an
error-level line. These requests are now passed on with a debug-level log.
https://github.com/owncloud/ocis/issues/13101
@@ -0,0 +1,10 @@
Bugfix: Show an error instead of "no deleted files" for inaccessible trash
Members of a space who are not allowed to list its trash, for example members
with the "Can edit" role, were told that the space has no deleted files, even
though files had been deleted. The trash view now tells the user that the
deleted files could not be loaded and that they might lack the permission to
view them. A trash that is really empty still shows the "no deleted files"
message.
https://github.com/owncloud/ocis/pull/13105
@@ -0,0 +1,10 @@
Bugfix: Clean up the trash view in the Safe
The trash offered a "Copy permanent link" action for deleted items, which
cannot be linked to. The action is no longer shown for deleted items.
The personal space in the trash was labelled "Personal" in the Safe, while the
rest of the interface calls it "Safe-Personal". The trash now uses the same
name.
https://github.com/owncloud/ocis/pull/13136
@@ -0,0 +1,8 @@
Bugfix: Show correct message when Safe access is denied for lacking permission
A user without permission to use the Safe who opened the Safe URL directly was
shown "Not logged in" with a "Log in again" button, even though they were
still logged in. The page now shows "Access denied" with a "Continue" button
that returns to the app for this case.
https://github.com/owncloud/ocis/pull/13111
@@ -0,0 +1,13 @@
Bugfix: Fix file and folder downloads in vault mode
Downloading a file in the vault failed with a 403 error. A download uses a
signed link without a login token. Thus the proxy uses the stored MFA status of
the user. The proxy did not store this status. Now the proxy stores it after it
knows the user. A download is accepted if the user had a request with MFA within
the MFA session duration.
Downloading a folder or several files in the vault failed with a 404 error. In
vault mode, the web UI requested the signing key from a wrong address. Now the
web UI uses the correct address.
https://github.com/owncloud/ocis/pull/13097
@@ -0,0 +1,13 @@
Change: Remove the MFA session extension popup in vault mode
In vault mode, the web UI showed a popup shortly before the multi-factor
authentication session was about to expire, offering to extend or dismiss it.
Extending only reset a timer in the browser and did not renew anything on the
server, so the popup has been removed.
The frontend service no longer exposes the MFA session duration in its
capabilities, and its `session_duration` setting has been removed. The
`OCIS_MFA_SESSION_DURATION` environment variable is still used by the proxy
service.
https://github.com/owncloud/ocis/pull/13085
@@ -0,0 +1,12 @@
Enhancement: Record tag changes in the audit log
Adding or removing tags on a file or folder left no trace in the audit log.
The graph service already publishes `TagsAdded` and `TagsRemoved` events for
every change, but only the search service listened to them.
The audit service now records both: `file_tags_add` and `file_tags_remove`
entries carry the acting user, the file id and path, the space owner and the
tags concerned. The graph service also sets the timestamp on the two events,
which it left empty before.
https://github.com/owncloud/ocis/issues/13054
@@ -0,0 +1,13 @@
Enhancement: Add a --timeout flag to the search index command
`ocis search index` called the search service with a fixed 10 minute request
timeout. The service walks the whole space inside that request, so once the
timeout expired the walk was cancelled with "error walking the tree: context
canceled" and everything after that point stayed unindexed. A space whose
walk takes longer than ten minutes, for example because the content extractor
is slow on a few files, could never be fully indexed from the command line.
The timeout is now a flag. `--timeout` takes a duration (default `10m`, so the
behaviour is unchanged out of the box); `0` waits indefinitely.
https://github.com/owncloud/ocis/issues/13052
+12 -12
View File
@@ -23,9 +23,9 @@ require (
github.com/gabriel-vasile/mimetype v1.4.15
github.com/ggwhite/go-masker v1.1.0
github.com/go-chi/chi/v5 v5.3.2
github.com/go-chi/httprate v0.16.0
github.com/go-chi/httprate v0.16.1
github.com/go-chi/render v1.0.3
github.com/go-ldap/ldap/v3 v3.4.14
github.com/go-ldap/ldap/v3 v3.4.15
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3
github.com/go-micro/plugins/v4/client/grpc v1.2.1
github.com/go-micro/plugins/v4/logger/zerolog v1.2.0
@@ -58,7 +58,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/mna/pigeon v1.3.0
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/nats-io/nats-server/v2 v2.15.0
github.com/nats-io/nats-server/v2 v2.15.1
github.com/nats-io/nats.go v1.54.0
github.com/olekukonko/tablewriter v1.1.5
github.com/onsi/ginkgo v1.16.5
@@ -67,10 +67,10 @@ require (
github.com/open-policy-agent/opa v1.21.1
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245
github.com/owncloud/reva/v2 v2.0.0-20261007144855-b8082819aa39
github.com/owncloud/reva/v2 v2.0.0-20261012083840-8b649a4c3899
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.12
github.com/prometheus/client_golang v1.24.1
github.com/prometheus/client_golang v1.25.0
github.com/r3labs/sse/v2 v2.10.0
github.com/rogpeppe/go-internal v1.16.0
github.com/rs/cors v1.11.1
@@ -82,7 +82,7 @@ require (
github.com/stretchr/testify v1.12.1
github.com/test-go/testify v1.1.4
github.com/thejerf/suture/v4 v4.0.6
github.com/tidwall/gjson v1.19.1
github.com/tidwall/gjson v1.20.0
github.com/tus/tusd/v2 v2.10.1
github.com/unrolled/secure v1.17.0
github.com/urfave/cli/v2 v2.27.7
@@ -90,7 +90,7 @@ require (
go-micro.dev/v4 v4.11.0
go.etcd.io/bbolt v1.5.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0
go.opentelemetry.io/contrib/zpages v0.72.0
go.opentelemetry.io/otel v1.47.0
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
@@ -100,9 +100,9 @@ require (
golang.org/x/crypto v0.57.0
golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba
golang.org/x/image v0.46.0
golang.org/x/net v0.59.0
golang.org/x/net v0.60.0
golang.org/x/oauth2 v0.37.0
golang.org/x/sync v0.23.0
golang.org/x/sync v0.24.0
golang.org/x/term v0.46.0
golang.org/x/text v0.42.0
google.golang.org/genproto/googleapis/api v0.0.0-20260928230214-8a89bd6388cc
@@ -238,7 +238,7 @@ require (
github.com/json-iterator/go v1.1.13-0.20220915233716-71ac16282d12 // indirect
github.com/juliangruber/go-intersect v1.1.0 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/klauspost/compress v1.20.0 // indirect
github.com/klauspost/compress v1.20.1 // indirect
github.com/klauspost/cpuid/v2 v2.4.0 // indirect
github.com/klauspost/crc32 v1.3.0 // indirect
github.com/kovidgoyal/go-parallel v1.1.1 // indirect
@@ -292,8 +292,8 @@ require (
github.com/pquerna/cachecontrol v0.2.0 // indirect
github.com/prometheus/alertmanager v0.34.1 // indirect
github.com/prometheus/client_model v0.6.3 // indirect
github.com/prometheus/common v0.70.1 // indirect
github.com/prometheus/procfs v0.21.1 // indirect
github.com/prometheus/common v0.72.0 // indirect
github.com/prometheus/procfs v0.22.0 // indirect
github.com/prometheus/statsd_exporter v0.22.8 // indirect
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
github.com/rs/xid v1.6.0 // indirect
+24 -24
View File
@@ -288,8 +288,8 @@ github.com/go-asn1-ber/asn1-ber v1.5.8 h1:H9AZkK22UOmfX8J84ubyaZxKJZ3FMHVwn8swoM
github.com/go-asn1-ber/asn1-ber v1.5.8/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi/v5 v5.3.2 h1:5YQkICvTCSZ25hoRsyJazN0scjzKGiu4VAUc7H1o1nY=
github.com/go-chi/chi/v5 v5.3.2/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-chi/httprate v0.16.0 h1:8V5DH9j6pSK6UQoBsTpvMyFxycqaKEIToyPKzHJjUa8=
github.com/go-chi/httprate v0.16.0/go.mod h1:A8lo+qRhk+s9LiuP5saS7XCGDXRXMcrueq0NfIuCa/I=
github.com/go-chi/httprate v0.16.1 h1:q2M8FmDsI4oEr1oRX43N+VeA0Ujd1tb/EasrSzXy87o=
github.com/go-chi/httprate v0.16.1/go.mod h1:A8lo+qRhk+s9LiuP5saS7XCGDXRXMcrueq0NfIuCa/I=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
github.com/go-chi/render v1.0.3/go.mod h1:/gr3hVkmYR0YlEy3LxCuVRFzEu9Ruok+gFqbIofjao0=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
@@ -315,8 +315,8 @@ github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBj
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-ldap/ldap/v3 v3.1.7/go.mod h1:5Zun81jBTabRaI8lzN7E1JjyEl1g6zI6u9pd8luAK4Q=
github.com/go-ldap/ldap/v3 v3.4.14 h1:D6PYdEgsaVzsXyr6w/yDC06Ria4uUhWm+Rb+er8lfAs=
github.com/go-ldap/ldap/v3 v3.4.14/go.mod h1:S4eJUMUNjDkE0ZJtIZdybwyb03sGGLW6gxXT1Hs8VKA=
github.com/go-ldap/ldap/v3 v3.4.15 h1:eRB4f4Ecn1POL1mO86+uUDlecmyWsdiJwh60bAUS4UY=
github.com/go-ldap/ldap/v3 v3.4.15/go.mod h1:jeD0c98EdZQCKKKKe4kTWs5aCf6y+j8KuYsYLznZSQk=
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3 h1:sfz1YppV05y4sYaW7kXZtrocU/+vimnIWt4cxAYh7+o=
github.com/go-ldap/ldif v0.0.0-20200320164324-fd88d9b715b3/go.mod h1:ZXFhGda43Z2TVbfGZefXyMJzsDHhCh0go3bZUcwTx7o=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
@@ -573,8 +573,8 @@ github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4
github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.20.0 h1:a3C1ke2ohxFymNlb2HWAHjDeKCI90scRskErZkR0ezA=
github.com/klauspost/compress v1.20.0/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ=
github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw=
github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU=
@@ -696,8 +696,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt/v2 v2.8.2 h1:XXRgB60MSTnqsRwejQurVDs/hcv2dkt+86GjI+I/bMc=
github.com/nats-io/jwt/v2 v2.8.2/go.mod h1:Ag/56sq9OblL4JgdYufDd16Egb17Kr/8WwwuO/forVc=
github.com/nats-io/nats-server/v2 v2.15.0 h1:M99yf0y05rTr46/qc/Is6ZAowI58Ryp2SjufLCUeVJc=
github.com/nats-io/nats-server/v2 v2.15.0/go.mod h1:5qLF4CDGzZVFt//3fUrY1ePpwbi05r7QHPNroSUtolk=
github.com/nats-io/nats-server/v2 v2.15.1 h1:fK3AeYFIji1Smng60jB0hVoAPZezA/UzsaI3BqXFNEI=
github.com/nats-io/nats-server/v2 v2.15.1/go.mod h1:yeuYRtKVKIFtmMz2/YPk+6hvmNBnk+WwTUzErBdH6IE=
github.com/nats-io/nats.go v1.54.0 h1:vsXoOxjHp/GmPUN+EcI7uOf/uB+iAP+kEsAFNQN0yzA=
github.com/nats-io/nats.go v1.54.0/go.mod h1:y+DZoD1oBOYfZTU681eTUiUjI0vbqYGixNVFHcjHJ0k=
github.com/nats-io/nkeys v0.4.16 h1:rd5oAuLOb8mnAycB0xleuEBNS1pVVnN0fv/FF34Eypg=
@@ -736,8 +736,8 @@ github.com/orcaman/concurrent-map v1.0.0 h1:I/2A2XPCb4IuQWcQhBhSwGfiuybl/J0ev9HD
github.com/orcaman/concurrent-map v1.0.0/go.mod h1:Lu3tH6HLW3feq74c2GC+jIMS/K2CFcDWnWD9XkenwhI=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245 h1:JRidLTAKhnvyLMRtVtSF4lhBa0NSAOs6fof+d6JnKII=
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260216101009-eeac018af245/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
github.com/owncloud/reva/v2 v2.0.0-20261007144855-b8082819aa39 h1:lC5Y4C3/i0uDhMLA53+kfDJg919gNbjSe2+FiViP3XM=
github.com/owncloud/reva/v2 v2.0.0-20261007144855-b8082819aa39/go.mod h1:cgqg+UTe4ekjMbJj8hgoXSTxQ9fQramKcOUdvsFUrzc=
github.com/owncloud/reva/v2 v2.0.0-20261012083840-8b649a4c3899 h1:IMu076AtnFEdabpBbowcGDYOeFLtm9ycNY1Z43YPYZU=
github.com/owncloud/reva/v2 v2.0.0-20261012083840-8b649a4c3899/go.mod h1:cgqg+UTe4ekjMbJj8hgoXSTxQ9fQramKcOUdvsFUrzc=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pablodz/inotifywaitgo v0.0.12 h1:DVJJTFMDlSAdO46yisPF2vzozs/r+4k6ih8MVghq78M=
@@ -777,8 +777,8 @@ github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqr
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ=
github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU=
github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE=
github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0=
github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk=
github.com/prometheus/client_model v0.0.0-20170216185247-6f3806018612/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -793,8 +793,8 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
github.com/prometheus/common v0.70.1 h1:1HvjP4D5oL3t8RsPlwxA9onvvStjtIHYE5XuuwOi/PY=
github.com/prometheus/common v0.70.1/go.mod h1:VdFUQDMZK3VLkurFUVhia6uys/0suUp86TJz5qbJRhc=
github.com/prometheus/common v0.72.0 h1:tAYsE+sPJxIncDAobm4H5aQjmox9ZxEIIqPbiffa8G4=
github.com/prometheus/common v0.72.0/go.mod h1:77NWqAQ2tXT7BIK40qjJdw5Acrsrg1TlHAnsQi3i6mk=
github.com/prometheus/procfs v0.0.0-20170703101242-e645f4e5aaa8/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -802,8 +802,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/prometheus/procfs v0.21.1 h1:GljZCt+zSTS+NZq88cyQ1LjZ+RCHp3uVuabBWA5+OJI=
github.com/prometheus/procfs v0.21.1/go.mod h1:aB55Cww9pdSJVHk0hUf0inxWyyjPogFIjmHKYgMKmtY=
github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics=
github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58=
github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI=
github.com/prometheus/statsd_exporter v0.22.8 h1:Qo2D9ZzaQG+id9i5NYNGmbf1aa/KxKbB9aKfMS+Yib0=
github.com/prometheus/statsd_exporter v0.22.8/go.mod h1:/DzwbTEaFTE0Ojz5PqcSk6+PFHOPWGxdXVr6yC8eFOM=
@@ -891,8 +891,8 @@ github.com/thanhpk/randstr v1.0.6 h1:psAOktJFD4vV9NEVb3qkhRSMvYh4ORRaj1+w/hn4B+o
github.com/thanhpk/randstr v1.0.6/go.mod h1:M/H2P1eNLZzlDwAzpkkkUvoyNNMbzRGhESZuEQk3r0U=
github.com/thejerf/suture/v4 v4.0.6 h1:QsuCEsCqb03xF9tPAsWAj8QOAJBgQI1c0VqJNaingg8=
github.com/thejerf/suture/v4 v4.0.6/go.mod h1:gu9Y4dXNUWFrByqRt30Rm9/UZ0wzRSt9AJS6xu/ZGxU=
github.com/tidwall/gjson v1.19.1 h1:uKxUTe/+mtjSY3Sf1EIND83MyH+jWf1SixZ7DHpjbJU=
github.com/tidwall/gjson v1.19.1/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc=
github.com/tidwall/gjson v1.20.0 h1:+agJ3rEzKcCXKDKo0ml26UROcpcAlnZyjq+TjbY5Fto=
github.com/tidwall/gjson v1.20.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
@@ -968,8 +968,8 @@ go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ
go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0 h1:Tq+E65HaNbZTeqcLw6QUhsV+/EIWdkfUH2CQzcrlE5M=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.72.0/go.mod h1:A+EVhDakAj1waJBPhmTszZaSr08ww8MRRKy1nB1rqck=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 h1:3g7B90UzBltIDKq1/5mrTGxTnOFDV0ICOhLoxiZ8jlg=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0/go.mod h1:Ef8SuTh59BT7+ofpDxN9z+yOlc4t2GjLmKDgYNJL/NU=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0 h1:LxwW/9ctSCv+QkE/cLR7M91ZIkXNMqJtEMi1vCw9U8s=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.72.0/go.mod h1:tOsftB4SslBwwErVEPaenU2RpThXWPIU8DoJHEC4dyw=
go.opentelemetry.io/contrib/zpages v0.72.0 h1:aXBUaFvbF7xy77q6vXBvaw7dcZK0zUqJSF5UhtbbuZ4=
go.opentelemetry.io/contrib/zpages v0.72.0/go.mod h1:e/qIKK0RHtY2dvkJhp1jtjVvglq/IDzMI7gDN8mMMtY=
go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM=
@@ -1102,8 +1102,8 @@ golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues=
golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU=
golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -1127,8 +1127,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA=
golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+6 -11
View File
@@ -7,14 +7,13 @@ import (
"github.com/go-ldap/ldap/v3"
)
// EnhanceFilterWithMasterID OR's the given LDAP filter with master-id match clauses.
// Returns filter unchanged when masterID is empty or both attributes are empty.
// EnhanceFilterWithMasterID adds master-ID match clauses to the given LDAP filter with OR.
// An empty filter means "no restriction". Do not OR an empty filter with a master-ID clause.
// This action would restrict an unrestricted search to the master ID only.
// The function returns the filter without a change when masterID is empty, when both
// attributes are empty, or when filter is empty.
func EnhanceFilterWithMasterID(filter, masterID, memberAttr, guestAttr string) string {
if masterID == "" {
return filter
}
if memberAttr == "" && guestAttr == "" {
if masterID == "" || (memberAttr == "" && guestAttr == "") || filter == "" {
return filter
}
@@ -35,9 +34,5 @@ func EnhanceFilterWithMasterID(filter, masterID, memberAttr, guestAttr string) s
masterIDFilter = fmt.Sprintf("(|%s)", strings.Join(masterIDParts, ""))
}
if filter == "" {
return masterIDFilter
}
return fmt.Sprintf("(|%s%s)", filter, masterIDFilter)
}
+2 -2
View File
@@ -54,12 +54,12 @@ func TestEnhanceFilterWithMasterID(t *testing.T) {
expectedFilter: "(|(ownCloudGuestOf=instance-1)(ownCloudGuestOf=0000-0000-000-0000))",
},
{
name: "empty existing filter",
name: "empty existing filter stays unrestricted",
filter: "",
masterID: "0000-0000-000-0000",
memberAttr: "ownCloudMemberOf",
guestAttr: "ownCloudGuestOf",
expectedFilter: "(|(ownCloudMemberOf=0000-0000-000-0000)(ownCloudGuestOf=0000-0000-000-0000))",
expectedFilter: "",
},
{
name: "LDAP injection protection",
+7
View File
@@ -46,6 +46,13 @@ func MissingLDAPBindPassword(service string) error {
service, defaults.BaseConfigPath())
}
func MissingLDAPUserFilterForMasterID(service string) error {
return fmt.Errorf("The ldap user_filter has not been set for %s, but OCIS_MULTI_INSTANCE_MASTER_ID is set. "+
"Set an explicit user_filter to scope this instance to its own users. "+
"Without a user_filter, every user in the shared LDAP directory can access this instance.",
service)
}
func MissingServiceUserPassword(service, serviceUser string) error {
return fmt.Errorf("The password of service user %s has not been set properly in your config for %s. "+
"Make sure your %s config contains the proper values "+
+5 -5
View File
@@ -54,8 +54,8 @@ type GRPCClientOptions struct {
// which read them independently of each other but apply the same rules, so both behave
// identically for every input. Keepalive is off unless the time is set to a duration that
// parses; a value without a unit suffix leaves the clients without pings.
GRPCClientKeepaliveTime time.Duration `yaml:"grpc_client_keepalive_time" env:"GRPC_CLIENT_KEEPALIVE_TIME" desc:"How long a grpc client connection with an ongoing request may stay silent before the server is pinged to check whether it is still answering. Set a duration like '20s' to enable detection of unresponsive peers. Leaving it unset, or at '0', sends no pings at all, which is grpc's own default. Values below '10s' are raised to '10s' by grpc. Make sure to include the unit suffix, a bare number is not a valid duration." introductionVersion:"8.3.0"`
GRPCClientKeepaliveTimeout time.Duration `yaml:"grpc_client_keepalive_timeout" env:"GRPC_CLIENT_KEEPALIVE_TIMEOUT" desc:"How long a grpc client waits for the answer to a keepalive ping before it considers the connection dead and fails all requests on it. Defaults to '10s'. Has no effect unless GRPC_CLIENT_KEEPALIVE_TIME is set. See GRPC_CLIENT_KEEPALIVE_TIME." introductionVersion:"8.3.0"`
GRPCClientKeepaliveTime time.Duration `yaml:"grpc_client_keepalive_time" env:"GRPC_CLIENT_KEEPALIVE_TIME" desc:"How long a grpc client connection with an ongoing request may stay silent before the server is pinged to check whether it is still answering. Set a duration like '20s' to enable detection of unresponsive peers. Leaving it unset, or at '0', sends no pings at all, which is grpc's own default. Values below '10s' are raised to '10s' by grpc. Make sure to include the unit suffix, a bare number is not a valid duration." introductionVersion:"9.0.0"`
GRPCClientKeepaliveTimeout time.Duration `yaml:"grpc_client_keepalive_timeout" env:"GRPC_CLIENT_KEEPALIVE_TIMEOUT" desc:"How long a grpc client waits for the answer to a keepalive ping before it considers the connection dead and fails all requests on it. Defaults to '10s'. Has no effect unless GRPC_CLIENT_KEEPALIVE_TIME is set. See GRPC_CLIENT_KEEPALIVE_TIME." introductionVersion:"9.0.0"`
}
type GRPCServiceTLS struct {
@@ -80,9 +80,9 @@ type Cache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the NATS store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the NATS store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate used to validate the NATS store TLS certificate. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the NATS store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the NATS store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate used to validate the NATS store TLS certificate. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
+3 -3
View File
@@ -55,9 +55,9 @@ type Store struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;ACTIVITYLOG_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;ACTIVITYLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;ACTIVITYLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;ACTIVITYLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;ACTIVITYLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;ACTIVITYLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;ACTIVITYLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;ACTIVITYLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;ACTIVITYLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// ServiceAccount is the configuration for the used service account
+2
View File
@@ -2,6 +2,8 @@
The audit service logs all events of the system as an audit log. Per default, it will be logged to standard out, but can also be configured to a file output. Supported log formats are json or a minimal human-readable format.
Besides shares, links, files, spaces, users and groups, tag changes are recorded: adding tags to a file or folder is logged as `file_tags_add` and removing them as `file_tags_remove`, each with the acting user, the file id and the tags as requested. The request is recorded as made: a tag that was already present (or, for a removal, absent) is still listed, so repeated requests remain visible.
With audit logs, you are able to prove compliance with corporate guidelines as well as to enable reporting and auditing of operations. The audit service takes note of actions conducted by users and administrators.
Example minimal format:
+4
View File
@@ -83,6 +83,10 @@ func StartAuditLogger(ctx context.Context, ch <-chan events.Event, log log.Logge
auditEvent = types.ItemRestored(ev)
case events.FileVersionRestored:
auditEvent = types.FileVersionRestored(ev)
case events.TagsAdded:
auditEvent = types.TagsAdded(ev)
case events.TagsRemoved:
auditEvent = types.TagsRemoved(ev)
case events.SpaceCreated:
auditEvent = types.SpaceCreated(ev)
case events.SpaceRenamed:
+108 -22
View File
@@ -325,7 +325,7 @@ var testCases = []struct {
Event: events.FileUploaded{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
@@ -335,7 +335,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' created file 'pro-1$sto-123!iid-123/item'", "file_create")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
},
}, {
Alias: "File read",
@@ -343,7 +343,7 @@ var testCases = []struct {
Event: events.FileDownloaded{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
@@ -353,7 +353,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' read file 'pro-1$sto-123!iid-123/item'", "file_read")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
},
}, {
Alias: "File trashed",
@@ -361,7 +361,7 @@ var testCases = []struct {
Event: events.ItemTrashed{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
@@ -371,7 +371,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' trashed file 'pro-1$sto-123!iid-123/item'", "file_delete")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
},
}, {
Alias: "File renamed",
@@ -380,7 +380,7 @@ var testCases = []struct {
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
OldReference: reference("pro-1", "sto-123", "iid-123", "./anotheritem"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
@@ -390,7 +390,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' moved file 'pro-1$sto-123!iid-123/item' from './anotheritem' to './item'", "file_rename")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
// AuditEventFileRenamed fields
require.Equal(t, "./anotheritem", ev.OldPath)
@@ -401,7 +401,7 @@ var testCases = []struct {
Event: events.ItemPurged{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
@@ -411,7 +411,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' removed file 'pro-1$sto-123!iid-123/item' from trashbin", "file_trash_delete")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
},
}, {
Alias: "File restored",
@@ -419,7 +419,7 @@ var testCases = []struct {
Event: events.ItemRestored{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
OldReference: reference("pro-1", "sto-123", "sto-123!iid-123/item", "./oldpath"),
Key: "",
},
@@ -431,7 +431,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' restored file 'pro-1$sto-123!iid-123/item' from trashbin to './item'", "file_trash_restore")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
// AuditEventFileRestored fields
require.Equal(t, "./oldpath", ev.OldPath)
@@ -442,7 +442,7 @@ var testCases = []struct {
Event: events.FileVersionRestored{
Executant: userID("uid-123"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Owner: userID("uid-123"), // NOTE: owner not yet implemented in reva
Owner: userID("uid-owner"),
Key: "v1",
},
},
@@ -453,7 +453,7 @@ var testCases = []struct {
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' restored file 'pro-1$sto-123!iid-123/item' in version 'v1'", "file_version_restore")
// AuditEventSharing fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-123", "./item")
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
// AuditEventFileRestored fields
require.Equal(t, "v1", ev.Key)
@@ -464,7 +464,7 @@ var testCases = []struct {
Event: events.SpaceCreated{
Executant: userID("uid-123"),
ID: &provider.StorageSpaceId{OpaqueId: "storage-1$space-123"},
Owner: userID("uid-123"),
Owner: userID("uid-owner"),
Root: resourceID("pro-1", "sto-123", "iid-123"),
Name: "test-space",
Type: "project",
@@ -477,11 +477,11 @@ var testCases = []struct {
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "", "2286-11-20T17:46:40Z", "user 'uid-123' created a space 'space-123' with name 'test-space' (storage: 'storage-1')", "space_created")
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "2286-11-20T17:46:40Z", "user 'uid-123' created a space 'space-123' with name 'test-space' (storage: 'storage-1')", "space_created")
// AuditEventSpaces fields
checkSpacesAuditEvent(t, ev.AuditEventSpaces, "storage-1$space-123")
// AuditEventFileRestored fields
require.Equal(t, "uid-123", ev.Owner)
require.Equal(t, "uid-owner", ev.Owner)
require.Equal(t, "pro-1$sto-123!iid-123", ev.RootItem)
require.Equal(t, "test-space", ev.Name)
require.Equal(t, "project", ev.Type)
@@ -492,7 +492,7 @@ var testCases = []struct {
Event: events.SpaceRenamed{
Executant: userID("uid-123"),
ID: &provider.StorageSpaceId{OpaqueId: "storage-1$space-123"},
Owner: userID("uid-123"),
Owner: userID("uid-owner"),
Name: "new-name",
},
},
@@ -501,7 +501,7 @@ var testCases = []struct {
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "", "", "user 'uid-123' renamed space 'space-123' to 'new-name' (storage: 'storage-1')", "space_renamed")
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' renamed space 'space-123' to 'new-name' (storage: 'storage-1')", "space_renamed")
// AuditEventSpaces fields
checkSpacesAuditEvent(t, ev.AuditEventSpaces, "storage-1$space-123")
// AuditEventSpaceRenamed fields
@@ -520,7 +520,7 @@ var testCases = []struct {
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "", "0001-01-01T00:00:00Z", "user 'uid-123' disabled the space 'space-123' (storage: 'storage-1')", "space_disabled")
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "0001-01-01T00:00:00Z", "user 'uid-123' disabled the space 'space-123' (storage: 'storage-1')", "space_disabled")
// AuditEventSpaces fields
checkSpacesAuditEvent(t, ev.AuditEventSpaces, "storage-1$space-123")
},
@@ -537,7 +537,7 @@ var testCases = []struct {
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "", "", "user 'uid-123' (re-) enabled the space 'space-123' (storage: 'storage-1')", "space_enabled")
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "", "user 'uid-123' (re-) enabled the space 'space-123' (storage: 'storage-1')", "space_enabled")
// AuditEventSpaces fields
checkSpacesAuditEvent(t, ev.AuditEventSpaces, "storage-1$space-123")
},
@@ -555,7 +555,7 @@ var testCases = []struct {
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields
checkBaseAuditEvent(t, ev.AuditEvent, "", "0001-01-01T00:00:00Z", "user 'uid-123' deleted the space 'space-123' with name 'test-space' (storage: 'storage-1')", "space_deleted")
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "0001-01-01T00:00:00Z", "user 'uid-123' deleted the space 'space-123' with name 'test-space' (storage: 'storage-1')", "space_deleted")
// AuditEventSpaces fields
checkSpacesAuditEvent(t, ev.AuditEventSpaces, "storage-1$space-123")
},
@@ -587,6 +587,92 @@ var testCases = []struct {
require.Equal(t, "http://ocis.test/invite", ev.InviteLink)
},
},
{
Alias: "User created",
SystemEvent: events.Event{
Event: events.UserCreated{
Executant: userID("uid-admin"),
UserID: "uid-new",
Timestamp: timestamp(10e8),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
ev := types.AuditEventUserCreated{}
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields: User is the actor, not the affected user
checkBaseAuditEvent(t, ev.AuditEvent, "uid-admin", "2001-09-09T01:46:40Z", "user 'uid-admin' created the user 'uid-new'", "user_created")
// AuditEventUserCreated fields
require.Equal(t, "uid-new", ev.UserID)
},
},
{
Alias: "Group member added",
SystemEvent: events.Event{
Event: events.GroupMemberAdded{
Executant: userID("uid-admin"),
GroupID: "gid-123",
UserID: "uid-member",
Timestamp: timestamp(10e8),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
ev := types.AuditEventGroupMemberAdded{}
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields: User is the actor, not the member
checkBaseAuditEvent(t, ev.AuditEvent, "uid-admin", "2001-09-09T01:46:40Z", "user 'uid-admin' added user 'uid-member' was added to group 'gid-123'", "group_member_added")
// AuditEventGroupMemberAdded fields
require.Equal(t, "gid-123", ev.GroupID)
require.Equal(t, "uid-member", ev.UserID)
},
},
{
Alias: "Tags added",
SystemEvent: events.Event{
Event: events.TagsAdded{
Executant: userID("uid-123"),
SpaceOwner: userID("uid-owner"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Tags: "holiday,family",
Timestamp: timestamp(10e8),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
ev := types.AuditEventTagsAdded{}
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields: User is the actor, Owner the space owner
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "2001-09-09T01:46:40Z", "user 'uid-123' added tags 'holiday,family' to file 'pro-1$sto-123!iid-123/item'", "file_tags_add")
// AuditEventFiles fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
// AuditEventTagsAdded fields
require.Equal(t, "holiday,family", ev.Tags)
},
},
{
Alias: "Tags removed",
SystemEvent: events.Event{
Event: events.TagsRemoved{
Executant: userID("uid-123"),
SpaceOwner: userID("uid-owner"),
Ref: reference("pro-1", "sto-123", "iid-123", "./item"),
Tags: "holiday",
Timestamp: timestamp(10e8),
},
},
CheckAuditEvent: func(t *testing.T, b []byte) {
ev := types.AuditEventTagsRemoved{}
require.NoError(t, json.Unmarshal(b, &ev))
// AuditEvent fields: User is the actor, Owner the space owner
checkBaseAuditEvent(t, ev.AuditEvent, "uid-123", "2001-09-09T01:46:40Z", "user 'uid-123' removed tags 'holiday' from file 'pro-1$sto-123!iid-123/item'", "file_tags_remove")
// AuditEventFiles fields
checkFilesAuditEvent(t, ev.AuditEventFiles, "pro-1$sto-123!iid-123/item", "uid-owner", "./item")
// AuditEventTagsRemoved fields
require.Equal(t, "holiday", ev.Tags)
},
},
}
func TestAuditLogging(t *testing.T) {
+49 -25
View File
@@ -247,7 +247,7 @@ func FilesAuditEvent(base AuditEvent, itemid, owner, path string) AuditEventFile
// ContainerCreated converts a ContainerCreated event to an AuditEventContainerCreated
func ContainerCreated(ev events.ContainerCreated) AuditEventContainerCreated {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageContainerCreated(ev.Executant.GetOpaqueId(), iid), ActionContainerCreated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageContainerCreated(ev.Executant.GetOpaqueId(), iid), ActionContainerCreated)
return AuditEventContainerCreated{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
}
@@ -256,7 +256,7 @@ func ContainerCreated(ev events.ContainerCreated) AuditEventContainerCreated {
// FileUploaded converts a FileUploaded event to an AuditEventFileCreated
func FileUploaded(ev events.FileUploaded) AuditEventFileCreated {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileCreated(ev.Executant.GetOpaqueId(), iid), ActionFileCreated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileCreated(ev.Executant.GetOpaqueId(), iid), ActionFileCreated)
return AuditEventFileCreated{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
}
@@ -265,7 +265,7 @@ func FileUploaded(ev events.FileUploaded) AuditEventFileCreated {
// FileDownloaded converts a FileDownloaded event to an AuditEventFileRead
func FileDownloaded(ev events.FileDownloaded) AuditEventFileRead {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileRead(ev.Executant.GetOpaqueId(), iid), ActionFileRead)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileRead(ev.Executant.GetOpaqueId(), iid), ActionFileRead)
return AuditEventFileRead{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
}
@@ -280,7 +280,7 @@ func ItemMoved(ev events.ItemMoved) AuditEventFileRenamed {
oldpath = ev.OldReference.GetPath()
}
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileRenamed(ev.Executant.GetOpaqueId(), iid, oldpath, path), ActionFileRenamed)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileRenamed(ev.Executant.GetOpaqueId(), iid, oldpath, path), ActionFileRenamed)
return AuditEventFileRenamed{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
OldPath: oldpath,
@@ -290,7 +290,7 @@ func ItemMoved(ev events.ItemMoved) AuditEventFileRenamed {
// ItemTrashed converts a ItemTrashed event to an AuditEventFileDeleted
func ItemTrashed(ev events.ItemTrashed) AuditEventFileDeleted {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileTrashed(ev.Executant.GetOpaqueId(), iid), ActionFileTrashed)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileTrashed(ev.Executant.GetOpaqueId(), iid), ActionFileTrashed)
return AuditEventFileDeleted{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
}
@@ -299,7 +299,7 @@ func ItemTrashed(ev events.ItemTrashed) AuditEventFileDeleted {
// ItemPurged converts a ItemPurged event to an AuditEventFilePurged
func ItemPurged(ev events.ItemPurged) AuditEventFilePurged {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFilePurged(ev.Executant.GetOpaqueId(), iid), ActionFilePurged)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFilePurged(ev.Executant.GetOpaqueId(), iid), ActionFilePurged)
return AuditEventFilePurged{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
}
@@ -314,7 +314,7 @@ func ItemRestored(ev events.ItemRestored) AuditEventFileRestored {
oldpath = ev.OldReference.GetPath()
}
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileRestored(ev.Executant.GetOpaqueId(), iid, path), ActionFileRestored)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileRestored(ev.Executant.GetOpaqueId(), iid, path), ActionFileRestored)
return AuditEventFileRestored{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
OldPath: oldpath,
@@ -324,13 +324,37 @@ func ItemRestored(ev events.ItemRestored) AuditEventFileRestored {
// FileVersionRestored converts a FileVersionRestored event to an AuditEventFileVersionRestored
func FileVersionRestored(ev events.FileVersionRestored) AuditEventFileVersionRestored {
iid, path, uid := extractFileDetails(ev.Ref, ev.Owner)
base := BasicAuditEvent(uid, formatTime(ev.Timestamp), MessageFileVersionRestored(ev.Executant.GetOpaqueId(), iid, ev.Key), ActionFileVersionRestored)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageFileVersionRestored(ev.Executant.GetOpaqueId(), iid, ev.Key), ActionFileVersionRestored)
return AuditEventFileVersionRestored{
AuditEventFiles: FilesAuditEvent(base, iid, uid, path),
Key: ev.Key,
}
}
// TagsAdded converts a TagsAdded event to an AuditEventTagsAdded.
// Unlike the other file events, User is the executant (who changed the tags), not the
// space owner: tags are usually changed by someone other than the owner, and the
// owner is still recorded in the Owner field.
func TagsAdded(ev events.TagsAdded) AuditEventTagsAdded {
iid, path, owner := extractFileDetails(ev.Ref, ev.SpaceOwner)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageTagsAdded(ev.Executant.GetOpaqueId(), ev.Tags, iid), ActionTagsAdded)
return AuditEventTagsAdded{
AuditEventFiles: FilesAuditEvent(base, iid, owner, path),
Tags: ev.Tags,
}
}
// TagsRemoved converts a TagsRemoved event to an AuditEventTagsRemoved.
// User is the executant, as in TagsAdded.
func TagsRemoved(ev events.TagsRemoved) AuditEventTagsRemoved {
iid, path, owner := extractFileDetails(ev.Ref, ev.SpaceOwner)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageTagsRemoved(ev.Executant.GetOpaqueId(), ev.Tags, iid), ActionTagsRemoved)
return AuditEventTagsRemoved{
AuditEventFiles: FilesAuditEvent(base, iid, owner, path),
Tags: ev.Tags,
}
}
// SpacesAuditEvent creates an AuditEventSpaces from the given values
func SpacesAuditEvent(base AuditEvent, spaceID string) AuditEventSpaces {
return AuditEventSpaces{
@@ -343,7 +367,7 @@ func SpacesAuditEvent(base AuditEvent, spaceID string) AuditEventSpaces {
func SpaceCreated(ev events.SpaceCreated) AuditEventSpaceCreated {
sid := ev.ID.GetOpaqueId()
iid, _, owner := extractFileDetails(&provider.Reference{ResourceId: ev.Root}, ev.Owner)
base := BasicAuditEvent("", formatTime(ev.MTime), MessageSpaceCreated(ev.Executant.GetOpaqueId(), sid, ev.Name), ActionSpaceCreated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.MTime), MessageSpaceCreated(ev.Executant.GetOpaqueId(), sid, ev.Name), ActionSpaceCreated)
return AuditEventSpaceCreated{
AuditEventSpaces: SpacesAuditEvent(base, sid),
Owner: owner,
@@ -356,7 +380,7 @@ func SpaceCreated(ev events.SpaceCreated) AuditEventSpaceCreated {
// SpaceRenamed converts a SpaceRenamed event to an AuditEventSpaceRenamed
func SpaceRenamed(ev events.SpaceRenamed) AuditEventSpaceRenamed {
sid := ev.ID.GetOpaqueId()
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageSpaceRenamed(ev.Executant.GetOpaqueId(), sid, ev.Name), ActionSpaceRenamed)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageSpaceRenamed(ev.Executant.GetOpaqueId(), sid, ev.Name), ActionSpaceRenamed)
return AuditEventSpaceRenamed{
AuditEventSpaces: SpacesAuditEvent(base, sid),
NewName: ev.Name,
@@ -366,7 +390,7 @@ func SpaceRenamed(ev events.SpaceRenamed) AuditEventSpaceRenamed {
// SpaceDisabled converts a SpaceDisabled event to an AuditEventSpaceDisabled
func SpaceDisabled(ev events.SpaceDisabled) AuditEventSpaceDisabled {
sid := ev.ID.GetOpaqueId()
base := BasicAuditEvent("", formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceDisabled(ev.Executant.GetOpaqueId(), sid), ActionSpaceDisabled)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceDisabled(ev.Executant.GetOpaqueId(), sid), ActionSpaceDisabled)
return AuditEventSpaceDisabled{
AuditEventSpaces: SpacesAuditEvent(base, sid),
}
@@ -375,7 +399,7 @@ func SpaceDisabled(ev events.SpaceDisabled) AuditEventSpaceDisabled {
// SpaceEnabled converts a SpaceEnabled event to an AuditEventSpaceEnabled
func SpaceEnabled(ev events.SpaceEnabled) AuditEventSpaceEnabled {
sid := ev.ID.GetOpaqueId()
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageSpaceEnabled(ev.Executant.GetOpaqueId(), sid), ActionSpaceEnabled)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageSpaceEnabled(ev.Executant.GetOpaqueId(), sid), ActionSpaceEnabled)
return AuditEventSpaceEnabled{
AuditEventSpaces: SpacesAuditEvent(base, sid),
}
@@ -384,7 +408,7 @@ func SpaceEnabled(ev events.SpaceEnabled) AuditEventSpaceEnabled {
// SpaceDeleted converts a SpaceDeleted event to an AuditEventSpaceDeleted
func SpaceDeleted(ev events.SpaceDeleted) AuditEventSpaceDeleted {
sid := ev.ID.GetOpaqueId()
base := BasicAuditEvent("", formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceDeleted(ev.Executant.GetOpaqueId(), sid, ev.SpaceName), ActionSpaceDeleted)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceDeleted(ev.Executant.GetOpaqueId(), sid, ev.SpaceName), ActionSpaceDeleted)
return AuditEventSpaceDeleted{
AuditEventSpaces: SpacesAuditEvent(base, sid),
}
@@ -403,7 +427,7 @@ func SpaceShared(ev events.SpaceShared) AuditEventSpaceShared {
sse.GranteeGroupID = ev.GranteeGroupID.OpaqueId
grantee = "group:" + ev.GranteeGroupID.OpaqueId
}
base := BasicAuditEvent("", "", MessageSpaceShared(ev.Executant.GetOpaqueId(), sid, grantee), ActionSpaceShared)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), "", MessageSpaceShared(ev.Executant.GetOpaqueId(), sid, grantee), ActionSpaceShared)
sse.AuditEventSpaces = SpacesAuditEvent(base, sid)
return sse
@@ -422,7 +446,7 @@ func SpaceUnshared(ev events.SpaceUnshared) AuditEventSpaceUnshared {
sue.GranteeGroupID = ev.GranteeGroupID.OpaqueId
grantee = "group:" + ev.GranteeGroupID.OpaqueId
}
base := BasicAuditEvent("", formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceUnshared(ev.Executant.GetOpaqueId(), sid, grantee), ActionSpaceUnshared)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(utils.TimeToTS(ev.Timestamp)), MessageSpaceUnshared(ev.Executant.GetOpaqueId(), sid, grantee), ActionSpaceUnshared)
sue.AuditEventSpaces = SpacesAuditEvent(base, sid)
return sue
@@ -437,7 +461,7 @@ func SpaceUpdated(ev events.SpaceUpdated) AuditEventSpaceUpdated {
Opaque: opaqueMap,
}
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageSpaceUpdated(ev.Executant.GetOpaqueId(), sid, ev.Space.Name, ev.Space.Quota.QuotaMaxBytes, opaqueMap), ActionSpaceUpdated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageSpaceUpdated(ev.Executant.GetOpaqueId(), sid, ev.Space.Name, ev.Space.Quota.QuotaMaxBytes, opaqueMap), ActionSpaceUpdated)
sue.AuditEventSpaces = SpacesAuditEvent(base, sid)
return sue
@@ -445,7 +469,7 @@ func SpaceUpdated(ev events.SpaceUpdated) AuditEventSpaceUpdated {
// UserCreated converts a UserCreated event to an AuditEventUserCreated
func UserCreated(ev events.UserCreated) AuditEventUserCreated {
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageUserCreated(ev.Executant.GetOpaqueId(), ev.UserID), ActionUserCreated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageUserCreated(ev.Executant.GetOpaqueId(), ev.UserID), ActionUserCreated)
return AuditEventUserCreated{
AuditEvent: base,
UserID: ev.UserID,
@@ -454,7 +478,7 @@ func UserCreated(ev events.UserCreated) AuditEventUserCreated {
// UserDeleted converts a UserDeleted event to an AuditEventUserDeleted
func UserDeleted(ev events.UserDeleted) AuditEventUserDeleted {
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageUserDeleted(ev.Executant.GetOpaqueId(), ev.UserID), ActionUserDeleted)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageUserDeleted(ev.Executant.GetOpaqueId(), ev.UserID), ActionUserDeleted)
return AuditEventUserDeleted{
AuditEvent: base,
UserID: ev.UserID,
@@ -464,7 +488,7 @@ func UserDeleted(ev events.UserDeleted) AuditEventUserDeleted {
// UserFeatureChanged converts a UserFeatureChanged event to an AuditEventUserFeatureChanged
func UserFeatureChanged(ev events.UserFeatureChanged) AuditEventUserFeatureChanged {
msg := MessageUserFeatureChanged(ev.Executant.GetOpaqueId(), ev.UserID, ev.Features)
base := BasicAuditEvent("", formatTime(ev.Timestamp), msg, ActionUserFeatureChanged)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), msg, ActionUserFeatureChanged)
return AuditEventUserFeatureChanged{
AuditEvent: base,
UserID: ev.UserID,
@@ -474,7 +498,7 @@ func UserFeatureChanged(ev events.UserFeatureChanged) AuditEventUserFeatureChang
// GroupCreated converts a GroupCreated event to an AuditEventGroupCreated
func GroupCreated(ev events.GroupCreated) AuditEventGroupCreated {
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageGroupCreated(ev.Executant.GetOpaqueId(), ev.GroupID), ActionGroupCreated)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageGroupCreated(ev.Executant.GetOpaqueId(), ev.GroupID), ActionGroupCreated)
return AuditEventGroupCreated{
AuditEvent: base,
GroupID: ev.GroupID,
@@ -483,7 +507,7 @@ func GroupCreated(ev events.GroupCreated) AuditEventGroupCreated {
// GroupDeleted converts a GroupDeleted event to an AuditEventGroupDeleted
func GroupDeleted(ev events.GroupDeleted) AuditEventGroupDeleted {
base := BasicAuditEvent("", formatTime(ev.Timestamp), MessageGroupDeleted(ev.Executant.GetOpaqueId(), ev.GroupID), ActionGroupDeleted)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), MessageGroupDeleted(ev.Executant.GetOpaqueId(), ev.GroupID), ActionGroupDeleted)
return AuditEventGroupDeleted{
AuditEvent: base,
GroupID: ev.GroupID,
@@ -492,8 +516,8 @@ func GroupDeleted(ev events.GroupDeleted) AuditEventGroupDeleted {
// GroupMemberAdded converts a GroupMemberAdded event to an AuditEventGroupMemberAdded
func GroupMemberAdded(ev events.GroupMemberAdded) AuditEventGroupMemberAdded {
msg := MessageGroupMemberAdded(ev.Executant.GetOpaqueId(), ev.GroupID, ev.UserID)
base := BasicAuditEvent("", formatTime(ev.Timestamp), msg, ActionGroupMemberAdded)
msg := MessageGroupMemberAdded(ev.Executant.GetOpaqueId(), ev.UserID, ev.GroupID)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), msg, ActionGroupMemberAdded)
return AuditEventGroupMemberAdded{
AuditEvent: base,
GroupID: ev.GroupID,
@@ -503,8 +527,8 @@ func GroupMemberAdded(ev events.GroupMemberAdded) AuditEventGroupMemberAdded {
// GroupMemberRemoved converts a GroupMemberRemoved event to an AuditEventGroupMemberRemove
func GroupMemberRemoved(ev events.GroupMemberRemoved) AuditEventGroupMemberRemoved {
msg := MessageGroupMemberRemoved(ev.Executant.GetOpaqueId(), ev.GroupID, ev.UserID)
base := BasicAuditEvent("", formatTime(ev.Timestamp), msg, ActionGroupMemberRemoved)
msg := MessageGroupMemberRemoved(ev.Executant.GetOpaqueId(), ev.UserID, ev.GroupID)
base := BasicAuditEvent(ev.Executant.GetOpaqueId(), formatTime(ev.Timestamp), msg, ActionGroupMemberRemoved)
return AuditEventGroupMemberRemoved{
AuditEvent: base,
GroupID: ev.GroupID,
+2
View File
@@ -24,6 +24,8 @@ func RegisteredEvents() []events.Unmarshaller {
events.ItemPurged{},
events.ItemRestored{},
events.FileVersionRestored{},
events.TagsAdded{},
events.TagsRemoved{},
events.SpaceCreated{},
events.SpaceRenamed{},
events.SpaceEnabled{},
+13 -1
View File
@@ -32,6 +32,8 @@ const (
ActionFilePurged = "file_trash_delete"
ActionFileRestored = "file_trash_restore"
ActionFileVersionRestored = "file_version_restore"
ActionTagsAdded = "file_tags_add"
ActionTagsRemoved = "file_tags_remove"
// Spaces
ActionSpaceCreated = "space_created"
@@ -124,7 +126,17 @@ func MessageFileRead(executant, item string) string {
return fmt.Sprintf("user '%s' read file '%s'", executant, item)
}
// MessageFileTrashed returns the human-readable string that describes the action
// MessageTagsAdded returns a human readable string that describes the action
func MessageTagsAdded(executant, tags, item string) string {
return fmt.Sprintf("user '%s' added tags '%s' to file '%s'", executant, tags, item)
}
// MessageTagsRemoved returns a human readable string that describes the action
func MessageTagsRemoved(executant, tags, item string) string {
return fmt.Sprintf("user '%s' removed tags '%s' from file '%s'", executant, tags, item)
}
// MessageFileTrashed returns a human readable string that describes the action
func MessageFileTrashed(executant, item string) string {
return fmt.Sprintf("user '%s' trashed file '%s'", executant, item)
}
+14
View File
@@ -149,6 +149,20 @@ type AuditEventFileRestored struct {
OldPath string
}
// AuditEventTagsAdded is the event logged when tags are added to a file or folder
type AuditEventTagsAdded struct {
AuditEventFiles
Tags string // the tags the request asked to add, as carried by the event (ev.Tags); some may already have been present
}
// AuditEventTagsRemoved is the event logged when tags are removed from a file or folder
type AuditEventTagsRemoved struct {
AuditEventFiles
Tags string // the tags the request asked to remove, as carried by the event (ev.Tags); some may not have been present
}
// AuditEventFileVersionRestored is the event logged when a file version is restored
type AuditEventFileVersionRestored struct {
AuditEventFiles
+1 -1
View File
@@ -82,7 +82,7 @@ type LDAPProvider struct {
IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;AUTH_BASIC_IDP_URL" desc:"The identity provider value to set in the userids of the CS3 user objects for users returned by this user provider." introductionVersion:"pre5.0"`
DisableUserMechanism string `yaml:"disable_user_mechanism" env:"OCIS_LDAP_DISABLE_USER_MECHANISM;AUTH_BASIC_DISABLE_USER_MECHANISM" desc:"An option to control the behavior for disabling users. Valid options are 'none', 'attribute' and 'group'. If set to 'group', disabling a user via API will add the user to the configured group for disabled users, if set to 'attribute' this will be done in the ldap user entry, if set to 'none' the disable request is not processed." introductionVersion:"pre5.0"`
LdapDisabledUsersGroupDN string `yaml:"ldap_disabled_users_group_dn" env:"OCIS_LDAP_DISABLED_USERS_GROUP_DN;AUTH_BASIC_DISABLED_USERS_GROUP_DN" desc:"The distinguished name of the group to which added users will be classified as disabled when 'disable_user_mechanism' is set to 'group'." introductionVersion:"pre5.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance." introductionVersion:"7.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance. Also set 'user_filter'. Without an explicit 'user_filter', this instance allows login for every user in the shared LDAP directory." introductionVersion:"7.0"`
UserMemberAttribute string `yaml:"user_member_attribute" env:"OCIS_LDAP_USER_MEMBER_ATTRIBUTE" desc:"LDAP attribute that marks a user as a member of an instance." introductionVersion:"7.0"`
UserGuestAttribute string `yaml:"user_guest_attribute" env:"OCIS_LDAP_USER_GUEST_ATTRIBUTE" desc:"LDAP attribute that marks a user as a guest of an instance." introductionVersion:"7.0"`
UserSchema LDAPUserSchema `yaml:"user_schema"`
@@ -42,5 +42,9 @@ func Validate(cfg *config.Config) error {
return shared.MissingLDAPBindPassword(cfg.Service.Name)
}
if cfg.AuthProvider == "ldap" && cfg.AuthProviders.LDAP.MasterID != "" && cfg.AuthProviders.LDAP.UserFilter == "" {
return shared.MissingLDAPUserFilterForMasterID(cfg.Service.Name)
}
return nil
}
@@ -0,0 +1,63 @@
package parser
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/owncloud/ocis/v2/services/auth-basic/pkg/config"
)
func TestValidateMasterIDRequiresUserFilter(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "auth-basic"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
AuthProvider: "ldap",
AuthProviders: config.AuthProviders{
LDAP: config.LDAPProvider{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.Error(t, err)
}
func TestValidateMasterIDWithUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "auth-basic"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
AuthProvider: "ldap",
AuthProviders: config.AuthProviders{
LDAP: config.LDAPProvider{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "(ownCloudMemberOf=instance-1)",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
func TestValidateNoMasterIDWithEmptyUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "auth-basic"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
AuthProvider: "ldap",
AuthProviders: config.AuthProviders{
LDAP: config.LDAPProvider{
BindPassword: "secret",
MasterID: "",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
+3 -3
View File
@@ -11,7 +11,7 @@ type Store struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;COLLABORATION_STORE_TTL" desc:"Time to live for events in the store. Defaults to '30m' (30 minutes). See the Environment Variable Types description for more details." introductionVersion:"7.0.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;COLLABORATION_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;COLLABORATION_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;COLLABORATION_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;COLLABORATION_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;COLLABORATION_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;COLLABORATION_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;COLLABORATION_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;COLLABORATION_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -45,9 +45,9 @@ type Store struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;EVENTHISTORY_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;EVENTHISTORY_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;EVENTHISTORY_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;EVENTHISTORY_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;EVENTHISTORY_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;EVENTHISTORY_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;EVENTHISTORY_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;EVENTHISTORY_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;EVENTHISTORY_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// Events combines the configuration options for the event bus.
+5 -6
View File
@@ -150,9 +150,9 @@ type OCS struct {
StatCacheDisablePersistence bool `yaml:"stat_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disable persistence of the cache. Only applies when using the 'nats-js-kv' store type. Defaults to false." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_DISABLE_PERSISTENCE in the frontend service is deprecated because the OCS API is deprecated" deprecationReplacement:""`
StatCacheAuthUsername string `yaml:"stat_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when using the 'nats-js-kv' store type." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_AUTH_USERNAME in the frontend service is deprecated because the OCS API is deprecated OCS API is deprecated" deprecationReplacement:""`
StatCacheAuthPassword string `yaml:"stat_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when using the 'nats-js-kv' store type." introductionVersion:"5.0" deprecationVersion:"7.0.0" removalVersion:"%%NEXT_PRODUCTION_VERSION%%" deprecationInfo:"The use of OCIS_CACHE_AUTH_PASSWORD in the frontend service is deprecated because the OCS API is deprecated OCS API is deprecated" deprecationReplacement:""`
StatCacheEnableTLS bool `yaml:"stat_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the stat cache store. Only applies when using the 'nats-js-kv' store type." introductionVersion:"8.3.0"`
StatCacheTLSInsecure bool `yaml:"stat_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the stat cache store connection. Only applies when using the 'nats-js-kv' store type. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
StatCacheTLSRootCACertificate string `yaml:"stat_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the stat cache store TLS connection. Only applies when using the 'nats-js-kv' store type." introductionVersion:"8.3.0"`
StatCacheEnableTLS bool `yaml:"stat_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the stat cache store. Only applies when using the 'nats-js-kv' store type." introductionVersion:"9.0.0"`
StatCacheTLSInsecure bool `yaml:"stat_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the stat cache store connection. Only applies when using the 'nats-js-kv' store type. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
StatCacheTLSRootCACertificate string `yaml:"stat_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the stat cache store TLS connection. Only applies when using the 'nats-js-kv' store type." introductionVersion:"9.0.0"`
CacheWarmupDriver string `yaml:"cache_warmup_driver,omitempty"` // not supported by the oCIS product, therefore not part of docs
CacheWarmupDrivers CacheWarmupDrivers `yaml:"cache_warmup_drivers,omitempty"` // not supported by the oCIS product, therefore not part of docs
@@ -215,7 +215,6 @@ type Validation struct {
// MFAConfig configures multi factor multifactor authentication
type MFAConfig struct {
Enabled bool `yaml:"enabled" env:"OCIS_MFA_ENABLED" desc:"Set to true to enable multi factor authentication. See the documentation for more details." introductionVersion:"7.3.0"`
AuthLevelNames []string `yaml:"auth_level_names" env:"OCIS_MFA_AUTH_LEVEL_NAMES" desc:"This authentication level name indicates that multi-factor authentication was performed. The name must match the ACR claim in the access token received. Note: If multiple names are required, use a comma-separated list. The front-end service will use the first name in the list when requesting multi-factor authentication (MFA)." introductionVersion:"7.3.0"`
SessionDuration int `yaml:"session_duration" env:"OCIS_MFA_SESSION_DURATION" desc:"The duration in seconds that a multi-factor authentication session is valid. After this time the user will be prompted to re-authenticate. Defaults to 3600 (1 hour)." introductionVersion:"8.1.0"`
Enabled bool `yaml:"enabled" env:"OCIS_MFA_ENABLED" desc:"Set to true to enable multi factor authentication. See the documentation for more details." introductionVersion:"7.3.0"`
AuthLevelNames []string `yaml:"auth_level_names" env:"OCIS_MFA_AUTH_LEVEL_NAMES" desc:"This authentication level name indicates that multi-factor authentication was performed. The name must match the ACR claim in the access token received. Note: If multiple names are required, use a comma-separated list. The front-end service will use the first name in the list when requesting multi-factor authentication (MFA)." introductionVersion:"7.3.0"`
}
@@ -144,8 +144,7 @@ func DefaultConfig() *config.Config {
MaxTagLength: 100,
},
MultiFactorAuthentication: config.MFAConfig{
AuthLevelNames: []string{"advanced"},
SessionDuration: 3600,
AuthLevelNames: []string{"advanced"},
},
DefaultVaultShareExpirationDays: 30,
}
+2 -3
View File
@@ -361,9 +361,8 @@ func FrontendConfigFromStruct(cfg *config.Config, logger log.Logger) (map[string
},
"auth": map[string]interface{}{
"mfa": map[string]interface{}{
"enabled": cfg.MultiFactorAuthentication.Enabled,
"levelnames": cfg.MultiFactorAuthentication.AuthLevelNames,
"session_duration": cfg.MultiFactorAuthentication.SessionDuration,
"enabled": cfg.MultiFactorAuthentication.Enabled,
"levelnames": cfg.MultiFactorAuthentication.AuthLevelNames,
},
},
"vault": map[string]interface{}{
+3 -3
View File
@@ -95,7 +95,7 @@ type Cache struct {
ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
ProviderCacheEnableTLS bool `yaml:"provider_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_PROVIDER_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
ProviderCacheTLSInsecure bool `yaml:"provider_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_PROVIDER_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
ProviderCacheTLSRootCACertificate string `yaml:"provider_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_PROVIDER_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
ProviderCacheEnableTLS bool `yaml:"provider_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_PROVIDER_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
ProviderCacheTLSInsecure bool `yaml:"provider_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_PROVIDER_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
ProviderCacheTLSRootCACertificate string `yaml:"provider_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_PROVIDER_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -12,7 +12,7 @@ type Cache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GRAPH_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GRAPH_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GRAPH_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GRAPH_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GRAPH_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GRAPH_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -125,7 +125,7 @@ type LDAP struct {
InstanceMapperIDAttribute string `yaml:"instance_mapper_id_attribute" env:"OCIS_LDAP_INSTANCE_MAPPER_ID_ATTRIBUTE" desc:"LDAP Attribute of the instance ID. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
CrossInstanceReferenceTemplate string `yaml:"cross_instance_reference_template" env:"OCIS_LDAP_CROSS_INSTANCE_REFERENCE_TEMPLATE" desc:"Template for the users unique reference across oCIS instances. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
InstanceURLTemplate string `yaml:"instance_url_template" env:"OCIS_LDAP_INSTANCE_URL_TEMPLATE" desc:"Template for the instance URL. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.0.0"`
InstanceMapperCacheTTL int `yaml:"instance_mapper_cache_ttl" env:"OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL" desc:"Max TTL in seconds for the LDAP instance mapper cache. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"8.3.0"`
InstanceMapperCacheTTL int `yaml:"instance_mapper_cache_ttl" env:"OCIS_LDAP_INSTANCE_MAPPER_CACHE_TTL" desc:"Max TTL in seconds for the LDAP instance mapper cache. Requires OCIS_MULTI_INSTANCE_ENABLED." introductionVersion:"9.0.0"`
}
// LDAPEducationConfig represents the LDAP configuration for education related resources
@@ -194,13 +194,13 @@ type ServiceAccount struct {
type Validation struct {
MaxTagLength int `yaml:"max_tag_length" env:"OCIS_MAX_TAG_LENGTH" desc:"Define the maximum tag length. Defaults to 100 if not set. Set to 0 to not limit the tag length. Changes only impact the validation of new tags." introductionVersion:"7.2.0"`
MaxImageFileSize string `yaml:"max_image_file_size" env:"GRAPH_MAX_IMAGE_FILE_SIZE" desc:"The maximum file size of an image which can be set as a space image. Must be less than or equal to 'THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE' of the thumbnails service, otherwise images between the two values are accepted but cannot be rendered. Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB. Set to 0 to not limit the file size." introductionVersion:"8.3.0"`
MaxImageFileSize string `yaml:"max_image_file_size" env:"GRAPH_MAX_IMAGE_FILE_SIZE" desc:"The maximum file size of an image which can be set as a space image. Must be less than or equal to 'THUMBNAILS_MAX_INPUT_IMAGE_FILE_SIZE' of the thumbnails service, otherwise images between the two values are accepted but cannot be rendered. Usable common abbreviations: [KB, KiB, MB, MiB, GB, GiB, TB, TiB, PB, PiB, EB, EiB], example: 2GB. Set to 0 to not limit the file size." introductionVersion:"9.0.0"`
}
// MultiInstanceConfig holds configuration for multi-instance-ocis
type MultiInstanceConfig struct {
Enabled bool `yaml:"enabled" env:"OCIS_MULTI_INSTANCE_ENABLED" desc:"Enable multiple instances of Infinite Scale." introductionVersion:"8.0.0"`
InstanceID string `yaml:"instanceid" env:"OCIS_MULTI_INSTANCE_INSTANCEID" desc:"The unique ID of this instance." introductionVersion:"8.0.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master ID that grants access to all instances. Users with this ID in their memberOf or guestOf claims can access any instance. Leave empty to disable." introductionVersion:"8.1.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master ID that grants access to all instances. Users with this ID in their memberOf or guestOf claims can access any instance. Leave empty to disable. Also set 'OCIS_LDAP_USER_FILTER'. Without an explicit user filter, this instance resolves every user in the shared LDAP directory." introductionVersion:"8.1.0"`
QueryRegexp string `yaml:"query_regexp" env:"OCIS_MULTI_INSTANCE_QUERY_TEMPLATE" desc:"The regular expression extracting username and instancename from a user provided search." introductionVersion:"8.0.0"`
}
@@ -98,6 +98,10 @@ func validateLDAPSettings(cfg *config.Config) error {
return shared.MissingLDAPBindPassword(cfg.Service.Name)
}
if cfg.MultiInstance.MasterID != "" && cfg.Identity.LDAP.UserFilter == "" {
return shared.MissingLDAPUserFilterForMasterID(cfg.Service.Name)
}
// ensure that "GroupBaseDN" is below "GroupBaseDN"
if cfg.Identity.LDAP.WriteEnabled && cfg.Identity.LDAP.GroupCreateBaseDN != cfg.Identity.LDAP.GroupBaseDN {
baseDN, err := ldap.ParseDN(cfg.Identity.LDAP.GroupBaseDN)
@@ -0,0 +1,63 @@
package parser
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/owncloud/ocis/v2/services/graph/pkg/config"
)
func TestValidateLDAPSettingsMasterIDRequiresUserFilter(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "graph"},
Identity: config.Identity{
LDAP: config.LDAP{
BindPassword: "secret",
UserFilter: "",
},
},
MultiInstance: config.MultiInstanceConfig{
MasterID: "master-1",
},
}
err := validateLDAPSettings(cfg)
assert.Error(t, err)
}
func TestValidateLDAPSettingsMasterIDWithUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "graph"},
Identity: config.Identity{
LDAP: config.LDAP{
BindPassword: "secret",
UserFilter: "(ownCloudMemberOf=instance-1)",
},
},
MultiInstance: config.MultiInstanceConfig{
MasterID: "master-1",
},
}
err := validateLDAPSettings(cfg)
assert.NoError(t, err)
}
func TestValidateLDAPSettingsNoMasterIDWithEmptyUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "graph"},
Identity: config.Identity{
LDAP: config.LDAP{
BindPassword: "secret",
UserFilter: "",
},
},
MultiInstance: config.MultiInstanceConfig{
MasterID: "",
},
}
err := validateLDAPSettings(cfg)
assert.NoError(t, err)
}
+5
View File
@@ -16,6 +16,7 @@ import (
"github.com/owncloud/reva/v2/pkg/events"
"github.com/owncloud/reva/v2/pkg/storagespace"
"github.com/owncloud/reva/v2/pkg/tags"
"github.com/owncloud/reva/v2/pkg/utils"
"go-micro.dev/v4/metadata"
)
@@ -141,6 +142,7 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) {
if g.eventsPublisher != nil {
ev := events.TagsAdded{
// The tags as requested, including any that were already present.
Tags: strings.Join(assignment.Tags, ","),
Ref: &provider.Reference{
ResourceId: &rid,
@@ -148,6 +150,7 @@ func (g Graph) AssignTags(w http.ResponseWriter, r *http.Request) {
},
SpaceOwner: sres.Info.Owner,
Executant: revaCtx.ContextMustGetUser(r.Context()).Id,
Timestamp: utils.TSNow(),
}
if err := events.Publish(r.Context(), g.eventsPublisher, ev); err != nil {
g.logger.Error().Err(err).Msg("Failed to publish TagsAdded event")
@@ -239,6 +242,7 @@ func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request) {
// Always publish the event so the search index gets updated,
// even if the tag was already absent from file metadata.
ev := events.TagsRemoved{
// The tags as requested, including any that were not present.
Tags: strings.Join(unassignment.Tags, ","),
Ref: &provider.Reference{
ResourceId: &rid,
@@ -246,6 +250,7 @@ func (g Graph) UnassignTags(w http.ResponseWriter, r *http.Request) {
},
SpaceOwner: sres.Info.Owner,
Executant: revaCtx.ContextMustGetUser(ctx).Id,
Timestamp: utils.TSNow(),
}
if g.publishTagsRemoved(ctx, client, ev, tagsChanged, currentTags) != nil {
w.WriteHeader(http.StatusInternalServerError)
+1 -1
View File
@@ -79,7 +79,7 @@ type LDAPDriver struct {
UserObjectClass string `yaml:"user_object_class" env:"OCIS_LDAP_USER_OBJECTCLASS;GROUPS_LDAP_USER_OBJECTCLASS" desc:"The object class to use for users in the default user search filter ('inetOrgPerson')." introductionVersion:"pre5.0"`
GroupObjectClass string `yaml:"group_object_class" env:"OCIS_LDAP_GROUP_OBJECTCLASS;GROUPS_LDAP_GROUP_OBJECTCLASS" desc:"The object class to use for groups in the default group search filter ('groupOfNames')." introductionVersion:"pre5.0"`
IDP string `yaml:"idp" env:"OCIS_URL;OCIS_OIDC_ISSUER;GROUPS_IDP_URL" desc:"The identity provider value to set in the group IDs of the CS3 group objects for groups returned by this group provider." introductionVersion:"pre5.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance." introductionVersion:"7.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance. Also set 'user_filter'. Without an explicit 'user_filter', this instance resolves every user in the shared LDAP directory." introductionVersion:"7.0"`
UserMemberAttribute string `yaml:"user_member_attribute" env:"OCIS_LDAP_USER_MEMBER_ATTRIBUTE" desc:"LDAP attribute that marks a user as a member of an instance." introductionVersion:"7.0"`
UserGuestAttribute string `yaml:"user_guest_attribute" env:"OCIS_LDAP_USER_GUEST_ATTRIBUTE" desc:"LDAP attribute that marks a user as a guest of an instance." introductionVersion:"7.0"`
UserSchema LDAPUserSchema `yaml:"user_schema"`
@@ -42,5 +42,9 @@ func Validate(cfg *config.Config) error {
return shared.MissingLDAPBindPassword(cfg.Service.Name)
}
if cfg.Driver == "ldap" && cfg.Drivers.LDAP.MasterID != "" && cfg.Drivers.LDAP.UserFilter == "" {
return shared.MissingLDAPUserFilterForMasterID(cfg.Service.Name)
}
return nil
}
@@ -0,0 +1,63 @@
package parser
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/owncloud/ocis/v2/services/groups/pkg/config"
)
func TestValidateMasterIDRequiresUserFilter(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "groups"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.Error(t, err)
}
func TestValidateMasterIDWithUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "groups"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "(ownCloudMemberOf=instance-1)",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
func TestValidateNoMasterIDWithEmptyUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "groups"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
+1 -1
View File
@@ -32,5 +32,5 @@ type Keycloak struct {
ClientRealm string `yaml:"client_realm" env:"OCIS_KEYCLOAK_CLIENT_REALM;INVITATIONS_KEYCLOAK_CLIENT_REALM" desc:"The realm the client is defined in." introductionVersion:"pre5.0"`
UserRealm string `yaml:"user_realm" env:"OCIS_KEYCLOAK_USER_REALM;INVITATIONS_KEYCLOAK_USER_REALM" desc:"The realm users are defined." introductionVersion:"pre5.0"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify" env:"OCIS_KEYCLOAK_INSECURE_SKIP_VERIFY;INVITATIONS_KEYCLOAK_INSECURE_SKIP_VERIFY" desc:"Disable TLS certificate validation for Keycloak connections. Do not set this in production environments." introductionVersion:"pre5.0"`
ExecuteActions []string `yaml:"execute_actions" env:"INVITATIONS_KEYCLOAK_EXECUTE_ACTIONS" desc:"A comma-separated list of Keycloak required actions sent to invited guests via the execute-actions email. Values are passed to Keycloak as-is. Defaults to 'UPDATE_PASSWORD,VERIFY_EMAIL'. See the Environment Variable Types description for more details." introductionVersion:"8.3.0"`
ExecuteActions []string `yaml:"execute_actions" env:"INVITATIONS_KEYCLOAK_EXECUTE_ACTIONS" desc:"A comma-separated list of Keycloak required actions sent to invited guests via the execute-actions email. Values are passed to Keycloak as-is. Defaults to 'UPDATE_PASSWORD,VERIFY_EMAIL'. See the Environment Variable Types description for more details." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -79,7 +79,7 @@ type Store struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;NOTIFICATIONS_STORE_TTL" desc:"Time to live for notifications in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"7.1.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;NOTIFICATIONS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;NOTIFICATIONS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;NOTIFICATIONS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;NOTIFICATIONS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;NOTIFICATIONS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;NOTIFICATIONS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;NOTIFICATIONS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;NOTIFICATIONS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
@@ -33,6 +33,7 @@ import (
"github.com/owncloud/ocis/v2/services/notifications/pkg/channels"
"github.com/owncloud/reva/v2/pkg/events"
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
"github.com/owncloud/reva/v2/pkg/storagespace"
"github.com/owncloud/reva/v2/pkg/utils"
cs3mocks "github.com/owncloud/reva/v2/tests/cs3mocks/mocks"
"github.com/stretchr/testify/mock"
@@ -80,6 +81,11 @@ var _ = Describe("Notifications", func() {
gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(&user.GetUserResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, User: sharer}, nil).Once()
gatewayClient.On("GetUser", mock.Anything, mock.Anything).Return(&user.GetUserResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, User: sharee}, nil).Once()
gatewayClient.On("Authenticate", mock.Anything, mock.Anything).Return(&gateway.AuthenticateResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, User: sharer}, nil)
// Registered before the catch-all below: testify/mock matches expectations in
// registration order, so the more specific vault matcher must come first.
gatewayClient.On("Stat", mock.Anything, mock.MatchedBy(func(r *provider.StatRequest) bool {
return r.GetRef().GetResourceId().GetStorageId() == utils.VaultStorageProviderID
})).Return(&provider.StatResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, Info: &provider.ResourceInfo{Name: "report.pdf", Space: &provider.StorageSpace{Name: "vault space"}}}, nil)
gatewayClient.On("Stat", mock.Anything, mock.Anything).Return(&provider.StatResponse{Status: &rpc.Status{Code: rpc.Code_CODE_OK}, Info: &provider.ResourceInfo{Name: "secrets of the board", Space: &provider.StorageSpace{Name: "secret space"}}}, nil)
vs = &settingssvc.MockValueService{}
vs.GetValueByUniqueIdentifiersFunc = func(ctx context.Context, req *settingssvc.GetValueByUniqueIdentifiersRequest, opts ...client.CallOption) (*settingssvc.GetValueResponse, error) {
@@ -270,6 +276,95 @@ https://owncloud.com
},
}),
)
vaultResourceID := &provider.ResourceId{
StorageId: utils.VaultStorageProviderID,
SpaceId: "spaceid",
OpaqueId: "itemid",
}
vaultSpaceID := &provider.StorageSpaceId{
OpaqueId: storagespace.FormatResourceID(&provider.ResourceId{
StorageId: utils.VaultStorageProviderID,
SpaceId: "vaultspaceid",
OpaqueId: "vaultspaceid",
}),
}
DescribeTable("Vault resources are redacted in notifications",
func(ev events.Event, mustNotContain string) {
received := make(chan *channels.Message, 1)
ch := make(chan events.Event)
evts := NewEventsNotifier(trace.NewNoopTracerProvider(), ch, capturingChannel{out: received}, log.NewLogger(), gatewaySelector, vs, "",
"", "", "", "", "", "",
store.Create(), nil, nil)
go evts.Run()
ch <- ev
var msg *channels.Message
select {
case msg = <-received:
case <-time.Tick(3 * time.Second):
Fail("timeout waiting for notification")
}
Expect(msg.Subject).NotTo(ContainSubstring(mustNotContain))
Expect(msg.TextBody).NotTo(ContainSubstring(mustNotContain))
},
Entry("Share Created", events.Event{
Event: events.ShareCreated{
Sharer: sharer.GetId(),
GranteeUserID: sharee.GetId(),
CTime: utils.TimeToTS(time.Date(2023, 4, 17, 16, 42, 0, 0, time.UTC)),
ItemID: vaultResourceID,
},
}, "report.pdf"),
Entry("Share Expired", events.Event{
Event: events.ShareExpired{
ShareOwner: sharer.GetId(),
GranteeUserID: sharee.GetId(),
ExpiredAt: time.Date(2023, 4, 17, 16, 42, 0, 0, time.UTC),
ItemID: vaultResourceID,
},
}, "report.pdf"),
Entry("Share Removed", events.Event{
Event: events.ShareRemoved{
Executant: sharer.GetId(),
GranteeUserID: sharee.GetId(),
ItemID: vaultResourceID,
},
}, "report.pdf"),
Entry("Added to Space", events.Event{
Event: events.SpaceShared{
Executant: sharer.GetId(),
Creator: sharer.GetId(),
GranteeUserID: sharee.GetId(),
ID: vaultSpaceID,
},
}, "vault space"),
Entry("Removed from Space", events.Event{
Event: events.SpaceUnshared{
Executant: sharer.GetId(),
GranteeUserID: sharee.GetId(),
ID: vaultSpaceID,
},
}, "vault space"),
Entry("Space Expired", events.Event{
Event: events.SpaceMembershipExpired{
SpaceOwner: sharer.GetId(),
GranteeUserID: sharee.GetId(),
SpaceID: vaultSpaceID,
SpaceName: "vault space",
ExpiredAt: time.Date(2023, 4, 17, 16, 42, 0, 0, time.UTC),
},
}, "vault space"),
)
})
var _ = Describe("Notifications X-Site Scripting", func() {
@@ -1278,6 +1373,17 @@ type testChannel struct {
done chan struct{}
}
// capturingChannel hands the sent message to the caller instead of asserting on it itself,
// for tests that need to inspect the message rather than match it exactly.
type capturingChannel struct {
out chan *channels.Message
}
func (c capturingChannel) SendMessage(_ context.Context, m *channels.Message) error {
c.out <- m
return nil
}
func (tc testChannel) SendMessage(_ context.Context, m *channels.Message) error {
defer GinkgoRecover()
+12 -3
View File
@@ -12,6 +12,15 @@ import (
"google.golang.org/protobuf/types/known/fieldmaskpb"
)
// vaultRedactedName replaces a file/space name with a generic placeholder when it belongs to
// the vault storage provider, so personal data never leaves the vault in a notification email.
func vaultRedactedName(storageID, name string) string {
if storageID == utils.VaultStorageProviderID {
return "a shared item"
}
return name
}
func (s eventsNotifier) handleShareCreated(baseCtx context.Context, e events.ShareCreated, eventId string) {
logger := s.logger.With().
Str("event", "ShareCreated").
@@ -69,7 +78,7 @@ func (s eventsNotifier) prepareShareCreated(baseCtx context.Context, logger zero
Msg("could not stat resource")
return owner, shareFolder, shareLink, ctx, err
}
shareFolder = resourceInfo.Name
shareFolder = vaultRedactedName(e.ItemID.GetStorageId(), resourceInfo.Name)
shareLink, err = urlJoinPath(s.ocisURL, "files/shares/with-me")
if err != nil {
@@ -157,7 +166,7 @@ func (s eventsNotifier) prepareShareExpired(baseCtx context.Context, logger zero
Msg("could not stat resource")
return shareFolder, ctx, err
}
shareFolder = resourceInfo.GetName()
shareFolder = vaultRedactedName(e.ItemID.GetStorageId(), resourceInfo.GetName())
return shareFolder, ctx, err
}
@@ -219,7 +228,7 @@ func (s eventsNotifier) prepareShareRemoved(baseCtx context.Context, logger zero
Msg("could not stat resource")
return executant, shareFolder, ctx, err
}
shareFolder = resourceInfo.Name
shareFolder = vaultRedactedName(e.ItemID.GetStorageId(), resourceInfo.Name)
executant, err = utils.GetUserWithContext(ctx, e.Executant, gatewayClient)
if err != nil {
+10 -3
View File
@@ -84,7 +84,7 @@ func (s eventsNotifier) prepareSpaceShared(baseCtx context.Context, logger zerol
Msg("could not get space info")
return executant, spaceName, shareLink, ctx, err
}
spaceName = resourceInfo.GetSpace().GetName()
spaceName = vaultRedactedName(resourceID.GetStorageId(), resourceInfo.GetSpace().GetName())
shareLink, err = urlJoinPath(s.ocisURL, "f", e.ID.OpaqueId)
if err != nil {
@@ -169,7 +169,7 @@ func (s eventsNotifier) prepareSpaceUnshared(baseCtx context.Context, logger zer
Msg("could not get space info")
return executant, spaceName, shareLink, ctx, err
}
spaceName = resourceInfo.GetSpace().GetName()
spaceName = vaultRedactedName(resourceID.GetStorageId(), resourceInfo.GetSpace().GetName())
shareLink, err = urlJoinPath(s.ocisURL, "f", e.ID.OpaqueId)
if err != nil {
@@ -220,10 +220,17 @@ func (s eventsNotifier) handleSpaceMembershipExpired(baseCtx context.Context, e
return
}
spaceName := e.SpaceName
if resourceID, err := storagespace.ParseID(e.SpaceID.GetOpaqueId()); err == nil {
spaceName = vaultRedactedName(resourceID.GetStorageId(), spaceName)
} else {
logger.Error().Err(err).Msg("could not parse resourceid from SpaceID, skipping vault redaction check")
}
emails, err := s.render(ctx, email.MembershipExpired,
"SpaceGrantee",
map[string]string{
"SpaceName": e.SpaceName,
"SpaceName": spaceName,
"ExpiredAt": e.ExpiredAt.Format("2006-01-02 15:04:05"),
}, recipientsInstant, owner.GetDisplayName())
if err != nil {
+1 -1
View File
@@ -39,7 +39,7 @@ type Config struct {
AllowPropfindDepthInfinity bool `yaml:"allow_propfind_depth_infinity" env:"OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY" desc:"Allow the use of depth infinity in PROPFINDS. When enabled, a propfind will traverse through all subfolders. If many subfolders are expected, depth infinity can cause heavy server load and/or delayed response times." introductionVersion:"pre5.0"`
DisablePropfindPublicLinkResolution bool `yaml:"disable_propfind_public_link_resolution" env:"OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION" desc:"Disable the resolution of public link shares when answering PROPFIND requests. When disabled, the oc:share-type property will not be populated with public link share information, which can reduce load on services for large collections." introductionVersion:"8.3.0"`
DisablePropfindPublicLinkResolution bool `yaml:"disable_propfind_public_link_resolution" env:"OCDAV_DISABLE_PROPFIND_PUBLIC_LINK_RESOLUTION" desc:"Disable the resolution of public link shares when answering PROPFIND requests. When disabled, the oc:share-type property will not be populated with public link share information, which can reduce load on services for large collections." introductionVersion:"9.0.0"`
}
type Log struct {
+3 -3
View File
@@ -38,7 +38,7 @@ type SigningKeys struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TTL" desc:"Default time to live for signing keys. See the Environment Variable Types description for more details." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -64,7 +64,7 @@ type Store struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;POSTPROCESSING_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;POSTPROCESSING_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;POSTPROCESSING_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;POSTPROCESSING_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;POSTPROCESSING_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;POSTPROCESSING_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;POSTPROCESSING_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;POSTPROCESSING_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;POSTPROCESSING_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+10 -5
View File
@@ -287,15 +287,19 @@ func loadMiddlewares(logger log.Logger, cfg *config.Config,
if cfg.EnableBasicAuth {
logger.Warn().Msg("basic auth enabled, use only for testing or development")
authenticators = append(authenticators, middleware.BasicAuthenticator{
Logger: logger,
UserProvider: userProvider,
Logger: logger,
UserProvider: userProvider,
UserRoleAssigner: roleAssigner,
MultiInstanceEnabled: cfg.MultiInstance.Enabled,
})
}
if cfg.AuthMiddleware.AllowAppAuth {
authenticators = append(authenticators, middleware.AppAuthAuthenticator{
Logger: logger,
RevaGatewaySelector: gatewaySelector,
Logger: logger,
RevaGatewaySelector: gatewaySelector,
UserRoleAssigner: roleAssigner,
MultiInstanceEnabled: cfg.MultiInstance.Enabled,
})
}
@@ -353,7 +357,6 @@ func loadMiddlewares(logger log.Logger, cfg *config.Config,
middleware.AllowAppAuth(cfg.AuthMiddleware.AllowAppAuth),
middleware.TraceProvider(traceProvider),
),
middleware.MultiFactor(cfg.MultiFactorAuthentication, middleware.Logger(logger), middleware.MFAStore(signingKeyStore)),
middleware.AccountResolver(
middleware.Logger(logger),
middleware.UserProvider(userProvider),
@@ -365,6 +368,8 @@ func loadMiddlewares(logger log.Logger, cfg *config.Config,
middleware.EventsPublisher(publisher),
middleware.MultiInstance(cfg.MultiInstance.Enabled, cfg.MultiInstance.InstanceID, cfg.MultiInstance.MasterID, cfg.MultiInstance.MemberClaim, cfg.MultiInstance.GuestClaim, cfg.MultiInstance.GuestRole),
),
// needs the user resolved by the AccountResolver
middleware.MultiFactor(cfg.MultiFactorAuthentication, middleware.Logger(logger), middleware.MFAStore(signingKeyStore)),
middleware.SelectorCookie(
middleware.Logger(logger),
middleware.PolicySelectorConfig(*cfg.PolicySelector),
+6 -6
View File
@@ -147,9 +147,9 @@ type Cache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_OIDC_USERINFO_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_OIDC_USERINFO_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_OIDC_USERINFO_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_OIDC_USERINFO_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_OIDC_USERINFO_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_OIDC_USERINFO_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_OIDC_USERINFO_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// RoleAssignment contains the configuration for how to assign roles to users during login
@@ -205,9 +205,9 @@ type SigningKeys struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_DISABLE_PERSISTENCE" desc:"Disables persistence of the store. Only applies when store type 'nats-js-kv' is configured. Defaults to true." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// ClaimsSelectorConf is the config for the claims-selector
@@ -274,6 +274,14 @@ func DefaultPolicies() []config.Policy {
Endpoint: "/graph/",
Service: "com.owncloud.web.graph",
},
{
Endpoint: "/vault/graph/v1beta1/extensions/org.libregraph/activities",
Service: "com.owncloud.web.activitylog",
},
{
Endpoint: "/vault/graph/v1.0/invitations",
Service: "com.owncloud.web.invitations",
},
{
Endpoint: "/vault/graph/",
Service: "com.owncloud.web.graph",
@@ -105,6 +105,15 @@ func (m accountResolver) verifyUser(w http.ResponseWriter, req *http.Request, us
return
}
if errors.Is(err, backend.ErrAccountNotFound) {
// the identity backend excludes disabled accounts from by-claim
// lookups, so a disabled account also ends up here, not just a
// genuinely unknown username.
m.logger.Debug().Interface("user", user).Msg("Not found")
w.WriteHeader(http.StatusUnauthorized)
return
}
if err != nil {
m.logger.Error().Err(err).Msg("Could not get user by claim")
w.WriteHeader(http.StatusInternalServerError)
@@ -472,3 +472,35 @@ func TestResolveUserType(t *testing.T) {
})
}
}
// TestVerifyUserUnauthorizedOnUserNotFound covers the verifyUser fast path
// (user already in context, e.g. via AppAuthAuthenticator/BasicAuthenticator),
// as opposed to TestUnauthorizedOnUserNotFound which covers the claims-based
// resolveUserFromClaims path. A disabled account is looked up by username and
// comes back as ErrAccountNotFound (the identity backend excludes disabled
// accounts from by-claim lookups), which must map to 401, not 500.
func TestVerifyUserUnauthorizedOnUserNotFound(t *testing.T) {
user := &userv1beta1.User{
Id: &userv1beta1.UserId{Idp: "https://idx.example.com", OpaqueId: "123"},
Username: "alice",
}
ub := mocks.UserBackend{}
ub.On("GetUserByClaims", mock.Anything, "username", "alice").Return(nil, "", backend.ErrAccountNotFound)
ra := userRoleMocks.UserRoleAssigner{}
sut := AccountResolver(
Logger(log.NewLogger()),
UserProvider(&ub),
UserRoleAssigner(&ra),
)(mockHandler{})
req := httptest.NewRequest("GET", "http://example.com/foo", nil)
req = req.WithContext(revactx.ContextSetUser(context.Background(), user))
rw := httptest.NewRecorder()
sut.ServeHTTP(rw, req)
assert.Equal(t, http.StatusUnauthorized, rw.Code)
}
+26 -13
View File
@@ -6,15 +6,17 @@ import (
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
cs3rpc "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
"github.com/owncloud/ocis/v2/services/proxy/pkg/userroles"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
)
// AppAuthAuthenticator defines the app auth authenticator
type AppAuthAuthenticator struct {
Logger log.Logger
RevaGatewaySelector pool.Selectable[gateway.GatewayAPIClient]
Logger log.Logger
RevaGatewaySelector pool.Selectable[gateway.GatewayAPIClient]
UserRoleAssigner userroles.UserRoleAssigner
MultiInstanceEnabled bool
}
// Authenticate implements the authenticator interface to authenticate requests via app auth.
@@ -26,6 +28,15 @@ func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, erro
return nil, ErrAuthenticationFailed
}
if m.MultiInstanceEnabled {
// App passwords carry no OIDC claims, so there is no way to verify
// tenant membership (OCIS_MULTI_INSTANCE_MEMBER_CLAIM/GUEST_CLAIM)
// for them. Reject rather than let the request bypass the tenant
// check in services/proxy/pkg/middleware/account_resolver.go's
// resolveUserType.
return nil, ErrAuthenticationFailed
}
username, password, ok := r.BasicAuth()
if !ok {
return nil, ErrAuthenticationFailed
@@ -48,17 +59,19 @@ func (m AppAuthAuthenticator) Authenticate(r *http.Request) (*http.Request, erro
return nil, ErrAuthenticationFailed
}
r.Header.Set(revactx.TokenHeader, authenticateResponse.GetToken())
user := authenticateResponse.GetUser()
// fake oidc claims for the account resolver
claims := map[string]interface{}{
oidc.Iss: user.GetId().GetIdp(),
oidc.PreferredUsername: user.GetUsername(),
oidc.Email: user.GetMail(),
oidc.OwncloudUUID: user.GetId().GetOpaqueId(),
user, err := m.UserRoleAssigner.ApplyUserRole(r.Context(), authenticateResponse.GetUser())
if err != nil {
m.Logger.Error().Err(err).Msg("could not apply user role")
return nil, ErrAuthenticationFailed
}
r = r.WithContext(oidc.NewContext(r.Context(), claims))
// only mutate the request once we know we're returning success, so a
// failed authentication attempt can't leave a stale access token behind
// for a later authenticator in the chain to build on.
r.Header.Set(revactx.TokenHeader, authenticateResponse.GetToken())
// the user is already authenticated, put it into the context directly
// instead of faking oidc claims for the account resolver to re-resolve.
r = r.WithContext(revactx.ContextSetUser(r.Context(), user))
return r, nil
}
+91 -8
View File
@@ -1,27 +1,41 @@
package middleware
import (
"context"
"net/http"
"net/http/httptest"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
rpcv1beta1 "github.com/cs3org/go-cs3apis/cs3/rpc/v1beta1"
backendmocks "github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend/mocks"
"github.com/owncloud/ocis/v2/services/proxy/pkg/userroles/mocks"
"github.com/owncloud/reva/v2/pkg/auth/scope"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
"github.com/owncloud/reva/v2/pkg/token/manager/jwt"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
)
var _ = Describe("Authenticating requests", Label("AppAuthAuthenticator"), func() {
var authenticator Authenticator
var roleAssigner *mocks.UserRoleAssigner
BeforeEach(func() {
pool.RemoveSelector("GatewaySelector" + "com.owncloud.api.gateway")
roleAssigner = &mocks.UserRoleAssigner{}
roleAssigner.EXPECT().ApplyUserRole(mock.Anything, mock.Anything).RunAndReturn(
func(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { return user, nil },
).Maybe()
authenticator = AppAuthAuthenticator{
Logger: log.NewLogger(),
Logger: log.NewLogger(),
UserRoleAssigner: roleAssigner,
RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector",
"com.owncloud.api.gateway",
@@ -68,12 +82,81 @@ var _ = Describe("Authenticating requests", Label("AppAuthAuthenticator"), func(
Expect(req2).ToNot(BeNil())
Expect(req2.Header.Get("x-access-token")).To(Equal("reva-token"))
claims := oidc.FromContext(req2.Context())
Expect(claims).ToNot(BeNil())
Expect(claims[oidc.Iss]).To(Equal("testIDP"))
Expect(claims[oidc.PreferredUsername]).To(Equal("alice"))
Expect(claims[oidc.Email]).To(Equal("alice@example.prv"))
Expect(claims[oidc.OwncloudUUID]).To(Equal("abcd-1234"))
user, ok := revactx.ContextGetUser(req2.Context())
Expect(ok).To(Equal(true))
Expect(user.GetId().GetIdp()).To(Equal("testIDP"))
Expect(user.GetId().GetOpaqueId()).To(Equal("abcd-1234"))
Expect(user.GetUsername()).To(Equal("alice"))
Expect(user.GetMail()).To(Equal("alice@example.prv"))
})
})
When("multi-instance mode is enabled", func() {
It("rejects the request, since app passwords carry no tenant-membership claims", func() {
multiInstanceAuthenticator := AppAuthAuthenticator{
Logger: log.NewLogger(),
UserRoleAssigner: roleAssigner,
MultiInstanceEnabled: true,
RevaGatewaySelector: pool.GetSelector[gateway.GatewayAPIClient](
"GatewaySelector",
"com.owncloud.api.gateway",
func(cc grpc.ClientConnInterface) gateway.GatewayAPIClient {
return mockGatewayClient{
AuthenticateFunc: func(authType, clientID, clientSecret string) *gateway.AuthenticateResponse {
return &gateway.AuthenticateResponse{Status: &rpcv1beta1.Status{Code: rpcv1beta1.Code_CODE_OK}}
},
}
},
),
}
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
req.SetBasicAuth("test-user", "AppPassword")
req2, err := multiInstanceAuthenticator.Authenticate(req)
Expect(err).To(HaveOccurred())
Expect(req2).To(BeNil())
})
})
When("the account resolver is configured with a non-default PROXY_USER_OIDC_CLAIM", func() {
It("still resolves the already-authenticated user, bypassing claim-based lookup", func() {
req := httptest.NewRequest(http.MethodGet, "http://example.com/graph/v1.0/me", http.NoBody)
req.SetBasicAuth("test-user", "AppPassword")
authenticatedReq, err := authenticator.Authenticate(req)
Expect(err).ToNot(HaveOccurred())
resolvedUser := &userv1beta1.User{
Id: &userv1beta1.UserId{Idp: "testIDP", OpaqueId: "abcd-1234"},
Username: "alice",
}
tokenManager, err := jwt.New(map[string]interface{}{"secret": "change-me", "expires": int64(60)})
Expect(err).ToNot(HaveOccurred())
s, err := scope.AddOwnerScope(nil)
Expect(err).ToNot(HaveOccurred())
token, err := tokenManager.MintToken(context.Background(), resolvedUser, s)
Expect(err).ToNot(HaveOccurred())
ub := backendmocks.UserBackend{}
// services/proxy/pkg/middleware/account_resolver.go's verifyUser always looks
// up the user by "username", regardless of the configured PROXY_USER_OIDC_CLAIM,
// because the user arrives already authenticated via the request context.
ub.On("GetUserByClaims", mock.Anything, "username", "alice", mock.Anything).Return(resolvedUser, token, nil)
resolver := AccountResolver(
Logger(log.NewLogger()),
UserProvider(&ub),
UserRoleAssigner(roleAssigner),
UserOIDCClaim("sub"),
UserCS3Claim("userid"),
)(mockHandler{})
rw := httptest.NewRecorder()
resolver.ServeHTTP(rw, authenticatedReq)
Expect(rw.Code).To(Equal(http.StatusOK))
})
})
@@ -20,6 +20,8 @@ import (
"github.com/owncloud/ocis/v2/services/proxy/pkg/router"
"github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend"
"github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend/mocks"
userRoleMocks "github.com/owncloud/ocis/v2/services/proxy/pkg/userroles/mocks"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
"github.com/stretchr/testify/mock"
"go-micro.dev/v4/store"
@@ -81,10 +83,17 @@ var _ = Describe("Authenticating requests", Label("Authentication"), func() {
pool.RemoveSelector("GatewaySelector" + "com.owncloud.api.gateway")
logger := log.NewLogger()
roleAssigner := &userRoleMocks.UserRoleAssigner{}
roleAssigner.EXPECT().ApplyUserRole(mock.Anything, mock.Anything).RunAndReturn(
func(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { return user, nil },
).Maybe()
authenticators = []Authenticator{
BasicAuthenticator{
Logger: logger,
UserProvider: &ub,
Logger: logger,
UserProvider: &ub,
UserRoleAssigner: roleAssigner,
},
&OIDCAuthenticator{
OIDCIss: "http://idp.example.com",
@@ -151,7 +160,7 @@ var _ = Describe("Authenticating requests", Label("Authentication"), func() {
testHandler.ServeHTTP(rr, req)
Expect(rr).To(HaveHTTPStatus(http.StatusOK))
})
It("ensures the context oidc data when user the Basic authentication is successful", func() {
It("ensures the authenticated user is in the context when the Basic authentication is successful", func() {
req := httptest.NewRequest("PROPFIND", "http://example.com/remote.php/dav/public-files/", http.NoBody)
req = req.WithContext(router.SetRoutingInfo(context.Background(), router.RoutingInfo{}))
req.SetBasicAuth("testuser", "testpassword")
@@ -160,12 +169,12 @@ var _ = Describe("Authenticating requests", Label("Authentication"), func() {
EnableBasicAuth(true),
)
testHandler := handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Expect(oidc.FromContext(r.Context())).To(Equal(map[string]interface{}{
"email": "testuser@example.com",
"ownclouduuid": "OpaqueId",
"iss": "IdpId",
"preferred_username": "testuser",
}))
user, ok := revactx.ContextGetUser(r.Context())
Expect(ok).To(Equal(true))
Expect(user.GetId().GetIdp()).To(Equal("IdpId"))
Expect(user.GetId().GetOpaqueId()).To(Equal("OpaqueId"))
Expect(user.GetUsername()).To(Equal("testuser"))
Expect(user.GetMail()).To(Equal("testuser@example.com"))
}))
rr := httptest.NewRecorder()
testHandler.ServeHTTP(rr, req)
+26 -18
View File
@@ -4,16 +4,17 @@ import (
"net/http"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
"github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend"
"github.com/owncloud/ocis/v2/services/proxy/pkg/userroles"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
)
// BasicAuthenticator is the authenticator responsible for HTTP Basic authentication.
type BasicAuthenticator struct {
Logger log.Logger
UserProvider backend.UserBackend
UserCS3Claim string
UserOIDCClaim string
Logger log.Logger
UserProvider backend.UserBackend
UserRoleAssigner userroles.UserRoleAssigner
MultiInstanceEnabled bool
}
// Authenticate implements the authenticator interface to authenticate requests via basic auth.
@@ -25,6 +26,15 @@ func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
return nil, ErrAuthenticationFailed
}
if m.MultiInstanceEnabled {
// Basic auth credentials carry no OIDC claims, so there is no way to
// verify tenant membership (OCIS_MULTI_INSTANCE_MEMBER_CLAIM/GUEST_CLAIM)
// for them. Reject rather than let the request bypass the tenant
// check in services/proxy/pkg/middleware/account_resolver.go's
// resolveUserType.
return nil, ErrAuthenticationFailed
}
login, password, ok := r.BasicAuth()
if !ok {
return nil, ErrAuthenticationFailed
@@ -40,23 +50,21 @@ func (m BasicAuthenticator) Authenticate(r *http.Request) (*http.Request, error)
return nil, ErrAuthenticationFailed
}
// fake oidc claims
claims := map[string]interface{}{
oidc.Iss: user.Id.Idp,
oidc.PreferredUsername: user.Username,
oidc.Email: user.Mail,
oidc.OwncloudUUID: user.Id.OpaqueId,
user, err = m.UserRoleAssigner.ApplyUserRole(r.Context(), user)
if err != nil {
m.Logger.Error().
Err(err).
Str("authenticator", "basic").
Str("path", r.URL.Path).
Msg("could not apply user role")
return nil, ErrAuthenticationFailed
}
if m.UserCS3Claim == "userid" {
// set the custom user claim only if users will be looked up by the userid on the CS3api
// OpaqueId contains the userid configured in STORAGE_LDAP_USER_SCHEMA_UID
claims[m.UserOIDCClaim] = user.Id.OpaqueId
}
m.Logger.Debug().
Str("authenticator", "basic").
Str("path", r.URL.Path).
Msg("successfully authenticated request")
return r.WithContext(oidc.NewContext(r.Context(), claims)), nil
// the user is already authenticated, put it into the context directly
// instead of faking oidc claims for the account resolver to re-resolve.
return r.WithContext(revactx.ContextSetUser(r.Context(), user)), nil
}
@@ -1,6 +1,7 @@
package middleware
import (
"context"
"net/http"
"net/http/httptest"
@@ -10,13 +11,17 @@ import (
. "github.com/onsi/gomega"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
"github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend"
"github.com/owncloud/ocis/v2/services/proxy/pkg/user/backend/mocks"
userRoleMocks "github.com/owncloud/ocis/v2/services/proxy/pkg/userroles/mocks"
"github.com/owncloud/reva/v2/pkg/auth/scope"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
"github.com/owncloud/reva/v2/pkg/token/manager/jwt"
)
var _ = Describe("Authenticating requests", Label("BasicAuthenticator"), func() {
var authenticator Authenticator
var roleAssigner *userRoleMocks.UserRoleAssigner
ub := mocks.UserBackend{}
ub.On("Authenticate", mock.Anything, "testuser", "testpassword").Return(
&userv1beta1.User{
@@ -33,9 +38,15 @@ var _ = Describe("Authenticating requests", Label("BasicAuthenticator"), func()
ub.On("Authenticate", mock.Anything, mock.Anything, mock.Anything).Return(nil, "", backend.ErrAccountNotFound)
BeforeEach(func() {
roleAssigner = &userRoleMocks.UserRoleAssigner{}
roleAssigner.EXPECT().ApplyUserRole(mock.Anything, mock.Anything).RunAndReturn(
func(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { return user, nil },
).Maybe()
authenticator = BasicAuthenticator{
Logger: log.NewLogger(),
UserProvider: &ub,
Logger: log.NewLogger(),
UserProvider: &ub,
UserRoleAssigner: roleAssigner,
}
})
@@ -49,19 +60,83 @@ var _ = Describe("Authenticating requests", Label("BasicAuthenticator"), func()
Expect(err).ToNot(HaveOccurred())
Expect(req2).ToNot(BeNil())
})
It("adds claims to the request context", func() {
It("puts the authenticated user into the request context", func() {
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
req.SetBasicAuth("testuser", "testpassword")
req2, err := authenticator.Authenticate(req)
Expect(err).ToNot(HaveOccurred())
claims := oidc.FromContext(req2.Context())
Expect(claims).ToNot(BeNil())
Expect(claims[oidc.Iss]).To(Equal("IdpId"))
Expect(claims[oidc.PreferredUsername]).To(Equal("testuser"))
Expect(claims[oidc.Email]).To(Equal("testuser@example.com"))
Expect(claims[oidc.OwncloudUUID]).To(Equal("OpaqueId"))
user, ok := revactx.ContextGetUser(req2.Context())
Expect(ok).To(Equal(true))
Expect(user.GetId().GetIdp()).To(Equal("IdpId"))
Expect(user.GetId().GetOpaqueId()).To(Equal("OpaqueId"))
Expect(user.GetUsername()).To(Equal("testuser"))
Expect(user.GetMail()).To(Equal("testuser@example.com"))
})
})
When("multi-instance mode is enabled", func() {
It("rejects the request, since basic auth credentials carry no tenant-membership claims", func() {
multiInstanceAuthenticator := BasicAuthenticator{
Logger: log.NewLogger(),
UserProvider: &ub,
UserRoleAssigner: roleAssigner,
MultiInstanceEnabled: true,
}
req := httptest.NewRequest(http.MethodGet, "http://example.com/example/path", http.NoBody)
req.SetBasicAuth("testuser", "testpassword")
req2, err := multiInstanceAuthenticator.Authenticate(req)
Expect(err).To(HaveOccurred())
Expect(req2).To(BeNil())
})
})
When("the account resolver is configured with a non-default PROXY_USER_OIDC_CLAIM", func() {
It("still resolves the already-authenticated user, bypassing claim-based lookup", func() {
req := httptest.NewRequest(http.MethodGet, "http://example.com/graph/v1.0/me", http.NoBody)
req.SetBasicAuth("testuser", "testpassword")
authenticatedReq, err := authenticator.Authenticate(req)
Expect(err).ToNot(HaveOccurred())
resolvedUser := &userv1beta1.User{
Id: &userv1beta1.UserId{Idp: "IdpId", OpaqueId: "OpaqueId"},
Username: "testuser",
}
tokenManager, err := jwt.New(map[string]interface{}{"secret": "change-me", "expires": int64(60)})
Expect(err).ToNot(HaveOccurred())
s, err := scope.AddOwnerScope(nil)
Expect(err).ToNot(HaveOccurred())
token, err := tokenManager.MintToken(context.Background(), resolvedUser, s)
Expect(err).ToNot(HaveOccurred())
resolverBackend := mocks.UserBackend{}
// services/proxy/pkg/middleware/account_resolver.go's verifyUser always looks
// up the user by "username", regardless of the configured PROXY_USER_OIDC_CLAIM,
// because the user arrives already authenticated via the request context.
resolverBackend.On("GetUserByClaims", mock.Anything, "username", "testuser", mock.Anything).Return(resolvedUser, token, nil)
roleAssigner := &userRoleMocks.UserRoleAssigner{}
roleAssigner.EXPECT().ApplyUserRole(mock.Anything, mock.Anything).RunAndReturn(
func(ctx context.Context, user *userv1beta1.User) (*userv1beta1.User, error) { return user, nil },
).Maybe()
resolver := AccountResolver(
Logger(log.NewLogger()),
UserProvider(&resolverBackend),
UserRoleAssigner(roleAssigner),
UserOIDCClaim("sub"),
UserCS3Claim("userid"),
)(mockHandler{})
rw := httptest.NewRecorder()
resolver.ServeHTTP(rw, authenticatedReq)
Expect(rw.Code).To(Equal(http.StatusOK))
})
})
})
+5 -1
View File
@@ -58,7 +58,11 @@ func (m *createHome) ServeHTTP(w http.ResponseWriter, req *http.Request) {
createHomeReq := &provider.CreateHomeRequest{}
u, ok := revactx.ContextGetUser(ctx)
if !ok || u == nil {
m.logger.Error().Msg("no user in context")
// Requests on unprotected routes can carry a reva token without a resolved
// user, e.g. the internal download requests to the data gateway (/data), which
// reva's HTTP client sends with the caller's token. There is no home to create
// for them, so this is expected and not an error.
m.logger.Debug().Str("path", req.URL.Path).Msg("no user in context, not creating a home")
m.next.ServeHTTP(w, req)
return
}
@@ -0,0 +1,39 @@
package middleware
import (
"bytes"
"net/http"
"net/http/httptest"
"testing"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/rs/zerolog"
"github.com/stretchr/testify/assert"
)
// A request with a reva token but no user, like reva's internal download requests to
// the data gateway, is passed on unchanged and does not log an error.
func TestCreateHomeWithoutUserPassesThroughQuietly(t *testing.T) {
// Other tests in this package raise the global level; let error lines through.
defer zerolog.SetGlobalLevel(zerolog.GlobalLevel())
zerolog.SetGlobalLevel(zerolog.TraceLevel)
var buf bytes.Buffer
logger := log.Logger{Logger: zerolog.New(&buf).Level(zerolog.InfoLevel)}
nextCalled := false
next := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
nextCalled = true
w.WriteHeader(http.StatusOK)
})
sut := CreateHome(Logger(logger))(next)
req := httptest.NewRequest(http.MethodGet, "/data/some-transfer-token", nil)
req.Header.Set("x-access-token", "a-token")
rw := httptest.NewRecorder()
sut.ServeHTTP(rw, req)
assert.True(t, nextCalled)
assert.Equal(t, http.StatusOK, rw.Code)
assert.Empty(t, buf.String())
}
+53 -36
View File
@@ -1,7 +1,9 @@
package middleware
import (
"context"
"net/http"
"strconv"
"strings"
"time"
@@ -16,16 +18,22 @@ import (
const defaultMFASessionDuration = 3600
// MultiFactor returns a middleware that checks requests for mfa
// mfaSessionDuration returns the configured MFA session duration or the default.
func mfaSessionDuration(cfg config.MFAConfig) time.Duration {
if cfg.SessionDuration <= 0 {
return defaultMFASessionDuration * time.Second
}
return time.Duration(cfg.SessionDuration) * time.Second
}
// MultiFactor returns a middleware that checks requests for mfa.
//
// It must run after the AccountResolver, which adds the user to the context.
// The user is needed to store and to read the MFA status.
func MultiFactor(cfg config.MFAConfig, opts ...Option) func(next http.Handler) http.Handler {
options := newOptions(opts...)
logger := options.Logger
sessionDuration := cfg.SessionDuration
if sessionDuration <= 0 {
sessionDuration = defaultMFASessionDuration
}
return func(next http.Handler) http.Handler {
return &MultiFactorAuthentication{
next: next,
@@ -33,7 +41,7 @@ func MultiFactor(cfg config.MFAConfig, opts ...Option) func(next http.Handler) h
enabled: cfg.Enabled,
authLevelNames: cfg.AuthLevelNames,
store: options.MFAStore,
sessionDuration: time.Duration(sessionDuration) * time.Second,
sessionDuration: mfaSessionDuration(cfg),
}
}
}
@@ -45,9 +53,9 @@ type MultiFactorAuthentication struct {
enabled bool
authLevelNames []string
sessionDuration time.Duration
// store persists verified MFA status so that non-OIDC requests (e.g.
// signed-URL archiver downloads) can inherit it from the user's most
// recent OIDC session. Nil when no store is configured.
// store holds the time of the last request with MFA of a user, so that requests
// without claims (e.g. signed-URL downloads) can inherit the MFA status. Nil when
// no store is configured.
store microstore.Store
}
@@ -75,20 +83,14 @@ func (m MultiFactorAuthentication) ServeHTTP(w http.ResponseWriter, req *http.Re
claims := oidc.FromContext(ctx)
if claims == nil {
// No OIDC claims — request was authenticated via a non-OIDC method
// (e.g. signed URL, basic auth, app token). MFA cannot be determined
// No OIDC claims, e.g. the request has a signed URL. MFA cannot be determined
// from claims directly.
//
// Fall back to the persisted MFA status from the user's most recent
// OIDC-authenticated session. This allows, for example, a signed-URL
// archiver download to succeed when the user has recently proven MFA
// in their browser session.
if m.store != nil {
if u, ok := revactx.ContextGetUser(ctx); ok && u.GetId().GetOpaqueId() != "" {
if m.readMFAFromStore(u.GetId().GetOpaqueId()) {
ctx = revactx.SetMFA(ctx)
}
}
// Fall back to the stored MFA status from the most recent request with MFA
// of the user. This allows, for example, a signed-URL archiver download to
// succeed when the user has recently proven MFA in their browser session.
if m.readMFAFromStore(ctx) {
ctx = revactx.SetMFA(ctx)
}
m.logger.Debug().Str("path", req.URL.Path).Bool("mfaStatus", revactx.HasMFA(ctx)).Msg("no OIDC claims in context")
@@ -105,15 +107,7 @@ func (m MultiFactorAuthentication) ServeHTTP(w http.ResponseWriter, req *http.Re
} else {
m.logger.Debug().Str("acr", value).Str("url", req.URL.Path).Msg("mfa authenticated")
ctx = revactx.SetMFA(ctx)
// Persist the verified MFA status so that subsequent non-OIDC requests
// (e.g. signed-URL archiver downloads) can inherit it. The entry is
// refreshed on every successful OIDC MFA verification and expires after
// the configured session duration if no further OIDC requests are made.
if m.store != nil {
if u, ok := revactx.ContextGetUser(ctx); ok && u.GetId().GetOpaqueId() != "" {
m.writeMFAToStore(u.GetId().GetOpaqueId())
}
}
m.writeMFAToStore(ctx)
}
// MFA status will only be true if the acr claim contains the proper value,
@@ -121,18 +115,35 @@ func (m MultiFactorAuthentication) ServeHTTP(w http.ResponseWriter, req *http.Re
m.next.ServeHTTP(w, req.WithContext(ctx))
}
func (m MultiFactorAuthentication) readMFAFromStore(userID string) bool {
// readMFAFromStore checks if the user had MFA in an OIDC request within the session duration.
// The age is checked here because stores like nats-js-kv ignore the expiry of a record.
func (m MultiFactorAuthentication) readMFAFromStore(ctx context.Context) bool {
userID := mfaUserID(ctx)
if m.store == nil || userID == "" {
return false
}
records, err := m.store.Read(key(userID))
if err != nil || len(records) == 0 {
return false
}
return string(records[0].Value) == "true"
verifiedAt, err := strconv.ParseInt(string(records[0].Value), 10, 64)
if err != nil {
return false
}
return time.Since(time.Unix(verifiedAt, 0)) < m.sessionDuration
}
func (m MultiFactorAuthentication) writeMFAToStore(userID string) {
// writeMFAToStore stores the time of the last request with MFA of the user, so that requests
// without claims (e.g. signed-URL downloads) can inherit the MFA status, see readMFAFromStore.
func (m MultiFactorAuthentication) writeMFAToStore(ctx context.Context) {
userID := mfaUserID(ctx)
if m.store == nil || userID == "" {
return
}
if err := m.store.Write(&microstore.Record{
Key: key(userID),
Value: []byte("true"),
Key: key(userID),
Value: []byte(strconv.FormatInt(time.Now().Unix(), 10)),
// redis honors the expiry, nats-js-kv uses the TTL of the bucket instead
Expiry: m.sessionDuration,
}); err != nil {
m.logger.Error().Err(err).Str("userID", userID).Msg("failed to write MFA status to store")
@@ -149,6 +160,12 @@ func (m MultiFactorAuthentication) containsMFA(value string) bool {
return false
}
// mfaUserID returns the id of the user in the context, or "" if there is no user.
func mfaUserID(ctx context.Context) string {
u, _ := revactx.ContextGetUser(ctx)
return u.GetId().GetOpaqueId()
}
func key(userID string) string {
return "mfa:" + userID
}
+114
View File
@@ -0,0 +1,114 @@
package middleware
import (
"net/http"
"net/http/httptest"
"strconv"
"testing"
"time"
userpb "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
"github.com/owncloud/ocis/v2/ocis-pkg/oidc"
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
revactx "github.com/owncloud/reva/v2/pkg/ctx"
"github.com/stretchr/testify/assert"
"go-micro.dev/v4/store"
)
var mfaTestUser = &userpb.User{Id: &userpb.UserId{OpaqueId: "user-1"}}
// mfaChain mirrors the proxy order: MultiFactor runs after the user is resolved.
func mfaChain(cfg config.MFAConfig, s store.Store, hasMFA *bool) http.Handler {
resolveUser := func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
next.ServeHTTP(w, r.WithContext(revactx.ContextSetUser(r.Context(), mfaTestUser)))
})
}
final := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
*hasMFA = revactx.HasMFA(r.Context())
})
return resolveUser(MultiFactor(cfg, Logger(log.NopLogger()), MFAStore(s))(final))
}
func oidcRequest(acr string) *http.Request {
req := httptest.NewRequest(http.MethodGet, "https://example.com/dav/spaces/vault", nil)
return req.WithContext(oidc.NewContext(req.Context(), map[string]any{"acr": acr}))
}
// signedURLRequest has no OIDC claims.
func signedURLRequest() *http.Request {
req := httptest.NewRequest(http.MethodGet, "https://example.com/dav/spaces/vault?OC-Signature=abc", nil)
return req.WithContext(revactx.ContextSetUser(req.Context(), mfaTestUser))
}
func TestMultiFactor_signedURLInheritsMFAFromOIDCRequest(t *testing.T) {
cfg := config.MFAConfig{Enabled: true, AuthLevelNames: []string{"advanced"}, SessionDuration: 60}
s := store.NewMemoryStore()
var hasMFA bool
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), oidcRequest("advanced"))
assert.True(t, hasMFA)
records, err := s.Read(key(mfaTestUser.GetId().GetOpaqueId()))
assert.NoError(t, err)
assert.Len(t, records, 1)
assert.Greater(t, records[0].Expiry, time.Duration(0))
assert.LessOrEqual(t, records[0].Expiry, 60*time.Second)
hasMFA = false
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), signedURLRequest())
assert.True(t, hasMFA)
}
func TestMultiFactor_noMFAPersistedWithoutRequiredAcr(t *testing.T) {
cfg := config.MFAConfig{Enabled: true, AuthLevelNames: []string{"advanced"}, SessionDuration: 60}
s := store.NewMemoryStore()
var hasMFA bool
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), oidcRequest("regular"))
assert.False(t, hasMFA)
_, err := s.Read(key(mfaTestUser.GetId().GetOpaqueId()))
assert.ErrorIs(t, err, store.ErrNotFound)
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), signedURLRequest())
assert.False(t, hasMFA)
}
func TestMultiFactor_signedURLWithoutPriorOIDCRequestHasNoMFA(t *testing.T) {
cfg := config.MFAConfig{Enabled: true, AuthLevelNames: []string{"advanced"}, SessionDuration: 60}
var hasMFA bool
mfaChain(cfg, store.NewMemoryStore(), &hasMFA).ServeHTTP(httptest.NewRecorder(), signedURLRequest())
assert.False(t, hasMFA)
}
func TestMultiFactor_expiredStoreEntryHasNoMFA(t *testing.T) {
cfg := config.MFAConfig{Enabled: true, AuthLevelNames: []string{"advanced"}, SessionDuration: 60}
s := store.NewMemoryStore()
var hasMFA bool
verifiedAt := time.Now().Add(-61 * time.Second).Unix()
assert.NoError(t, s.Write(&store.Record{
Key: key(mfaTestUser.GetId().GetOpaqueId()),
Value: []byte(strconv.FormatInt(verifiedAt, 10)),
}))
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), signedURLRequest())
assert.False(t, hasMFA)
}
func TestMultiFactor_disabledDoesNotPersist(t *testing.T) {
cfg := config.MFAConfig{Enabled: false, AuthLevelNames: []string{"advanced"}}
s := store.NewMemoryStore()
var hasMFA bool
mfaChain(cfg, s, &hasMFA).ServeHTTP(httptest.NewRecorder(), oidcRequest("advanced"))
// MultiFactor always sets MFA when disabled, but nothing needs to be persisted
assert.True(t, hasMFA)
_, err := s.Read(key(mfaTestUser.GetId().GetOpaqueId()))
assert.ErrorIs(t, err, store.ErrNotFound)
}
+31
View File
@@ -165,3 +165,34 @@ func TestRouter(t *testing.T) {
}
}
}
// Vault /graph/ sub-routes must reach the same service as their non-vault counterpart.
func TestRouterVaultGraphSubRoutes(t *testing.T) {
cfg := defaults.DefaultConfig()
cfg.Policies = defaults.DefaultPolicies()
reg := registry.GetRegistry()
sel := selector.NewSelector(selector.Registry(reg))
router := New(sel, cfg.PolicySelector, cfg.Policies, log.NewLogger())
// Each path must match its own route, not a catch-all.
paths := []string{
"/graph/v1beta1/extensions/org.libregraph/activities",
"/vault/graph/v1beta1/extensions/org.libregraph/activities",
"/graph/v1.0/invitations",
"/vault/graph/v1.0/invitations",
}
for _, path := range paths {
r := httptest.NewRequest("GET", path, nil)
ri, ok := router.Route(r)
if !ok {
t.Errorf("router.Route failed to route %s", path)
continue
}
if ri.endpoint != path {
t.Errorf("%s matched endpoint %q, want %q — got routed to the generic graph catch-all instead", path, ri.endpoint, path)
}
}
}
+8 -25
View File
@@ -4,11 +4,7 @@ import (
"context"
cs3 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/middleware"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
settingsService "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
"github.com/owncloud/reva/v2/pkg/utils"
"go-micro.dev/v4/metadata"
)
type defaultRoleAssigner struct {
@@ -39,27 +35,9 @@ func (d defaultRoleAssigner) UpdateUserRoleAssignment(ctx context.Context, user
return nil, err
}
if len(roleIDs) == 0 {
// This user doesn't have a role assignment yet. Assign a
// default user role. At least until proper roles are provided. See
// https://github.com/owncloud/ocis/issues/1825 for more context.
if user.Id.Type == cs3.UserType_USER_TYPE_PRIMARY || user.Id.Type == cs3.UserType_USER_TYPE_GUEST {
roleId := settingsService.BundleUUIDRoleUser
if user.Id.Type == cs3.UserType_USER_TYPE_GUEST {
roleId = settingsService.BundleUUIDRoleUserLight
}
d.logger.Info().Str("userid", user.Id.OpaqueId).Msg("user has no role assigned, assigning default user role")
ctx = metadata.Set(ctx, middleware.AccountID, user.Id.OpaqueId)
_, err := d.roleService.AssignRoleToUser(ctx, &settingssvc.AssignRoleToUserRequest{
AccountUuid: user.Id.OpaqueId,
RoleId: roleId,
})
if err != nil {
d.logger.Error().Err(err).Msg("Could not add default role")
return nil, err
}
roleIDs = append(roleIDs, roleId)
}
roleIDs, err = bootstrapDefaultRoleIfNeeded(ctx, user, roleIDs, d.roleService, d.logger)
if err != nil {
return nil, err
}
}
@@ -76,6 +54,11 @@ func (d defaultRoleAssigner) ApplyUserRole(ctx context.Context, user *cs3.User)
return nil, err
}
roleIDs, err = bootstrapDefaultRoleIfNeeded(ctx, user, roleIDs, d.roleService, d.logger)
if err != nil {
return nil, err
}
user.Opaque = utils.AppendJSONToOpaque(user.Opaque, "roles", roleIDs)
return user, nil
}
@@ -0,0 +1,79 @@
package userroles
import (
"context"
"testing"
cs3user "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
settingsmsg "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/settings/v0"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
graphmocks "github.com/owncloud/ocis/v2/services/graph/mocks"
settingsService "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
"github.com/owncloud/reva/v2/pkg/utils"
"github.com/stretchr/testify/mock"
)
// TestApplyUserRoleBootstrapsDefaultRoleForNewUser verifies that ApplyUserRole,
// just like UpdateUserRoleAssignment, assigns a default role to a user who
// doesn't have one yet. This matters for authentication paths (such as app
// passwords) that only call ApplyUserRole and never go through claims-based
// UpdateUserRoleAssignment, so a user who never logged in interactively must
// still end up with a role.
func TestApplyUserRoleBootstrapsDefaultRoleForNewUser(t *testing.T) {
const userOpaqueID = "user-1"
roleService := &graphmocks.RoleService{}
roleService.On("ListRoleAssignments", mock.Anything, mock.Anything, mock.Anything).Return(
&settingssvc.ListRoleAssignmentsResponse{}, nil)
roleService.On("AssignRoleToUser", mock.Anything, mock.MatchedBy(func(req *settingssvc.AssignRoleToUserRequest) bool {
return req.GetAccountUuid() == userOpaqueID && req.GetRoleId() == settingsService.BundleUUIDRoleUser
}), mock.Anything).Return(&settingssvc.AssignRoleToUserResponse{Assignment: &settingsmsg.UserRoleAssignment{
Id: "new-assignment-id",
AccountUuid: userOpaqueID,
RoleId: settingsService.BundleUUIDRoleUser,
}}, nil)
ra := NewDefaultRoleAssigner(WithRoleService(roleService), WithLogger(log.NopLogger()))
user := &cs3user.User{Id: &cs3user.UserId{OpaqueId: userOpaqueID, Type: cs3user.UserType_USER_TYPE_PRIMARY}}
updated, err := ra.ApplyUserRole(context.Background(), user)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
var roleIDs []string
if err := utils.ReadJSONFromOpaque(updated.GetOpaque(), "roles", &roleIDs); err != nil {
t.Fatalf("could not read roles from opaque: %v", err)
}
if len(roleIDs) != 1 || roleIDs[0] != settingsService.BundleUUIDRoleUser {
t.Fatalf("expected the default user role to be bootstrapped, got %v", roleIDs)
}
roleService.AssertCalled(t, "AssignRoleToUser", mock.Anything, mock.MatchedBy(func(req *settingssvc.AssignRoleToUserRequest) bool {
return req.GetAccountUuid() == userOpaqueID && req.GetRoleId() == settingsService.BundleUUIDRoleUser
}), mock.Anything)
}
// TestApplyUserRoleDoesNotBootstrapForLightweightUser verifies that
// ApplyUserRole never assigns a default role to a lightweight (federated)
// user, mirroring UpdateUserRoleAssignment's existing behavior.
func TestApplyUserRoleDoesNotBootstrapForLightweightUser(t *testing.T) {
const userOpaqueID = "lightweight-user-1"
roleService := &graphmocks.RoleService{}
roleService.On("ListRoleAssignments", mock.Anything, mock.Anything, mock.Anything).Return(
&settingssvc.ListRoleAssignmentsResponse{}, nil)
ra := NewDefaultRoleAssigner(WithRoleService(roleService), WithLogger(log.NopLogger()))
user := &cs3user.User{Id: &cs3user.UserId{OpaqueId: userOpaqueID, Type: cs3user.UserType_USER_TYPE_LIGHTWEIGHT}}
_, err := ra.ApplyUserRole(context.Background(), user)
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
roleService.AssertNotCalled(t, "AssignRoleToUser", mock.Anything, mock.Anything, mock.Anything)
}
+32
View File
@@ -6,9 +6,12 @@ import (
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
cs3 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
ocismiddleware "github.com/owncloud/ocis/v2/ocis-pkg/middleware"
settingssvc "github.com/owncloud/ocis/v2/protogen/gen/ocis/services/settings/v0"
"github.com/owncloud/ocis/v2/services/proxy/pkg/config"
settingsService "github.com/owncloud/ocis/v2/services/settings/pkg/service/v0"
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
"go-micro.dev/v4/metadata"
)
// UserRoleAssigner allows providing different implementations for how users get their default roles
@@ -77,6 +80,35 @@ func WithServiceAccount(c config.ServiceAccount) Option {
}
}
// bootstrapDefaultRoleIfNeeded assigns the default "User" role (or "User Light"
// for guests) when the user has no role assignment yet, so that users who only
// ever authenticate without going through UpdateUserRoleAssignment (e.g. via an
// app password) still end up with a role. See
// https://github.com/owncloud/ocis/issues/1825 for context.
func bootstrapDefaultRoleIfNeeded(ctx context.Context, user *cs3.User, roleIDs []string, roleService settingssvc.RoleService, logger log.Logger) ([]string, error) {
if len(roleIDs) != 0 {
return roleIDs, nil
}
if user.Id.Type != cs3.UserType_USER_TYPE_PRIMARY && user.Id.Type != cs3.UserType_USER_TYPE_GUEST {
return roleIDs, nil
}
roleID := settingsService.BundleUUIDRoleUser
if user.Id.Type == cs3.UserType_USER_TYPE_GUEST {
roleID = settingsService.BundleUUIDRoleUserLight
}
logger.Info().Str("userid", user.Id.OpaqueId).Msg("user has no role assigned, assigning default user role")
ctx = metadata.Set(ctx, ocismiddleware.AccountID, user.Id.OpaqueId)
if _, err := roleService.AssignRoleToUser(ctx, &settingssvc.AssignRoleToUserRequest{
AccountUuid: user.Id.OpaqueId,
RoleId: roleID,
}); err != nil {
logger.Error().Err(err).Msg("Could not add default role")
return nil, err
}
return append(roleIDs, roleID), nil
}
// loadRolesIDs returns the role-ids assigned to an user
func loadRolesIDs(ctx context.Context, opaqueUserID string, rs settingssvc.RoleService) ([]string, error) {
req := &settingssvc.ListRoleAssignmentsRequest{AccountUuid: opaqueUserID}
+4
View File
@@ -170,6 +170,10 @@ ocis search index --all-spaces
Note that either `--space $SPACE_ID` or `--all-spaces` must be set.
The command does not open the index itself: it asks the running search service to do the indexing over gRPC. The search service must therefore be running, and the command works with the default `SEARCH_ENGINE_BLEVE_SCALE=false` (see [Scaling](#scaling)); the service's exclusive lock on the index does not block it.
The command waits for the service to walk the space and gives up after 10 minutes by default. The walk is cancelled when that happens, so a large space, or one where the content extractor is slow on a few files, may need a longer limit: `--timeout 2h` (a Go duration; `0` waits indefinitely).
## Notes
The indexing process tries to be self-healing in some situations.
+20 -2
View File
@@ -17,7 +17,12 @@ import (
"github.com/owncloud/ocis/v2/services/search/pkg/config/parser"
)
// Index is the entrypoint for the server command.
// _noTimeout stands in for "no limit" when --timeout is 0: go-micro treats a
// zero RequestTimeout as an immediately expired deadline, so a far-off one is
// used instead.
const _noTimeout = 100 * 365 * 24 * time.Hour
// Index is the entrypoint for the index command.
func Index(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "index",
@@ -34,6 +39,11 @@ func Index(cfg *config.Config) *cli.Command {
Name: "all-spaces",
Usage: "index all spaces instead. This or --space is required.",
},
&cli.DurationFlag{
Name: "timeout",
Usage: "how long to wait for the indexing to finish before giving up, e.g. 2h. The walk is cancelled when the timeout expires. 0 waits indefinitely.",
Value: 10 * time.Minute,
},
},
Before: func(_ *cli.Context) error {
return configlog.ReturnFatal(parser.ParseConfig(cfg))
@@ -57,10 +67,18 @@ func Index(cfg *config.Config) *cli.Command {
return err
}
// The service walks the whole space inside this request, so the
// request timeout bounds the walk: when it expires the walk is
// cancelled and everything after that point stays unindexed.
timeout := ctx.Duration("timeout")
if timeout <= 0 {
timeout = _noTimeout
}
c := searchsvc.NewSearchProviderService("com.owncloud.api.search", grpcClient)
_, err = c.IndexSpace(context.Background(), &searchsvc.IndexSpaceRequest{
SpaceId: ctx.String("space"),
}, func(opts *client.CallOptions) { opts.RequestTimeout = 10 * time.Minute })
}, func(opts *client.CallOptions) { opts.RequestTimeout = timeout })
if err != nil {
fmt.Println("failed to index space: " + err.Error())
return err
+3 -3
View File
@@ -66,7 +66,7 @@ type Cache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;SETTINGS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;SETTINGS_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;SETTINGS_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;SETTINGS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;SETTINGS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;SETTINGS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;SETTINGS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;SETTINGS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;SETTINGS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+2 -2
View File
@@ -27,8 +27,8 @@ type Config struct {
PublicSharingDrivers PublicSharingDrivers `yaml:"public_sharing_drivers"`
WriteableShareMustHavePassword bool `yaml:"public_sharing_writeableshare_must_have_password" env:"OCIS_SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD;SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD" desc:"Set this to true if you want to enforce passwords on Uploader, Editor or Contributor shares." introductionVersion:"5.0"`
PublicShareMustHavePassword bool `yaml:"public_sharing_share_must_have_password" env:"OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD;SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" desc:"Set this to true if you want to enforce passwords on all public shares." introductionVersion:"5.0"`
EnableExpiredSharesCleanup bool `yaml:"enable_expired_shares_cleanup" env:"OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP;SHARING_ENABLE_EXPIRED_SHARES_CLEANUP" desc:"Enable the periodic removal of expired public shares. When disabled, expired shares are still hidden from listings but never actually deleted." introductionVersion:"8.3.0"`
JanitorRunInterval int `yaml:"janitor_run_interval" env:"OCIS_SHARING_JANITOR_RUN_INTERVAL;SHARING_JANITOR_RUN_INTERVAL" desc:"Interval in seconds between two runs of the janitor that permanently deletes expired public shares. Defaults to '3600' (1 hour). Only relevant when OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP is enabled." introductionVersion:"8.3.0"`
EnableExpiredSharesCleanup bool `yaml:"enable_expired_shares_cleanup" env:"OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP;SHARING_ENABLE_EXPIRED_SHARES_CLEANUP" desc:"Enable the periodic removal of expired public shares. When disabled, expired shares are still hidden from listings but never actually deleted." introductionVersion:"9.0.0"`
JanitorRunInterval int `yaml:"janitor_run_interval" env:"OCIS_SHARING_JANITOR_RUN_INTERVAL;SHARING_JANITOR_RUN_INTERVAL" desc:"Interval in seconds between two runs of the janitor that permanently deletes expired public shares. Defaults to '3600' (1 hour). Only relevant when OCIS_SHARING_ENABLE_EXPIRED_SHARES_CLEANUP is enabled." introductionVersion:"9.0.0"`
EnableUserSharing bool `yaml:"enable_user_sharing" env:"OCIS_ENABLE_USER_SHARING" desc:"Enables direct sharing with users and groups. When disabled, creating new user or group shares is rejected. Public link sharing is not affected." introductionVersion:"8.2.0"`
EnablePublicSharing bool `yaml:"enable_public_sharing" env:"OCIS_ENABLE_PUBLIC_SHARING" desc:"Enables public link sharing. When disabled, creating new public links is rejected. Direct sharing with users and groups is not affected." introductionVersion:"8.2.0"`
PasswordPolicy PasswordPolicy `yaml:"password_policy"`
@@ -70,7 +70,7 @@ type Store struct {
Table string `yaml:"table" env:"STORAGE_PUBLICLINK_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"8.0.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;STORAGE_PUBLICLINK_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;STORAGE_PUBLICLINK_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;STORAGE_PUBLICLINK_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;STORAGE_PUBLICLINK_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;STORAGE_PUBLICLINK_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;STORAGE_PUBLICLINK_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;STORAGE_PUBLICLINK_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;STORAGE_PUBLICLINK_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+3 -3
View File
@@ -93,7 +93,7 @@ type Cache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_SYSTEM_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_SYSTEM_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_SYSTEM_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_SYSTEM_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_SYSTEM_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_SYSTEM_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_SYSTEM_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
+13 -5
View File
@@ -22,12 +22,14 @@ import (
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config/parser"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/event"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/logging"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/revaconfig"
"github.com/owncloud/reva/v2/pkg/events"
"github.com/owncloud/reva/v2/pkg/storage"
"github.com/owncloud/reva/v2/pkg/storage/fs/registry"
"github.com/owncloud/reva/v2/pkg/storage/utils/decomposedfs/lookup"
"github.com/owncloud/reva/v2/pkg/storage/utils/decomposedfs/node"
"github.com/owncloud/reva/v2/pkg/upload"
"github.com/owncloud/reva/v2/pkg/utils"
)
@@ -125,15 +127,21 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
os.Exit(1)
}
drivers := revaconfig.StorageProviderDrivers(cfg)
fs, err := f(drivers[cfg.Driver].(map[string]interface{}), nil, nil)
driverConf, ok := drivers[cfg.Driver].(map[string]interface{})
if !ok {
fmt.Fprintf(os.Stderr, "No configuration found for filesystem driver '%s'\n", cfg.Driver)
os.Exit(1)
}
fs, err := f(driverConf, nil, nil)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize filesystem driver '%s'\n", cfg.Driver)
return err
}
managingFS, ok := fs.(storage.UploadSessionLister)
if !ok {
fmt.Fprintf(os.Stderr, "'%s' storage does not support listing upload sessions\n", cfg.Driver)
logger := logging.Configure(cfg.Service.Name, cfg.Log)
coord, err := upload.NewCoordinatorFromConfig("", driverConf, fs, nil, &logger.Logger, false)
if err != nil {
fmt.Fprintf(os.Stderr, "Failed to initialize the upload coordinator: %v\n", err)
os.Exit(1)
}
@@ -147,7 +155,7 @@ func ListUploadSessions(cfg *config.Config) *cli.Command {
}
filter := buildFilter(c)
uploads, err := managingFS.ListUploadSessions(c.Context, filter)
uploads, err := coord.ListUploadSessions(c.Context, filter)
if err != nil {
return err
}
+6 -6
View File
@@ -231,9 +231,9 @@ type FilemetadataCache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_FILEMETADATA_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_FILEMETADATA_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_FILEMETADATA_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// IDCache holds cache config
@@ -245,9 +245,9 @@ type IDCache struct {
DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"`
AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_ID_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_ID_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_ID_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_ID_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_ID_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_ID_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// S3Driver is the storage driver configuration when using 's3' storage driver
+3 -3
View File
@@ -48,9 +48,9 @@ type Persistence struct {
TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;USERLOG_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;USERLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;USERLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;USERLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;USERLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"8.3.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;USERLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"`
EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;USERLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;USERLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured. Do not enable this in production because it disables authentication of the NATS server. Use it only for testing with self-signed certificates." introductionVersion:"9.0.0"`
TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;USERLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"9.0.0"`
}
// Events combines the configuration options for the event bus.
+1 -1
View File
@@ -84,7 +84,7 @@ type LDAPDriver struct {
DisableUserMechanism string `yaml:"disable_user_mechanism" env:"OCIS_LDAP_DISABLE_USER_MECHANISM;USERS_LDAP_DISABLE_USER_MECHANISM" desc:"An option to control the behavior for disabling users. Valid options are 'none', 'attribute' and 'group'. If set to 'group', disabling a user via API will add the user to the configured group for disabled users, if set to 'attribute' this will be done in the ldap user entry, if set to 'none' the disable request is not processed." introductionVersion:"pre5.0"`
UserTypeAttribute string `yaml:"user_type_attribute" env:"OCIS_LDAP_USER_SCHEMA_USER_TYPE;USERS_LDAP_USER_TYPE_ATTRIBUTE" desc:"LDAP Attribute to distinguish between 'Member' and 'Guest' users. Default is 'ownCloudUserType'." introductionVersion:"pre5.0"`
LdapDisabledUsersGroupDN string `yaml:"ldap_disabled_users_group_dn" env:"OCIS_LDAP_DISABLED_USERS_GROUP_DN;USERS_LDAP_DISABLED_USERS_GROUP_DN" desc:"The distinguished name of the group to which added users will be classified as disabled when 'disable_user_mechanism' is set to 'group'." introductionVersion:"pre5.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance." introductionVersion:"7.0"`
MasterID string `yaml:"master_id" env:"OCIS_MULTI_INSTANCE_MASTER_ID" desc:"The master instance ID for multi-instance setups. When set, LDAP user filters are enhanced to also match users belonging to the master instance. Also set 'user_filter'. Without an explicit 'user_filter', this instance resolves every user in the shared LDAP directory." introductionVersion:"7.0"`
UserMemberAttribute string `yaml:"user_member_attribute" env:"OCIS_LDAP_USER_MEMBER_ATTRIBUTE" desc:"LDAP attribute that marks a user as a member of an instance." introductionVersion:"7.0"`
UserGuestAttribute string `yaml:"user_guest_attribute" env:"OCIS_LDAP_USER_GUEST_ATTRIBUTE" desc:"LDAP attribute that marks a user as a guest of an instance." introductionVersion:"7.0"`
UserSchema LDAPUserSchema `yaml:"user_schema"`
@@ -42,5 +42,9 @@ func Validate(cfg *config.Config) error {
return shared.MissingLDAPBindPassword(cfg.Service.Name)
}
if cfg.Driver == "ldap" && cfg.Drivers.LDAP.MasterID != "" && cfg.Drivers.LDAP.UserFilter == "" {
return shared.MissingLDAPUserFilterForMasterID(cfg.Service.Name)
}
return nil
}
@@ -0,0 +1,63 @@
package parser
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/owncloud/ocis/v2/services/users/pkg/config"
)
func TestValidateMasterIDRequiresUserFilter(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "users"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.Error(t, err)
}
func TestValidateMasterIDWithUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "users"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "master-1",
UserFilter: "(ownCloudMemberOf=instance-1)",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
func TestValidateNoMasterIDWithEmptyUserFilterPasses(t *testing.T) {
cfg := &config.Config{
Service: config.Service{Name: "users"},
TokenManager: &config.TokenManager{JWTSecret: "secret"},
Driver: "ldap",
Drivers: config.Drivers{
LDAP: config.LDAPDriver{
BindPassword: "secret",
MasterID: "",
UserFilter: "",
},
},
}
err := Validate(cfg)
assert.NoError(t, err)
}
+14
View File
@@ -1093,6 +1093,20 @@ class CliContext implements Context {
$this->featureContext->setResponse(CliHelper::runCommand($body));
}
/**
* @When the administrator resumes all the upload session using the post processing command
*
* @return void
* @throws GuzzleException
*/
public function theAdministratorResumesAllUploadSessionUsingPostprocessingCommand(): void {
$command = "postprocessing resume";
$body = [
"command" => $command,
];
$this->featureContext->setResponse(CliHelper::runCommand($body));
}
/**
* @When the administrator restarts the expired upload sessions using the CLI
*
@@ -247,3 +247,27 @@ Feature: List upload sessions via CLI command
When the administrator waits for "3" seconds
Then for user "Alice" file "file2.txt" of space "Personal" should be in postprocessing
And the content of file "file1.txt" for user "Alice" should be "uploaded content"
Scenario: resume all upload where postprocessing is finished, but not for unfinished upload using postprocessing command
Given the config "POSTPROCESSING_DELAY" has been set to "3s"
And user "Alice" has created a new TUS resource in the space "Personal" with the following headers:
| Upload-Length | 10 |
# dGV4dEZpbGUudHh0 is the base64 encode of textFile.txt
| Upload-Metadata | filename dGV4dEZpbGUudHh0 |
| Tus-Resumable | 1.0.0 |
And user "Alice" has uploaded file with checksum "SHA1 8cb2237d0679ca88db6464eac60da96345513964" to the last created TUS Location with offset "0" and content "12345" via TUS inside of the space "Personal" using the WebDAV API
And user "Alice" has uploaded file with content "uploaded content" to "file.txt"
And the administrator has waited for "1" seconds
And the administrator has stopped the server
And the administrator has started the server
When the administrator resumes all the upload session using the post processing command
Then the command should be successful
When the administrator waits for "3" seconds
Then the content of file "file.txt" for user "Alice" should be "uploaded content"
When the administrator lists all the upload sessions
Then the command should be successful
And the CLI response should contain these entries:
| textFile.txt |
And the CLI response should not contain these entries:
| file.txt |
+2
View File
@@ -74,6 +74,7 @@ if [[ "$ENABLE_WOPI" == "true" ]]; then
-e 's/{{- include "ocis.extraVolMounts" \. | nindent 12 }}/{{- include "ocis.extraVolMounts" $ | nindent 12 }}/' \
-e 's/{{- include "ocis.extraVolumes" \. | nindent 8 }}/{{- include "ocis.extraVolumes" $ | nindent 8 }}/' \
$TPL_DIR/collaboration/deployment.yaml
sed -i "s|availableUnifiedRoles: \[\]|availableUnifiedRoles: ['b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5','a8d5fe5e-96e3-418d-825b-534dbdf22b99','fb6c3e19-e378-47e5-b277-9732f9de6e21','58c63c02-1d89-4572-916a-870abc5a1b7d','2d00ce52-1fc2-4dbc-8b95-a73b73395f5a','1c996275-f1c9-4e71-abdf-a42f6495e960','312c0871-5ef7-4b3a-85b6-0e4074c64049','aa97fe03-7980-45ac-9e50-b325749fd7e6']|" $CFG_DIR/values.yaml
fi
if [[ "$ENABLE_OCM" == "true" ]]; then
@@ -86,6 +87,7 @@ fi
if [[ "$ENABLE_VAULT" == "true" ]]; then
sed -i '/vault:/{n;s|false|true|}' $CFG_DIR/values.yaml
sed -i '/mfa:/{n;s|false|true|}' $CFG_DIR/values.yaml
# baking keycloak url into the base CSP would affect every other suite that
# shares this same values.yaml, breaking their fixed CSP header assertions.
sed -i "/defaultSrc:/i\\ - 'https://keycloak:8443/'" $CFG_DIR/values.yaml
+4 -7
View File
@@ -137,13 +137,10 @@
- name: IDM_CREATE_DEMO_USERS
value: "false"
{{- end -}}
{{- if eq .appName "storageusers-vault" }}
- name: STORAGE_USERS_ENABLE_VAULT_MODE
value: "true"
- name: STORAGE_USERS_SERVICE_NAME
value: storage-users-vault
- name: STORAGE_USERS_EVENTS_CONSUMER_GROUP
value: vault-dcfs
{{- if eq .appName "storageusersvault" }}
{{/* ocis-charts added native support for this service upstream (appName "storageusersvault").
The native deployment.yaml already sets STORAGE_USERS_ENABLE_VAULT_MODE,
STORAGE_USERS_SERVICE_NAME and STORAGE_USERS_EVENTS_CONSUMER_GROUP itself. */}}
{{/* Without these overrides this instance falls back to the shared OCIS_CACHE_STORE=nats-js-kv
used by the regular storage-users service. Since personal-space IDs are just the user's
opaque ID (identical in both instances), the vault instance's existence check on
@@ -1,161 +0,0 @@
{{- if .Values.features.vault.enabled }}
{{- include "ocis.basicServiceTemplates" (dict "scope" . "appName" "appNameStorageUsers" "appNameSuffix" "vault") -}}
apiVersion: apps/v1
kind: Deployment
{{ include "ocis.metadata" . }}
spec:
{{- include "ocis.selector" . | nindent 2 }}
{{- if and (not .Values.autoscaling.enabled) (.Values.replicas) }}
replicas: {{ .Values.replicas }}
{{- end }}
{{- include "ocis.deploymentStrategy" . | nindent 2 }}
template:
{{- include "ocis.templateMetadata" (dict "scope" $ "configCheck" false) | nindent 4 }}
spec:
{{- include "ocis.affinity" $ | nindent 6 }}
{{- include "ocis.securityContextAndtopologySpreadConstraints" . | nindent 6 }}
{{- include "ocis.priorityClassName" $.priorityClassName | nindent 6 }}
{{- include "ocis.hostAliases" $ | nindent 6 }}
nodeSelector: {{ toYaml $.nodeSelector | nindent 8 }}
containers:
- name: {{ .appName }}
{{- include "ocis.image" $ | nindent 10 }}
command: ["ocis"]
args: ["storage-users", "server"]
{{- include "ocis.containerSecurityContext" . | nindent 10 }}
env:
{{- include "ocis.serviceRegistry" . | nindent 12 }}
{{- include "ocis.events" . | nindent 12 }}
{{- include "ocis.cacheStore" . | nindent 12 }}
{{- include "ocis.cors" . | nindent 12 }}
# this is a secondary storage-users instance, dedicated to vault storage
# see tests/config/k8s/templates/extra.tpl for STORAGE_USERS_ENABLE_VAULT_MODE
# and STORAGE_USERS_SERVICE_NAME
- name: STORAGE_USERS_GATEWAY_GRPC_ADDR
value: {{ .appNameGateway }}:9142
- name: STORAGE_USERS_LOG_COLOR
value: {{ .Values.logging.color | quote }}
- name: STORAGE_USERS_LOG_LEVEL
value: {{ .Values.logging.level | quote }}
- name: STORAGE_USERS_LOG_PRETTY
value: {{ .Values.logging.pretty | quote }}
- name: STORAGE_USERS_TRACING_ENABLED
value: "{{ .Values.tracing.enabled }}"
- name: STORAGE_USERS_TRACING_TYPE
value: {{ .Values.tracing.type | quote }}
- name: STORAGE_USERS_TRACING_ENDPOINT
value: {{ .Values.tracing.endpoint | quote }}
- name: STORAGE_USERS_TRACING_COLLECTOR
value: {{ .Values.tracing.collector | quote }}
- name: STORAGE_USERS_DEBUG_PPROF
value: {{ .Values.debug.profiling | quote }}
- name: STORAGE_USERS_GRPC_ADDR
value: 0.0.0.0:9157
- name: STORAGE_USERS_DEBUG_ADDR
value: 0.0.0.0:9159
- name: STORAGE_USERS_HTTP_ADDR
value: 0.0.0.0:9158
- name: STORAGE_USERS_DATA_SERVER_URL
value: "http://{{ .appName }}:9158/data"
- name: STORAGE_USERS_DRIVER
value: ocis
- name: STORAGE_USERS_OCIS_MAX_CONCURRENCY
value: {{ .Values.services.storageusers.storageBackend.driverConfig.ocis.maxConcurrency | quote }}
- name: STORAGE_USERS_UPLOAD_EXPIRATION
value: {{ .Values.services.storageusers.maintenance.cleanUpExpiredUploads.uploadExpiration | quote }}
- name: STORAGE_USERS_PURGE_TRASH_BIN_PERSONAL_DELETE_BEFORE
value: {{ .Values.services.storageusers.maintenance.purgeExpiredTrashBinItems.personalDeleteBefore | quote}}
- name: STORAGE_USERS_PURGE_TRASH_BIN_PROJECT_DELETE_BEFORE
value: {{ .Values.services.storageusers.maintenance.purgeExpiredTrashBinItems.projectDeleteBefore | quote }}
- name: STORAGE_USERS_SERVICE_ACCOUNT_ID
valueFrom:
configMapKeyRef:
name: {{ include "config.authService" . }}
key: service-account-id
- name: STORAGE_USERS_SERVICE_ACCOUNT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "secrets.serviceAccountSecret" . }}
key: service-account-secret
- name: STORAGE_USERS_STAT_CACHE_STORE
value: noop
- name: STORAGE_USERS_MOUNT_ID
valueFrom:
configMapKeyRef:
name: {{ include "config.storageUsers" . }}
key: storage-uuid
- name: STORAGE_USERS_JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "secrets.jwtSecret" . }}
key: jwt-secret
- name: OCIS_TRANSFER_SECRET
valueFrom:
secretKeyRef:
name: {{ include "secrets.transferSecret" . }}
key: transfer-secret
- name: OCIS_ASYNC_UPLOADS
value: "true"
- name: STORAGE_USERS_EVENTS_NUM_CONSUMERS
value: {{ .Values.services.storageusers.events.consumer.concurrency | quote }}
- name: STORAGE_USERS_DATA_GATEWAY_URL
value: "http://{{ .appNameFrontend }}:9140/data/"
{{- include "ocis.caEnv" $ | nindent 12}}
{{- include "ocis.extraEnvs" . | nindent 12}}
{{- include "ocis.livenessProbe" . | nindent 10 }}
resources: {{ toYaml .resources | nindent 12 }}
ports:
- name: grpc
containerPort: 9157
- name: http
containerPort: 9158
- name: metrics-debug
containerPort: 9159
volumeMounts:
- name: tmp-volume
mountPath: /tmp
- name: messaging-system-ca
mountPath: /etc/ocis/messaging-system-ca
readOnly: true
- name: {{ include "ocis.persistence.dataVolumeName" . }}
mountPath: /var/lib/ocis
{{- include "ocis.caPath" $ | nindent 12}}
{{- include "ocis.extraVolMounts" . | nindent 12}}
{{- include "ocis.imagePullSecrets" $ | nindent 6 }}
volumes:
- name: tmp-volume
emptyDir: {}
- name: messaging-system-ca
{{ if and (.Values.messagingSystem.external.enabled) (not .Values.messagingSystem.external.tls.certTrusted) }}
secret:
secretName: {{ include "secrets.messagingSystemCASecret" . }}
{{ else }}
emptyDir: {}
{{ end }}
{{- include "ocis.caVolume" $ | nindent 8}}
{{- include "ocis.persistence.dataVolume" . | nindent 8 }}
{{- include "ocis.extraVolumes" . | nindent 8}}
{{- end -}}
@@ -1,28 +0,0 @@
{{- if .Values.features.vault.enabled }}
{{- include "ocis.basicServiceTemplates" (dict "scope" . "appName" "appNameStorageUsers" "appNameSuffix" "vault") -}}
apiVersion: v1
kind: Service
metadata:
name: {{ .appName }}
namespace: {{ template "ocis.namespace" . }}
labels:
app: {{ .appName }}
ocis-metrics: enabled
{{- include "ocis.labels" . | nindent 4 }}
spec:
selector:
app: {{ .appName }}
ports:
- name: grpc
port: 9157
protocol: TCP
appProtocol: {{ .Values.service.appProtocol.grpc | quote}}
- name: http
port: 9158
protocol: TCP
appProtocol: {{ .Values.service.appProtocol.http | quote}}
- name: metrics-debug
port: 9159
protocol: TCP
appProtocol: {{ .Values.service.appProtocol.http | quote}}
{{- end -}}
+31 -2
View File
@@ -18,6 +18,8 @@ features:
enabled: false
vault:
enabled: false
mfa:
enabled: false
emailNotifications:
enabled: false
smtp:
@@ -49,21 +51,45 @@ features:
max: '0'
appsIntegration:
enabled: false
mimetypes:
- mime_type: application/vnd.oasis.opendocument.text
extension: odt
name: OpenDocument
description: OpenDocument text document
icon: ""
default_app: Collabora
allow_creation: true
- mime_type: application/vnd.openxmlformats-officedocument.wordprocessingml.document
extension: docx
name: Microsoft Word
description: Microsoft Word document
icon: ""
default_app: OnlyOffice
allow_creation: true
- mime_type: text/plain
extension: txt
name: Plain text
description: Plain text file
icon: ""
default_app: FakeOffice
allow_creation: true
wopiIntegration:
officeSuites:
- name: 'Collabora'
uri: 'https://collabora:9980'
iconURI: 'https://collabora:9980/favicon.ico'
wopiSrc: 'http://ocis-server:9300'
product: 'Collabora'
enabled: true
insecure: true
disableProof: true
secureViewEnabled: false
secureViewEnabled: true
disableChat: true
ingress:
enabled: false
- name: 'FakeOffice'
uri: 'http://fakeoffice:8080'
iconURI: 'http://fakeoffice:8080/favicon.ico'
wopiSrc: 'http://ocis-server:9301'
product: 'FakeOffice'
enabled: true
@@ -75,6 +101,7 @@ features:
enabled: false
- name: 'OnlyOffice'
uri: 'https://onlyoffice:7443'
iconURI: 'https://onlyoffice:7443/web-apps/apps/documenteditor/main/resources/img/favicon.ico'
wopiSrc: 'http://ocis-server:9302'
product: 'OnlyOffice'
enabled: true
@@ -84,6 +111,8 @@ features:
disableChat: true
ingress:
enabled: false
roles:
availableUnifiedRoles: []
http:
cors:
@@ -149,7 +178,7 @@ services:
enabled: true
accessModes:
- ReadWriteOnce
storageusers-vault:
storageusersvault:
persistence:
enabled: false
ocm:
+5 -1
View File
@@ -50,7 +50,8 @@ func Key(key string) func(r *http.Request) (string, error) {
// CanonicalizeIP normalizes a client IP string for use as a rate-limit key:
//
// - IPv4 addresses are returned unchanged.
// - IPv4 addresses are returned unchanged. IPv4 mapped IPv6 addresses use
// their dotted IPv4 form.
// - IPv6 addresses are reduced to their /64 prefix. An IPv6 client typically
// controls a whole /64 (2^64 addresses via SLAAC), so keying on the full
// address would let it rotate within its own /64 to win a fresh bucket per
@@ -94,6 +95,9 @@ func CanonicalizeIP(ip string) string {
if ipv6 == nil {
return ip
}
if ipv4 := ipv6.To4(); ipv4 != nil {
return ipv4.String()
}
return ipv6.Mask(net.CIDRMask(64, 128)).String()
}
+6 -6
View File
@@ -83,16 +83,16 @@ func (l *Conn) Add(addRequest *AddRequest) error {
return err
}
if len(packet.Children) < 2 {
return fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
protocolOp, err := packetChild(packet, 1)
if err != nil {
return err
}
if packet.Children[1].Tag == ApplicationAddResponse {
err := GetLDAPError(packet)
if err != nil {
if protocolOp.Tag == ApplicationAddResponse {
if err := GetLDAPError(packet); err != nil {
return err
}
} else {
return fmt.Errorf("ldap: unexpected response: %d", packet.Children[1].Tag)
return fmt.Errorf("ldap: unexpected response: %d", protocolOp.Tag)
}
return nil
}
+125 -68
View File
@@ -6,15 +6,15 @@ import (
"crypto/rand"
"encoding/binary"
"encoding/hex"
enchex "encoding/hex"
"errors"
"fmt"
"io/ioutil"
"io"
"strings"
"unicode/utf16"
"github.com/Azure/go-ntlmssp"
ber "github.com/go-asn1-ber/asn1-ber"
//lint:ignore SA1019 NTLM requires MD4; there is no secure replacement for the protocol.
"golang.org/x/crypto/md4" //nolint:staticcheck
)
@@ -77,15 +77,26 @@ func (l *Conn) SimpleBind(simpleBindRequest *SimpleBindRequest) (*SimpleBindResu
return nil, err
}
return decodeSimpleBindResult(packet)
}
// decodeSimpleBindResult decodes a bind response envelope, including any
// response controls. It is separated from the network loop so the full
// response decoder can be fuzzed directly.
func decodeSimpleBindResult(packet *ber.Packet) (*SimpleBindResult, error) {
result := &SimpleBindResult{
Controls: make([]Control, 0),
}
if len(packet.Children) == 3 {
for _, child := range packet.Children[2].Children {
controls, ok, err := packetChildIfPresent(packet, 2)
if err != nil {
return nil, err
}
if ok {
for _, child := range controls.Children {
decodedChild, decodeErr := DecodeControl(child)
if decodeErr != nil {
return nil, fmt.Errorf("failed to decode child control: %s", decodeErr)
return nil, fmt.Errorf("failed to decode child control: %w", decodeErr)
}
result.Controls = append(result.Controls, decodedChild)
}
@@ -196,26 +207,35 @@ func (l *Conn) DigestMD5Bind(digestMD5BindRequest *DigestMD5BindRequest) (*Diges
Controls: make([]Control, 0),
}
var params map[string]string
if len(packet.Children) == 2 {
if len(packet.Children[1].Children) == 4 {
child := packet.Children[1].Children[0]
if child.Tag != ber.TagEnumerated {
_, hasControls, err := packetChildIfPresent(packet, 2)
if err != nil {
return nil, err
}
if !hasControls {
challenge, perr := packetChild(packet, 1)
if perr == nil {
challengeChild, hasChallengeChild, cerr := packetChildIfPresent(challenge, 3)
if cerr != nil {
return result, GetLDAPError(packet)
}
if child.Value.(int64) != 14 {
return result, GetLDAPError(packet)
}
child = packet.Children[1].Children[3]
if child.Tag != ber.TagObjectDescriptor {
return result, GetLDAPError(packet)
}
if child.Data == nil {
return result, GetLDAPError(packet)
}
data, _ := ioutil.ReadAll(child.Data)
params, err = parseParams(string(data))
if err != nil {
return result, fmt.Errorf("parsing digest-challenge: %s", err)
if hasChallengeChild {
child, perr := packetChild(challenge, 0)
if perr != nil || child.Tag != ber.TagEnumerated {
return result, GetLDAPError(packet)
}
code, perr := packetInt64(child)
if perr != nil || code != 14 {
return result, GetLDAPError(packet)
}
child = challengeChild
if child.Tag != ber.TagObjectDescriptor || child.Data == nil {
return result, GetLDAPError(packet)
}
data, _ := io.ReadAll(child.Data)
params, err = parseParams(string(data))
if err != nil {
return result, fmt.Errorf("parsing digest-challenge: %s", err)
}
}
}
}
@@ -257,30 +277,45 @@ func (l *Conn) DigestMD5Bind(digestMD5BindRequest *DigestMD5BindRequest) (*Diges
return nil, fmt.Errorf("read packet: %s", err)
}
if len(packet.Children) == 2 {
response := packet.Children[1]
if response == nil {
_, hasControls, err := packetChildIfPresent(packet, 2)
if err != nil {
return nil, err
}
if !hasControls {
response, rerr := packetChild(packet, 1)
if rerr != nil {
return result, GetLDAPError(packet)
}
if response.ClassType == ber.ClassApplication && response.TagType == ber.TypeConstructed && len(response.Children) >= 3 {
if ber.Type(response.Children[0].Tag) == ber.Type(ber.TagInteger) || ber.Type(response.Children[0].Tag) == ber.Type(ber.TagEnumerated) {
resultCode := uint16(response.Children[0].Value.(int64))
if resultCode == 14 {
msgCtx, err := l.doRequest(digestMD5BindRequest)
if err != nil {
return nil, err
if response.ClassType == ber.ClassApplication && response.TagType == ber.TypeConstructed {
if _, rerr := packetChildCount(response, 3, -1, "bind response"); rerr == nil {
resultCodeChild, rerr := packetChild(response, 0)
if rerr != nil {
return result, GetLDAPError(packet)
}
if ber.Type(resultCodeChild.Tag) == ber.Type(ber.TagInteger) || ber.Type(resultCodeChild.Tag) == ber.Type(ber.TagEnumerated) {
resultCode, rerr := packetResultCode(resultCodeChild)
if rerr != nil {
return result, GetLDAPError(packet)
}
defer l.finishMessage(msgCtx)
packetResponse, ok := <-msgCtx.responses
if !ok {
return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
}
packet, err = packetResponse.ReadPacket()
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
if err != nil {
return nil, fmt.Errorf("read packet: %s", err)
if resultCode == 14 {
msgCtx, err := l.doRequest(digestMD5BindRequest)
if err != nil {
return nil, err
}
defer l.finishMessage(msgCtx)
packetResponse, ok := <-msgCtx.responses
if !ok {
return nil, NewError(ErrorNetwork, errors.New("ldap: response channel closed"))
}
packet, err = packetResponse.ReadPacket()
l.Debug.Printf("%d: got response %p", msgCtx.id, packet)
if err != nil {
return nil, fmt.Errorf("read packet: %s", err)
}
}
}
} else {
return result, GetLDAPError(packet)
}
}
}
@@ -373,7 +408,7 @@ func computeResponse(params map[string]string, uri, username, password string) (
if err != nil {
return "", err
}
cnonce := enchex.EncodeToString(rb)
cnonce := hex.EncodeToString(rb)
x := username + ":" + params["realm"] + ":" + password
y := md5Hash([]byte(x))
@@ -384,8 +419,8 @@ func computeResponse(params map[string]string, uri, username, password string) (
}
a2 := bytes.NewBuffer([]byte("AUTHENTICATE"))
a2.WriteString(":" + uri)
ha1 := enchex.EncodeToString(md5Hash(a1.Bytes()))
ha2 := enchex.EncodeToString(md5Hash(a2.Bytes()))
ha1 := hex.EncodeToString(md5Hash(a1.Bytes()))
ha2 := hex.EncodeToString(md5Hash(a2.Bytes()))
kd := ha1
kd += ":" + params["nonce"]
@@ -393,7 +428,7 @@ func computeResponse(params map[string]string, uri, username, password string) (
kd += ":" + cnonce
kd += ":" + qop
kd += ":" + ha2
resp := enchex.EncodeToString(md5Hash([]byte(kd)))
resp := hex.EncodeToString(md5Hash([]byte(kd)))
return fmt.Sprintf(
`username="%s",realm="%s",nonce="%s",cnonce="%s",nc=00000001,qop=%s,digest-uri="%s",response=%s`,
quotedStringEscape(username),
@@ -502,8 +537,8 @@ func (req *NTLMBindRequest) appendTo(envelope *ber.Packet) (err error) {
var negMessage []byte
// generate an NTLMSSP Negotiation message for the specified domain (it can be blank)
switch {
case req.Negotiator == nil:
switch req.Negotiator {
case nil:
negMessage, err = ntlmssp.NewNegotiateMessage(req.Domain, "")
if err != nil {
return fmt.Errorf("create NTLM negotiate message: %s", err)
@@ -596,15 +631,29 @@ func (l *Conn) NTLMChallengeBind(ntlmBindRequest *NTLMBindRequest) (*NTLMBindRes
var ntlmsspChallenge []byte
// now find the NTLM Response Message
if len(packet.Children) == 2 {
if len(packet.Children[1].Children) == 3 {
child := packet.Children[1].Children[1]
ntlmsspChallenge = child.ByteValue
// Check to make sure we got the right message. It will always start with NTLMSSP
if len(ntlmsspChallenge) < 7 || !bytes.Equal(ntlmsspChallenge[:7], []byte("NTLMSSP")) {
_, hasControls, err := packetChildIfPresent(packet, 2)
if err != nil {
return nil, err
}
if !hasControls {
protocolOp, perr := packetChild(packet, 1)
if perr == nil {
protocolOpChildren, cerr := packetChildCount(protocolOp, 3, -1, "bind response")
if cerr != nil {
return result, GetLDAPError(packet)
}
l.Debug.Printf("%d: found ntlmssp challenge", msgCtx.id)
if len(protocolOpChildren) == 3 {
child, perr := packetChild(protocolOp, 1)
if perr != nil {
return result, GetLDAPError(packet)
}
ntlmsspChallenge = child.ByteValue
// Check to make sure we got the right message. It will always start with NTLMSSP
if len(ntlmsspChallenge) < 7 || !bytes.Equal(ntlmsspChallenge[:7], []byte("NTLMSSP")) {
return result, GetLDAPError(packet)
}
l.Debug.Printf("%d: found ntlmssp challenge", msgCtx.id)
}
}
}
if ntlmsspChallenge != nil {
@@ -615,11 +664,12 @@ func (l *Conn) NTLMChallengeBind(ntlmBindRequest *NTLMBindRequest) (*NTLMBindRes
case ntlmBindRequest.Hash == "" && ntlmBindRequest.Password == "" && !ntlmBindRequest.AllowEmptyPassword:
err = fmt.Errorf("need a password or hash to generate reply")
case ntlmBindRequest.Negotiator == nil && ntlmBindRequest.Hash != "":
responseMessage, err = ntlmssp.ProcessChallengeWithHash(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Hash)
responseMessage, err = ntlmssp.NewAuthenticateMessage(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Hash, &ntlmssp.AuthenticateMessageOptions{
PasswordHashed: true,
})
case ntlmBindRequest.Negotiator == nil && (ntlmBindRequest.Password != "" || ntlmBindRequest.AllowEmptyPassword):
// generate a response message to the challenge with the given Username/Password if password is provided
_, _, domainNeeded := ntlmssp.GetDomain(ntlmBindRequest.Username)
responseMessage, err = ntlmssp.ProcessChallenge(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Password, domainNeeded)
responseMessage, err = ntlmssp.NewAuthenticateMessage(ntlmsspChallenge, ntlmBindRequest.Username, ntlmBindRequest.Password, nil)
default:
hash := ntlmBindRequest.Hash
if len(hash) == 0 {
@@ -739,7 +789,7 @@ func (l *Conn) GSSAPIBindRequest(client GSSAPIClient, req *GSSAPIBindRequest) er
return l.GSSAPIBindRequestWithAPOptions(client, req, []int{})
}
// GSSAPIBindRequest performs the GSSAPI SASL bind using the provided GSSAPI client.
// GSSAPIBindRequestWithAPOptions performs the GSSAPI SASL bind using the provided GSSAPI client and AP options.
func (l *Conn) GSSAPIBindRequestWithAPOptions(client GSSAPIClient, req *GSSAPIBindRequest, APOptions []int) error {
//nolint:errcheck
defer client.DeleteSecContext()
@@ -819,33 +869,40 @@ func (l *Conn) saslBindTokenExchange(reqControls []Control, reqToken []byte) ([]
// packet is an envelope
// child 0 is message id
// child 1 is protocolOp
if len(packet.Children) != 2 {
if _, err := packetChildCount(packet, 2, 2, "bind response"); err != nil {
return nil, fmt.Errorf("bad bind response")
}
protocolOp := packet.Children[1]
protocolOp, err := packetChild(packet, 1)
if err != nil {
return nil, fmt.Errorf("bad bind response")
}
RESP:
switch protocolOp.Description {
case "Bind Response": // Bind Response
// Bind Reponse is an LDAP Response (https://www.rfc-editor.org/rfc/rfc4511#section-4.1.9)
// with an additional optional serverSaslCreds string (https://www.rfc-editor.org/rfc/rfc4511#section-4.2.2)
// child 0 is resultCode
resultCode := protocolOp.Children[0]
if resultCode.Tag != ber.TagEnumerated {
resultCode, rcErr := packetChild(protocolOp, 0)
if rcErr != nil || resultCode.Tag != ber.TagEnumerated {
break RESP
}
switch resultCode.Value.(int64) {
code, rcErr := packetInt64(resultCode)
if rcErr != nil {
break RESP
}
switch code {
case 14: // Sasl bind in progress
if len(protocolOp.Children) < 3 {
referral, ok, refErr := packetChildIfPresent(protocolOp, 3)
if refErr != nil || !ok {
break RESP
}
referral := protocolOp.Children[3]
switch referral.Description {
case "Referral":
if referral.ClassType != ber.ClassContext || referral.Tag != ber.TagObjectDescriptor {
if referral.ClassType != ber.ClassContext || referral.Tag != ber.TagObjectDescriptor || referral.Data == nil {
break RESP
}
return ioutil.ReadAll(referral.Data)
return io.ReadAll(referral.Data)
}
// Optional:
//if len(protocolOp.Children) == 4 {
+5 -4
View File
@@ -46,10 +46,11 @@ func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
return false, err
}
if len(packet.Children) < 2 {
return false, fmt.Errorf("ldap: malformed response: expected at least 2 children, got %d", len(packet.Children))
protocolOp, err := packetChild(packet, 1)
if err != nil {
return false, err
}
if packet.Children[1].Tag == ApplicationCompareResponse {
if protocolOp.Tag == ApplicationCompareResponse {
err := GetLDAPError(packet)
switch {
@@ -61,5 +62,5 @@ func (l *Conn) Compare(dn, attribute, value string) (bool, error) {
return false, err
}
}
return false, fmt.Errorf("unexpected Response: %d", packet.Children[1].Tag)
return false, fmt.Errorf("unexpected Response: %d", protocolOp.Tag)
}
+12 -5
View File
@@ -204,7 +204,7 @@ func (dc *DialContext) dial(u *url.URL) (net.Conn, error) {
return tls.DialWithDialer(dc.dialer, "tcp", net.JoinHostPort(host, port), dc.tlsConfig)
}
return nil, fmt.Errorf("Unknown scheme '%s'", u.Scheme)
return nil, fmt.Errorf("unknown scheme '%s'", u.Scheme)
}
// Dial connects to the given address on the given network using net.Dial
@@ -463,6 +463,13 @@ func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags)
if l.IsClosing() {
return nil, NewError(ErrorNetwork, errors.New("ldap: connection closed"))
}
messageID, err := packetInt64At(packet, 0)
if err != nil {
// The packet is built by this package, so a malformed one is our bug,
// not a network failure: return the malformed-packet error as-is
// instead of nesting it inside ErrorNetwork.
return nil, err
}
l.messageMutex.Lock()
l.Debug.Printf("flags&startTLS = %d", flags&startTLS)
if l.isStartingTLS {
@@ -481,7 +488,6 @@ func (l *Conn) sendMessageWithFlags(packet *ber.Packet, flags sendMessageFlags)
l.messageMutex.Unlock()
responses := make(chan *PacketResponse)
messageID := packet.Children[0].Value.(int64)
message := &messagePacket{
Op: MessageRequest,
MessageID: messageID,
@@ -659,8 +665,9 @@ func (l *Conn) reader() {
if err := addLDAPDescriptions(packet); err != nil {
l.Debug.Printf("descriptions error: %s", err)
}
if len(packet.Children) == 0 {
l.Debug.Printf("Received bad ldap packet")
messageID, err := packetInt64At(packet, 0)
if err != nil {
l.Debug.Printf("Received bad ldap packet: %s", err)
continue
}
l.messageMutex.Lock()
@@ -670,7 +677,7 @@ func (l *Conn) reader() {
l.messageMutex.Unlock()
message := &messagePacket{
Op: MessageResponse,
MessageID: packet.Children[0].Value.(int64),
MessageID: messageID,
Packet: packet,
}
if !l.sendProcessMessage(message) {
Loaded 100 of 337 files, more files were not shown because too many files have changed in this diff. Show more