Compare commits

...
Author SHA1 Message Date
Lukas Hirt e8119e0fd0 feat(deployments): switch ocis_full example to bind-mounted ./data/ volumes
Replace docker-managed named volumes with ./data/ bind mounts in the
ocis_full deployment example so persisted data is directly accessible
on the host, and add a migrate-volumes.sh helper to copy existing
named-volume data across for upgrading deployments.

Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-08-14 11:21:48 +02:00
Lukas Hirt 2063b84b8f fix(deployment): downgrade drawio image to 0.4.1 in ocis_full example (#12795)
0.4.1 is the latest available version of the draw-io web-extensions image.

Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-08-14 08:50:13 +02:00
Lukas Hirt a3601009ac fix(deployments): support Collabora Online 26.x in ocis_full example (#12794)
* fix(deployments): support Collabora Online 26.x in ocis_full example

collabora/code 26.x dropped the shell (no /bin/bash, no /bin/sh) and the
coolconfig helper the ocis_full example relied on to start the container
and generate its WOPI proof key, so the deployment failed to start and,
once patched to start, would reject every document open with a 500 since
the collaboration service enforces WOPI proof-key verification by default.

Drop the custom bash entrypoint (the image's default entrypoint already
honors extra_params/username/password via --use-env-vars), replace the
bash-based healthcheck with the built-in "coolwsd --probe", and add a
one-shot init container that generates and persists the WOPI proof key
on the host before Collabora starts.

Signed-off-by: Lukas Hirt <info@hirt.cz>

* fix(deployments): self-heal a bad WOPI proof key in ocis_full example

The collabora-proof-key-init container only checked "does /keys/proof_key
exist" before skipping generation. If the collabora service's single-file
bind mount of that path ever won the race against the init container (e.g.
on the very first `docker compose up`, or after an interrupted run), Docker
silently created a directory there instead of a file, which then persisted
across restarts and made coolwsd fail to load the proof key with an
EVPPKey::loadKey DECODER error, breaking WOPI CheckFileInfo for good.

Validate any existing proof_key with `openssl rsa -check` and remove it
before regenerating if it's missing, not a regular file, or invalid, so a
bad state (directory, truncated write, corrupt key) heals itself on the
next start instead of requiring a manual `rm -rf` of the generated config.

Signed-off-by: Lukas Hirt <info@hirt.cz>

---------

Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-08-14 08:42:35 +02:00
Nalem7 86105b86af [tests-only][full-ci] test: add retry once for space creation wherever required (#12785)
test: add retry once for space creation

Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
2026-08-14 12:11:34 +05:45
Pradip Subedi 6dc967e583 [tests-only][full-ci] test: enable secure viewer role before upload in moveReceivedShare scenarios (#12786)
test: enable secure viewer role before upload in moveReceivedShare scenarios
2026-08-14 09:18:37 +05:45
Pradip Subedi af7d39d1b6 [tests-only][full-ci] test: Add acceptance test for empty CallToAction notification translation fix (#12616)
* test: add tests email after changing default language

* test: fix other feature files cleanup

* test: restore unrelated files

* test: add missing unshare strings to test translation fixture

* test: add missing space in email body

* test: assert full translated unshare email and sync userlog fixture

* test: remove unused negative email content step
2026-08-14 09:15:56 +05:45
Lukas Hirt e21e19470b feat(app-store): update app store repository to use ownCloud Marketplace (#12793)
Signed-off-by: Lukas Hirt <info@hirt.cz>
2026-08-13 21:46:59 +02:00
owncloud-translations-bot[bot] 74ae9bf88d chore: update translations from transifex (#12771)
Co-authored-by: owncloud-translations-bot[bot] <274778013+owncloud-translations-bot[bot]@users.noreply.github.com>
2026-08-13 13:54:04 +02:00
Michal Klos d9bae04aee feat: [OCISDEV-1115] harden nats communication (#12777)
* feat: [OCISDEV-1115] harden nats communication

* feat: bump reva for tls-enabled stores
2026-08-13 09:56:24 +00:00
Pradip Subedi 5a2c1cc351 [tests-only] test: add vault public link scenarios (#12735)
test: add vault public link rejection scenarios
2026-08-13 14:53:57 +05:45
Nalem7 4684d3d4ee [tests-only][full-ci] test: add test for space manager removing members (#12776)
test: add test for space manager removing members

Signed-off-by: nabim777 <nabinalemagar019@gmail.com>
2026-08-13 11:42:30 +05:45
Prajwol Amatya c53e2f773e [tests-only][full-ci] test: fix flaky e2e test for tag search (#12780)
test: login user after creating resources via API

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
2026-08-13 11:13:38 +05:45
donmor 3b5bad6ade fix(web): use light logo in light mode (in dark blue background) (#12782) 2026-08-12 19:43:08 +02:00
Alexander Salimonov 81527e98e4 fix: pass mount id to the s3ng storage driver (#12756)
* fix: pass mount id to the s3ng storage driver

Uploads to a s3ng backed storage-users service never left the processing
state, leaving the file unreadable and unmodifiable. This affects every
client equally: WebDAV, the desktop sync client and the web UI.

Decomposedfs discards any event whose storage id does not match its
configured mount id. Only the ocis driver was ever given a mount_id, so
under s3ng the comparison ran against an empty string and every
PostprocessingFinished event was dropped.

Regression since 8.1.0, where the mount-id event filter was introduced
for vault storage.

* fix: adding mount_id in OcisNoEvents and S3NGNoEvents
2026-08-12 10:55:08 +02:00
donmor 36d5089424 Generate web timestamp by env/git log; make it buildable without .git (#12758)
* fix(web): generate web timestamp by env SOURCE_DATE_EPOCH or git log (#12757)

* fix(web): suppress error when make in non-git directory (e.g. source tarballs)

* chore: add changelog for pull 12758

* fix(web): fix env description in changelog; remove cwd from execSync

* fix(web): fix format (prettier check)
2026-08-12 09:03:26 +02:00
Prajwol Amatya f6628b6264 [tests-only][full-ci] test: fix flaky e2e test in e2e-part-3 (#12778)
* test: slow down test run

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

* test: scope temp upload path per Playwright worker

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

---------

Signed-off-by: Prajwol Amatya <prajwolamatya11@gmail.com>
2026-08-12 12:30:12 +05:45
Juan Pablo Villafañez 597104629a fix: use specific gookit config instance instance of using global (#12769)
* fix: use specific gookit config instance instance of using global

Using the global instance was causing a panic when the service was
restarted. That panic won't happen now.

* chore: add changelog entry
2026-08-11 17:48:46 +02:00
Michal Klos 6d3e10c120 fix: [OCISDEV-660] harden GetUserDrive (#12742) 2026-08-11 08:27:14 +00:00
Matteo 8ea724c8a4 chore: remove Vue warnings in web (#12767)
- ResourceTile: drop leading eslint comment (fragment root) and add
  role=presentation so fallthrough attrs and drag listeners inherit and
  the element ref resolves to the card; fixes drag-and-drop crash on tiles
- markRaw components passed as extension/folder-view data to avoid
  reactive-component warnings
- web-app-external: wrap iframe/form in a single root element
- AppWrapper: type currentContent as string
2026-08-10 14:53:47 +02:00
Michal Klos 90148451c8 chore: bump go and web packages (#12765)
* chore: bump go packages

* chore: bump web packages
2026-08-10 11:43:14 +02:00
owncloud-translations-bot[bot] 101e9d6404 chore: update translations from transifex (#12755)
Co-authored-by: owncloud-translations-bot[bot] <274778013+owncloud-translations-bot[bot]@users.noreply.github.com>
2026-08-10 09:03:28 +02:00
Gaurav Soni 07f2a8bba9 fix(web): [OCISDEV-996] truncate long resource names instead of overlapping the next column (#12754)
fix(web): [OCISDEV-996] truncate long resource names instead of overlapping next column

Add `min-width: 0` to `.oc-resource` so the inline-flex item can shrink
below its content width. Without it the automatic min-content floor kept
the element at full name width, painting the name over the adjacent
column's value. The existing `oc-text-truncate` rule on the name span can
now take effect and truncate with an ellipsis at the column boundary.

Most visible in the Spaces overview, where a long space name overlapped
the "Manager" column, but it affected every resource table using the name
column, including the files list and search results.
2026-08-07 16:22:30 +02:00
kobergj 1d70560428 feat(storage-users): add recalculate-treesize command (#12746)
feat(storage-users): [OCISDEV-1203] add recalculate-treesize command

The treesize of a directory is maintained as a running counter that is updated
on every change, so a failed or incomplete update leaves the counter wrong and
the reported quota usage of a space drifts from the data on disk. Removing a node
without propagating the size change leaves its size counted against the quota
with no way to reclaim it.

Add a command that walks a space bottom up, recalculates the treesize of every
directory from the actual size of its children and corrects the stored values:

    ocis storage-users spaces recalculate-treesize --space-id <id>

As with the other maintenance commands --dry-run defaults to true, so the
command reports what it would change until explicitly told to write.

Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
2026-08-07 15:16:12 +02:00
Matteo 3da140042c fix(web): remove focus from file name in app top bar (#12752)
The open file name in the top bar was tabbable via keyboard even
though it is not clickable, which was confusing during keyboard
navigation.
2026-08-07 12:48:50 +00:00
Gaurav Soni f975f00120 fix(web): [OCISDEV-1168] open files whose name contains a hash or question mark (#12740)
Cmd+Clicking or middle-clicking a file with a `#` or `?` in its name opened the
space root instead of the file, and the top bar showed the space name rather than
the file name. The file's path is carried in a route parameter which the router
percent-encodes when it builds the URL, but the editor route was resolved twice
and resolving twice does not encode twice: the second pass rebuilt the URL from
the still-decoded parameter with the encoding step skipped. The browser then read
everything from the `#` onward as a fragment, discarding the query string along
with the `fileId` needed to identify the file. Left clicks were unaffected because
they never leave the app.

Editor routes are now handed to links unresolved, so the file name is encoded
exactly once and survives both a new tab and an in-app navigation. Hash and
question mark remain valid characters in file names.
2026-08-07 12:41:34 +02:00
Matteo e1ee0d01ef chore(web): update dep js-yml to 4.3.1 (#12747) 2026-08-07 11:17:29 +02:00
418 changed files with 21593 additions and 4349 deletions

No files matched your search

+6
View File
@@ -26,6 +26,9 @@ ocis/cmd/ocis/config/
/hugo
/docs/services/*/_index.md
# deployment example runtime data (bind-mounted volumes)
/deployments/examples/ocis_full/data/
# IDEs
.idea
@@ -60,6 +63,9 @@ go.work
go.work.sum
.env
.envrc
# generated secrets for deployment examples (e.g. Collabora WOPI proof key)
deployments/examples/*/config/collabora/
CLAUDE.md
.claude/
GEMINI.md
@@ -0,0 +1,10 @@
Bugfix: Support Collabora Online 26.x in the ocis_full deployment example
collabora/code 26.x ships without a shell and without the `coolconfig` helper the
ocis_full example relied on to start the container and generate its WOPI proof
key, so the example failed to start and, once running, would reject every
document open with a 500. The example now uses the image's default entrypoint
and a one-shot init container that generates and persists the WOPI proof key
before Collabora starts.
https://github.com/owncloud/ocis/pull/12794
@@ -0,0 +1,12 @@
Bugfix: Restarting the proxy service on error was causing panics
Starting oCIS with the `ocis server` command causes oCIS to monitor the
services being started. When a service fails to start, this monitor tries
to restart the services. For the cause of the proxy service, restarting it
was a panic.
Now, the proxy service can be restarted as expected, without that panic.
Note that the service might still fail to start if the actual cause isn't
fixed, such as the service's port being taken by a different application.
https://github.com/owncloud/ocis/pull/12769
@@ -0,0 +1,10 @@
Bugfix: Remove keyboard focus from open file name in top bar
When opening a file such as a text or markdown document, the file name shown
in the top bar could be reached via keyboard tabbing even though it was not
clickable and triggered no action. This made keyboard navigation confusing.
The file name is no longer part of the tab order, since it is a purely
informational, non-interactive element.
https://github.com/owncloud/ocis/pull/12752
@@ -0,0 +1,14 @@
Bugfix: Truncate long resource names instead of overlapping the next column
In resource tables, a name that was too long for its column was not truncated.
Instead it kept its full width and was painted over the value of the adjacent
column, making both unreadable. This was most visible in the Spaces overview,
where a long space name overlapped the "Manager" column, but it affected every
resource table using the name column, including the files list and search
results, as well as the parent folder path shown below a search result.
The name is now truncated with an ellipsis at the column boundary, and the
rename button stays inside the name column. The full name remains available via
the title tooltip on hover.
https://github.com/owncloud/ocis/pull/12754
@@ -0,0 +1,20 @@
Bugfix: Fix uploads stuck in processing with the s3ng storage driver
Uploads to a `s3ng` backed storage-users service never left the processing
state, so the file stayed unreadable and unmodifiable forever. Every client was
affected equally, because the defect sits below the protocol layer: WebDAV, the
desktop sync client and the Web UI alike.
Decomposedfs ignores any event whose storage id does not match its configured
mount id. The `s3ng` driver never received a `mount_id`, so that comparison ran
against an empty string and every `PostprocessingFinished` event was discarded.
The `s3ng` driver now passes `mount_id` the same way the `ocis` driver already
does.
The same key is also added to `OcisNoEvents` and `S3NGNoEvents`. Those build the
storage provider rather than the data provider and configure no events, so today
the value is unused there. Setting it keeps both constructions of the same
storage consistent about their own identity, rather than leaving one of them to
report an empty mount id to any future reader of that option.
https://github.com/owncloud/ocis/pull/12756
@@ -0,0 +1,10 @@
Enhancement: Restrict personal drive information to the owner and admins
The `/graph/v1.0/users/{userID}/drive`, `/graph/v1.0/drives/{driveID}` and
`/graph/v1.0/drives` endpoints now drop personal spaces the caller does not own
unless the caller holds account management permission, leaving project and other
shared space types unaffected. The single-drive and per-user lookups return the
same `404` as a missing drive, so the response does not depend on the target
user's existence.
https://github.com/owncloud/ocis/pull/12742
@@ -0,0 +1,8 @@
Enhancement: Add TLS support for NATS store and registry connections
All `nats-js-kv` store, cache, and service registry connections now support
TLS. Configure via `OCIS_CACHE_ENABLE_TLS`, `OCIS_PERSISTENT_STORE_ENABLE_TLS`,
and `MICRO_REGISTRY_ENABLE_TLS`, with corresponding `*_TLS_INSECURE` and
`*_TLS_ROOT_CA_CERTIFICATE` variants per connection type.
https://github.com/owncloud/ocis/pull/12765
@@ -0,0 +1,21 @@
Enhancement: Add a command to recalculate the treesize of a space
The reported quota usage of a space can drift from the data actually stored on
disk. The treesize of a directory is maintained as a running counter that is
updated on every change, so a failed or incomplete update leaves the counter
wrong. Removing a node without propagating the size change, for example, leaves
its size counted against the quota forever, with no way to reclaim it.
The new command walks a space bottom up, recalculates the treesize of every
directory from the actual size of its children and corrects the stored values:
```
ocis storage-users spaces recalculate-treesize --space-id <id>
ocis storage-users spaces recalculate-treesize --space-id <id> --dry-run=false
```
Omit `--space-id` to process all spaces. As with the other maintenance commands,
`--dry-run` defaults to true, so the command reports what it would change until
it is explicitly told to write.
https://github.com/owncloud/ocis/pull/12746
@@ -0,0 +1,5 @@
Enhancement: Update app store repository
We've updated the default app store repository to use the new ownCloud Marketplace instead of the awesome-ocis repository. The default Content-Security-Policy configuration was also updated to allow connections to the new marketplace domain.
https://github.com/owncloud/ocis/pull/12793
@@ -0,0 +1,17 @@
Bugfix: Open files whose name contains a hash or question mark
Cmd+Clicking or middle-clicking a file with a `#` or `?` in its name opened the
space root instead of the file, and the top bar showed the space name rather than
the file name. The file's path is carried in a route parameter which the router
percent-encodes when it builds the URL, but the editor route was resolved twice
and resolving twice does not encode twice: the second pass rebuilt the URL from
the still-decoded parameter with the encoding step skipped. The browser then read
everything from the `#` onward as a fragment, discarding the query string along
with the `fileId` needed to identify the file. Left clicks were unaffected because
they never leave the app.
Editor routes are now handed to links unresolved, so the file name is encoded
exactly once and survives both a new tab and an in-app navigation. Hash and
question mark remain valid characters in file names.
https://github.com/owncloud/ocis/pull/12740
@@ -0,0 +1,5 @@
fix(web): Use light logo in light mode (with dark blue topbar)
The light theme actually have a dark blue topbar and login screen, where the dark logo is applied and can hardly be seen. This patch changes it to logo.svg (the light logo).
https://github.com/owncloud/ocis/pull/12782
@@ -0,0 +1,5 @@
Bugfix: Generate web timestamp by env/git log; make it buildable without .git
Change compilationTimeStamp to distTimeStamp, set its value from env SOURCE_DATE_EPOCH, or timestamp of last git commit, or fallback to current time. Also fixes a problem that raises an error during make ci-node-generate due to running git clean -xfd in a non-repository directory (usually an extracted source tarball), showing a message instead.
https://github.com/owncloud/ocis/pull/12758
+8 -4
View File
@@ -65,7 +65,8 @@ LOG_LEVEL=
#
# Define the oCIS storage location. Set the paths for config and data to a local path.
# Note that especially the data directory can grow big.
# Leaving it default stores data in docker internal volumes.
# Leaving it default stores data under ./data/ocis-config and ./data/ocis-data
# relative to the compose project directory.
# For more details see:
# https://doc.owncloud.com/ocis/next/deployment/general/general-info.html#default-paths
# OCIS_CONFIG_DIR=/your/local/ocis/config
@@ -134,11 +135,11 @@ START_ADDITIONAL_SERVICES="notifications"
# It is possible to use the oCIS Web Extensions to add custom functionality to the oCIS frontend.
# For more details see https://github.com/owncloud/web-extensions/blob/main/README.md
# Note: the leading colon is required to enable the service.
# Enable this to create a new named volume
# Enable this to store app extension files under ./data/ocis-apps
#EXTENSIONS=:web_extensions/extensions.yml
# Enable the desired extensions by uncommenting the following lines.
# Note: the leading colon is required to enable the service.
# Note: if you want to remove a web extension, you must delete the ocis-apps volume. It will be properly recreated on docker compose startup.
# Note: if you want to remove a web extension, you must delete the ./data/ocis-apps directory. It will be properly recreated on docker compose startup.
#UNZIP=:web_extensions/unzip.yml
#DRAWIO=:web_extensions/drawio.yml
#JSONVIEWER=:web_extensions/jsonviewer.yml
@@ -212,7 +213,7 @@ TIKA_DOCKER_TAG=latest-full
COLLABORA=:collabora.yml
# The recommended (and tested) version to pull. If no version is used, it pulls "latest"
# release notes: https://www.collaboraonline.com/release-notes/
COLLABORA_DOCKER_TAG=25.04.9.3.1
COLLABORA_DOCKER_TAG=26.04.3.1.1
# Domain of Collabora, where you can find the frontend.
# Defaults to "collabora.owncloud.test"
COLLABORA_DOMAIN=
@@ -229,6 +230,9 @@ COLLABORA_SSL_ENABLE=false
# If you're on an internet-facing server, enable SSL verification for Collabora Online.
# Please comment out the following line:
COLLABORA_SSL_VERIFICATION=false
# Path to persist the Collabora Online WOPI proof key across container restarts (auto-generated on first start).
# Leaving it default stores it in ./config/collabora relative to this compose project.
# COLLABORA_CONFIG_DIR=/your/local/collabora/config
## Supplemental Configurations ##
+12
View File
@@ -15,6 +15,18 @@ This deployment example is documented in two locations for different audiences:
Providing details which are more developer focused. This description can also be used when deviating from the default.\
Note that this examples uses self signed certificates and is intended for testing purposes.
## Data Storage
All persistent runtime data (oCIS config/data, S3 storage, database, virus
definitions, web app extensions, etc.) is bind-mounted from a `./data/`
directory next to this compose project, rather than docker-managed named
volumes. The oCIS config/data paths can be redirected elsewhere via the
`OCIS_CONFIG_DIR`/`OCIS_DATA_DIR` variables in `.env`.
Upgrading an existing deployment that still has data in the old named
volumes? Run `./migrate-volumes.sh` once, before starting the stack, to copy
data from the old volumes into the new `./data/` directories.
## Optional Services
### Keycloak
+4 -2
View File
@@ -10,6 +10,9 @@ services:
# PROXY_TLS is set to "false", the download url has no https
STORAGE_USERS_DATA_GATEWAY_URL: http://ocis:9200/data
volumes:
# a named volume is used here instead of a bind mount: it only ever
# holds the runtime clamd.sock and some Docker Desktop hosts don't
# reliably support AF_UNIX sockets on bind-mounted paths
- "clamav-socket:/var/run/clamav"
clamav:
@@ -19,11 +22,10 @@ services:
ocis-net:
volumes:
- "clamav-socket:/tmp"
- "clamav-db:/var/lib/clamav"
- "./data/clamav-db:/var/lib/clamav"
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
clamav-socket:
clamav-db:
+28 -5
View File
@@ -36,8 +36,8 @@ services:
COLLABORATION_LOG_LEVEL: ${LOG_LEVEL:-info}
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
# configure the .env file to use different host paths if desired
- ${OCIS_CONFIG_DIR:-./data/ocis-config}:/etc/ocis
labels:
- "traefik.enable=true"
- "traefik.http.routers.collaboration.entrypoints=http"
@@ -48,10 +48,33 @@ services:
driver: ${LOG_DRIVER:-local}
restart: always
# Since collabora/code 26.x, the image ships without a shell (no /bin/bash, no /bin/sh) and
# without the "coolconfig" helper that used to generate the WOPI proof key on startup.
# This one-shot container generates and persists that key on the host before "collabora" starts.
collabora-proof-key-init:
image: alpine/openssl:latest
user: root
entrypoint: ["/bin/sh", "-c"]
command:
- |
if [ -e /keys/proof_key ] && ! openssl rsa -in /keys/proof_key -check -noout >/dev/null 2>&1; then
echo "/keys/proof_key is missing, not a regular file, or invalid; regenerating" >&2
rm -rf /keys/proof_key
fi
if [ ! -f /keys/proof_key ]; then
openssl genrsa -out /keys/proof_key 2048
chmod 644 /keys/proof_key
fi
volumes:
- ${COLLABORA_CONFIG_DIR:-./config/collabora}:/keys
collabora:
image: collabora/code:${COLLABORA_DOCKER_TAG}
networks:
ocis-net:
depends_on:
collabora-proof-key-init:
condition: service_completed_successfully
environment:
DONT_GEN_SSL_CERT: "YES"
extra_params: |
@@ -62,6 +85,8 @@ services:
--o:net.frame_ancestors=${OCIS_DOMAIN:-ocis.owncloud.test}
username: ${COLLABORA_ADMIN_USER:-admin}
password: ${COLLABORA_ADMIN_PASSWORD:-admin}
volumes:
- ${COLLABORA_CONFIG_DIR:-./config/collabora}/proof_key:/etc/coolwsd/proof_key:ro
cap_add:
- MKNOD
labels:
@@ -74,7 +99,5 @@ services:
logging:
driver: ${LOG_DRIVER:-local}
restart: always
entrypoint: ['/bin/bash', '-c']
command: ['coolconfig generate-proof-key && /start-collabora-online.sh']
healthcheck:
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/9980 && echo -e 'GET /hosting/discovery HTTP/1.1\r\nHost: localhost:9980\r\n\r\n' >&3 && head -n 1 <&3 | grep '200 OK'"]
test: ["CMD", "/usr/bin/coolwsd", "--probe"]
@@ -7,6 +7,7 @@ directives:
- 'https://${COMPANION_DOMAIN|companion.owncloud.test}/'
- 'wss://${COMPANION_DOMAIN|companion.owncloud.test}/'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
# Photo-addon: OpenStreetMap tile requests
@@ -32,6 +33,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${ONLYOFFICE_DOMAIN|onlyoffice.owncloud.test}/'
- 'https://${COLLABORA_DOMAIN|collabora.owncloud.test}/'
@@ -39,7 +39,7 @@ services:
- "443:443"
volumes:
- "${DOCKER_SOCKET_PATH:-/var/run/docker.sock}:/var/run/docker.sock:ro"
- "certs:/certs"
- "./data/certs:/certs"
labels:
- "traefik.enable=${TRAEFIK_DASHBOARD:-false}"
# defaults to admin:admin
@@ -53,8 +53,5 @@ services:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
certs:
networks:
ocis-net:
+1 -4
View File
@@ -27,7 +27,7 @@ services:
networks:
ocis-net:
volumes:
- keycloak_postgres_data:/var/lib/postgresql
- ./data/keycloak-postgres:/var/lib/postgresql
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
@@ -78,6 +78,3 @@ services:
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
keycloak_postgres_data:
+64
View File
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
#
# One-time helper for upgrading an existing ocis_full deployment from the old
# docker-managed named volumes to the new ./data/ bind mounts.
#
# Docker named volumes are not directly accessible from the host, so for each
# volume that still exists we spin up a throwaway container that mounts both
# the old volume and the new host directory, and copy the data across.
#
# Safe to re-run: volumes that no longer exist (fresh installs) are skipped,
# and targets that already contain data are left untouched.
#
# Usage: run this from the ocis_full example directory, before starting the
# stack with `docker compose up` for the first time after upgrading:
# ./migrate-volumes.sh
set -euo pipefail
cd "$(dirname "$0")"
# shellcheck disable=SC1091
[ -f .env ] && source .env
MIGRATIONS=(
"ocis-config:${OCIS_CONFIG_DIR:-./data/ocis-config}"
"ocis-data:${OCIS_DATA_DIR:-./data/ocis-data}"
"ocis-apps:./data/ocis-apps"
"keycloak_postgres_data:./data/keycloak-postgres"
"minio-data:./data/minio"
"clamav-db:./data/clamav-db"
"companion-data:./data/companion"
)
for entry in "${MIGRATIONS[@]}"; do
vol="${entry%%:*}"
target="${entry#*:}"
if ! docker volume inspect "$vol" >/dev/null 2>&1; then
echo "skip ${vol}: no such docker volume (fresh install?)"
continue
fi
mkdir -p "$target"
if [ -n "$(ls -A "$target" 2>/dev/null)" ]; then
echo "skip ${vol}: ${target} already has data, not overwriting"
continue
fi
docker run --rm \
-v "${vol}:/from" \
-v "$(cd "$target" && pwd):/to" \
alpine sh -c "cp -a /from/. /to/"
echo "migrated ${vol} -> ${target}"
done
vol_names=()
for entry in "${MIGRATIONS[@]}"; do
vol_names+=("${entry%%:*}")
done
echo
echo "Done. Verify the deployment works with the new ./data/ paths, then you"
echo "can remove the old named volumes with, e.g.:"
echo " docker volume rm ${vol_names[*]}"
+1 -4
View File
@@ -13,7 +13,7 @@ services:
"mkdir -p /data/${S3NG_BUCKET:-ocis-bucket} && minio server --console-address ':9001' /data",
]
volumes:
- minio-data:/data
- ./data/minio:/data
environment:
MINIO_ACCESS_KEY: ${S3NG_ACCESS_KEY:-ocis}
MINIO_SECRET_KEY: ${S3NG_SECRET_KEY:-ocis-secret-key}
@@ -27,6 +27,3 @@ services:
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
minio-data:
+26 -7
View File
@@ -5,12 +5,35 @@ services:
ocis-net:
aliases:
- ${OCIS_DOMAIN:-ocis.owncloud.test}
# chowns the host-mounted config/data dirs to the oCIS container's non-root
# user (uid/gid 1000) before oCIS itself starts, since bind mounts default
# to being owned by whoever created them on the host. Skips the recursive
# chown on subsequent startups (marker file) so it doesn't re-walk the
# whole data dir, which can grow big, on every restart.
ocis-data-init:
image: alpine:latest
user: root
entrypoint: ["/bin/sh", "-c"]
command:
- >-
for d in /etc/ocis /var/lib/ocis; do
mkdir -p "$$d";
m="$$d/.ocis-data-init-done";
[ -f "$$m" ] || { chown -R 1000:1000 "$$d"; touch "$$m"; };
done
volumes:
- ${OCIS_CONFIG_DIR:-./data/ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-./data/ocis-data}:/var/lib/ocis
ocis:
image: ${OCIS_DOCKER_IMAGE}:${OCIS_DOCKER_TAG}
# changelog: https://github.com/owncloud/ocis/tree/master/changelog
# release notes: https://doc.owncloud.com/ocis_release_notes.html
networks:
ocis-net:
depends_on:
ocis-data-init:
condition: service_completed_successfully
entrypoint:
- /bin/sh
# run ocis init to initialize a configuration file with random secrets
@@ -57,9 +80,9 @@ services:
- ./config/ocis/app-registry.yaml:/etc/ocis/app-registry.yaml
- ./config/ocis/csp.yaml:/etc/ocis/csp.yaml
- ./config/ocis/banned-password-list.txt:/etc/ocis/banned-password-list.txt
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-ocis-data}:/var/lib/ocis
# configure the .env file to use different host paths if desired
- ${OCIS_CONFIG_DIR:-./data/ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-./data/ocis-data}:/var/lib/ocis
labels:
- "traefik.enable=true"
- "traefik.http.routers.ocis.entrypoints=https"
@@ -70,7 +93,3 @@ services:
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
ocis-config:
ocis-data:
@@ -31,8 +31,8 @@ services:
COLLABORATION_LOG_LEVEL: ${LOG_LEVEL:-info}
OCIS_URL: https://${OCIS_DOMAIN:-ocis.owncloud.test}
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
# configure the .env file to use different host paths if desired
- ${OCIS_CONFIG_DIR:-./data/ocis-config}:/etc/ocis
labels:
- "traefik.enable=true"
- "traefik.http.routers.collaboration-oo.entrypoints=http"
@@ -32,9 +32,9 @@ services:
STORAGE_USERS_OCIS_ROOT: /var/lib/ocis/storage/users-vault
STORAGE_USERS_EVENTS_CONSUMER_GROUP: vault-dcfs
volumes:
# configure the .env file to use own paths instead of docker internal volumes
- ${OCIS_CONFIG_DIR:-ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-ocis-data}:/var/lib/ocis
# configure the .env file to use different host paths if desired
- ${OCIS_CONFIG_DIR:-./data/ocis-config}:/etc/ocis
- ${OCIS_DATA_DIR:-./data/ocis-data}:/var/lib/ocis
logging:
driver: ${LOG_DRIVER:-local}
restart: always
@@ -9,7 +9,7 @@ services:
image: owncloud/web-extensions:advanced-search-0.3.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/advanced-search/ /apps"]
@@ -6,10 +6,10 @@ services:
condition: service_completed_successfully
drawio-init:
image: owncloud/web-extensions:draw-io-0.4.4
image: owncloud/web-extensions:draw-io-0.4.1
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/draw-io/ /apps"]
@@ -1,7 +1,4 @@
services:
ocis:
volumes:
- ocis-apps:/var/lib/ocis/web/assets/apps
volumes:
ocis-apps:
- ./data/ocis-apps:/var/lib/ocis/web/assets/apps
@@ -11,7 +11,7 @@ services:
image: owncloud/web-extensions:external-sites-0.4.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/external-sites/ /apps"]
@@ -17,7 +17,7 @@ services:
image: owncloud/web-extensions:importer-0.4.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: [ "-c", "cp -R /var/lib/nginx/html/importer/ /apps" ]
@@ -38,7 +38,7 @@ services:
COMPANION_TUS_DEFERRED_UPLOAD_LENGTH: 'false'
COMPANION_CLIENT_ORIGINS: "https://${OCIS_DOMAIN:-ocis.owncloud.test},https://${COMPANION_DOMAIN:-companion.owncloud.test}"
volumes:
- companion-data:/tmp/companion/
- ./data/companion:/tmp/companion/
labels:
- "traefik.enable=true"
- "traefik.http.routers.companion.entrypoints=https"
@@ -49,6 +49,3 @@ services:
logging:
driver: ${LOG_DRIVER:-local}
restart: always
volumes:
companion-data:
@@ -9,7 +9,7 @@ services:
image: owncloud/web-extensions:json-viewer-0.4.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/json-viewer/ /apps"]
@@ -9,7 +9,7 @@ services:
image: owncloud/web-extensions:photo-addon-0.3.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/photo-addon/ /apps"]
@@ -9,7 +9,7 @@ services:
image: owncloud/web-extensions:progress-bars-0.4.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/progress-bars/ /apps"]
@@ -9,7 +9,7 @@ services:
image: owncloud/web-extensions:unzip-0.5.0
user: root
volumes:
- ocis-apps:/apps
- ./data/ocis-apps:/apps
entrypoint:
- /bin/sh
command: ["-c", "cp -R /var/lib/nginx/html/unzip/ /apps"]
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
default-src:
@@ -23,6 +24,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifest-src:
- '''self'''
media-src:
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
default-src:
- '''none'''
@@ -24,6 +25,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifest-src:
- '''self'''
media-src:
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
default-src:
@@ -23,6 +24,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifest-src:
- '''self'''
media-src:
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
default-src:
- '''none'''
font-src:
@@ -23,6 +24,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifest-src:
- '''self'''
media-src:
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
default-src:
- '''none'''
font-src:
@@ -25,6 +26,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${COLLABORA_DOMAIN|collabora.ocm.next.owncloud.test}/'
manifest-src:
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
default-src:
- '''none'''
font-src:
@@ -25,6 +26,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${ONLYOFFICE_DOMAIN|onlyoffice.owncloud.test}/'
manifest-src:
+7 -1
View File
@@ -74,6 +74,11 @@ See also [example server setup]({{< ref "preparing_server" >}})
`cd ocis/deployments/examples/ocis_full`
* Upgrading an existing deployment? Persistent data now lives under `./data/`
bind mounts instead of docker-managed named volumes. Run
`./migrate-volumes.sh` once, before starting the stack, to copy data from
the old named volumes into the new `./data/` directories.
* Open the `.env` file in a text editor.
The file by default looks like this:
@@ -144,7 +149,8 @@ See also [example server setup]({{< ref "preparing_server" >}})
#
# Define the oCIS storage location. Set the paths for config and data to a local path.
# Note that especially the data directory can grow big.
# Leaving it default stores data in docker internal volumes.
# Leaving it default stores data under ./data/ocis-config and ./data/ocis-data
# relative to the compose project directory.
# For more details see:
# https://doc.owncloud.com/ocis/next/deployment/general/general-info.html#default-paths
# OCIS_CONFIG_DIR=/your/local/ocis/config
+17 -17
View File
@@ -45,7 +45,7 @@ require (
github.com/gookit/config/v2 v2.2.9
github.com/gorilla/mux v1.8.1
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0
github.com/invopop/validation v0.8.0
github.com/jellydator/ttlcache/v2 v2.11.1
github.com/jellydator/ttlcache/v3 v3.4.1
@@ -67,7 +67,7 @@ require (
github.com/open-policy-agent/opa v1.19.0
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-20260806084131-831afd01e5d4
github.com/owncloud/reva/v2 v2.0.0-20260812122437-aa0c3881c0af
github.com/pkg/errors v0.9.1
github.com/pkg/xattr v0.4.12
github.com/prometheus/client_golang v1.24.1
@@ -89,14 +89,14 @@ require (
github.com/xhit/go-simple-mail/v2 v2.16.0
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.69.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0
go.opentelemetry.io/contrib/zpages v0.69.0
go.opentelemetry.io/otel v1.44.0
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0
go.opentelemetry.io/contrib/zpages v0.70.0
go.opentelemetry.io/otel v1.45.0
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0
go.opentelemetry.io/otel/sdk v1.44.0
go.opentelemetry.io/otel/trace v1.44.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0
go.opentelemetry.io/otel/sdk v1.45.0
go.opentelemetry.io/otel/trace v1.45.0
golang.org/x/crypto v0.54.0
golang.org/x/exp v0.0.0-20260410095643-746e56fc9e2f
golang.org/x/image v0.44.0
@@ -105,7 +105,7 @@ require (
golang.org/x/sync v0.22.0
golang.org/x/term v0.45.0
golang.org/x/text v0.40.0
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d
google.golang.org/grpc v1.83.0
google.golang.org/protobuf v1.36.11
gopkg.in/yaml.v2 v2.4.0
@@ -182,14 +182,14 @@ require (
github.com/emvi/iso-639-1 v1.1.1 // indirect
github.com/evanphx/json-patch/v5 v5.5.0 // indirect
github.com/fatih/color v1.19.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/felixge/httpsnoop v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.10.1 // indirect
github.com/gdexlab/go-render v1.0.1 // indirect
github.com/go-acme/lego/v4 v4.34.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.8 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.9.0 // indirect
github.com/go-git/go-git/v5 v5.19.1 // indirect
github.com/go-git/go-git/v5 v5.19.2 // indirect
github.com/go-jose/go-jose/v3 v3.0.5 // indirect
github.com/go-jose/go-jose/v4 v4.1.4 // indirect
github.com/go-kit/log v0.2.1 // indirect
@@ -333,19 +333,19 @@ require (
go.etcd.io/etcd/client/v3 v3.7.1 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect
go.opentelemetry.io/otel/metric v1.44.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 // indirect
go.opentelemetry.io/otel/metric v1.45.0 // indirect
go.opentelemetry.io/proto/otlp v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.4 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
go.yaml.in/yaml/v3 v3.0.5 // indirect
golang.org/x/mod v0.37.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/time v0.15.0 // indirect
golang.org/x/tools v0.47.0 // indirect
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect
gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect
gopkg.in/ini.v1 v1.67.3 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
+36 -35
View File
@@ -256,8 +256,8 @@ github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYF
github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w=
github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.1.0 h1:3YtUj32ZZkqZtt3sZZsClsymw/QDuVfpNhoA31zeORc=
github.com/felixge/httpsnoop v1.1.0/go.mod h1:Zqxgdd+1Rkcz8euOqdr7lqgCRJztwr5hp9vDSi5UZCE=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/foxcpp/go-mockdns v1.2.0 h1:omK3OrHRD1IWJz1FuFBCFquhXslXoF17OvBS6JPzZF0=
@@ -298,8 +298,8 @@ github.com/go-git/go-billy/v5 v5.9.0 h1:jItGXszUDRtR/AlferWPTMN4j38BQ88XnXKbilmm
github.com/go-git/go-billy/v5 v5.9.0/go.mod h1:jCnQMLj9eUgGU7+ludSTYoZL/GGmii14RxKFj7ROgHw=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4=
github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII=
github.com/go-git/go-git/v5 v5.19.1 h1:nX27AnaU43/K5bKktKwgBmR9lawoYVe1Ckg0rgzzN00=
github.com/go-git/go-git/v5 v5.19.1/go.mod h1:Pb1v0c7/g8aGQJwx9Us09W85yGoyvSwuhEGMH7zjDKQ=
github.com/go-git/go-git/v5 v5.19.2 h1:wkfn7vOlUBu8ivAWKBWisTiwJK4jYHzTF8Ndv1LyGqY=
github.com/go-git/go-git/v5 v5.19.2/go.mod h1:QqCBE1EFN5ddFmrliLQ3/ntRCUjZU3EJuwuB/jWEHjk=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
@@ -499,8 +499,8 @@ github.com/gorilla/schema v1.4.1 h1:jUg5hUjCSDZpNGLuXQOgIWGdlgrIdYvgQ0wZtdK1M3E=
github.com/gorilla/schema v1.4.1/go.mod h1:Dg5SSm5PV60mhF2NFaTV1xuYYj8tV8NOPRo4FggUMnM=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 h1:5VipnvEpbqr2gA2VbM+nYVbkIF28c5ZQfqCBQ5g2xfk=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDec4pTvgMSEixRuQKPTMH2bNs=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY=
github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k=
github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
github.com/hashicorp/go-plugin v1.8.0 h1:ie8S6RRY8RvB2usYZv+AAZ/wBvx2AU5p5QeP5j/FORs=
@@ -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-20260806084131-831afd01e5d4 h1:Cnq24qhteHD30DfTG8o0bf3cnVL/2b+afz//0qGjAeU=
github.com/owncloud/reva/v2 v2.0.0-20260806084131-831afd01e5d4/go.mod h1:XBnHPPDOGYq+Uf/PD1wGXne3xTvoghBxXPUULcSZjlc=
github.com/owncloud/reva/v2 v2.0.0-20260812122437-aa0c3881c0af h1:we/bQco5/RxOHczr6SDZPpZq9pUk+dhppHS5N9j63Ag=
github.com/owncloud/reva/v2 v2.0.0-20260812122437-aa0c3881c0af/go.mod h1:XBnHPPDOGYq+Uf/PD1wGXne3xTvoghBxXPUULcSZjlc=
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=
@@ -965,30 +965,30 @@ go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64=
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.69.0 h1:2yEATaop1/a1I4psnSLgWVPLWwCzkqWakgJy7xTDVy0=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.69.0/go.mod h1:D7J12YRapIekYyPWgGPlA/23pRmpSEZC5xJC/TTLI9U=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0 h1:8tvICD4vSTOOsNrsI4Ljf6C+6UKvpTEH5XY3JMoyPoo=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.69.0/go.mod h1:z9+yiacE0IHRqM4qFfkbt/JYlmYXgss8GY/jXoNuPJI=
go.opentelemetry.io/contrib/zpages v0.69.0 h1:YQC1PumJq6lUGQNrLW14ID9a0dXSBcbC/aC6VRSIARU=
go.opentelemetry.io/contrib/zpages v0.69.0/go.mod h1:FGvUcMGN5atRzUIgUsqOi+MiMvlQsfbuYATBHPP4cGs=
go.opentelemetry.io/otel v1.44.0 h1:JjwHmHpA4iZ3wBxluu2fbbE7j4kqlE8jXyAyPXH7HqU=
go.opentelemetry.io/otel v1.44.0/go.mod h1:BMgjTHL9WPRlRjL2oZCBTL4whCGtXch2H4BhOPIAyYc=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0 h1:oECp5f+hN7nkwjU/8BxQ/q23bGPb8FIrD839owX222E=
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.70.0/go.mod h1:DqEFwLumhzMBDQv9PcWbyoDxHI/4lAk6CM4nJBH39sc=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0 h1:LMuyCAyfalSjDyjdC65nK6N0zoTT63+E/u95X0JovZI=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.70.0/go.mod h1:085m8qbm4hgc8rZWGDEa4vmyyo2c3nPxUslYUKUIU04=
go.opentelemetry.io/contrib/zpages v0.70.0 h1:uBcclHekIrCRLO4KZfXiebDcWB52QQXaHGgvhUJ1K5I=
go.opentelemetry.io/contrib/zpages v0.70.0/go.mod h1:Nz9A1+68HVoJrk+cg92zJbcbHFAa+Jbl1uINwAlcK94=
go.opentelemetry.io/otel v1.45.0 h1:pdrWmLHofpubmArBv1LgFSv1Z0Ie/ppdZzu+kUN5EeU=
go.opentelemetry.io/otel v1.45.0/go.mod h1:XZxIqPapzEYnhNSScF5DIqXhm/rYi0FzCe2XddAwZfQ=
go.opentelemetry.io/otel/exporters/jaeger v1.17.0 h1:D7UpUy2Xc2wsi1Ras6V40q806WM07rqoCWzXu7Sqy+4=
go.opentelemetry.io/otel/exporters/jaeger v1.17.0/go.mod h1:nPCqOnEH9rNLKqH/+rrUjiMzHJdV1BlpKcTwRTyKkKI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 h1:4YsVu3B8+3qtWYYrsUYgn0OG78pN0rnNPRGX4SbokQI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0/go.mod h1:+wnlSn0mD1ADVMe3v9Z/WIaiz6q6gL2J/ejaAmdmv80=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0 h1:qazEJlUOQzhCpzQpFETGby7EdqjI1wsd0W+6Gg1SCTU=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.44.0/go.mod h1:fOD2Yefuxixkx3ahVNf0O/PERb6r4OlbxfATVnYvzCo=
go.opentelemetry.io/otel/metric v1.44.0 h1:1w0gILTcHdr3YI+ixLyjemwrVnsMURbTZFrSYCdDdmc=
go.opentelemetry.io/otel/metric v1.44.0/go.mod h1:8O7hanEPBNgEMmybD3s2VBKcgWOCsA6tzHBPODAiquo=
go.opentelemetry.io/otel/sdk v1.44.0 h1:nHYwb9lK+fJPU/dnT6s7W7Z8itMWyqrnVfbheVYrZ58=
go.opentelemetry.io/otel/sdk v1.44.0/go.mod h1:Osuydd3Se74nqjAKxid74N5eC+jfEqfTegHRnq58oK0=
go.opentelemetry.io/otel/sdk/metric v1.44.0 h1:3LlKgI+VjbVsjNRFZJZAJ30WjXC5VkNRks6si09iEfI=
go.opentelemetry.io/otel/sdk/metric v1.44.0/go.mod h1:5B5pMARnXxKhltooO4xUuCBorl65a4EpnTalObqOigA=
go.opentelemetry.io/otel/trace v1.44.0 h1:jxF5CsGYCe74MCRx2X4g7WsY/VBKRqqpNvXlX/6gtIk=
go.opentelemetry.io/otel/trace v1.44.0/go.mod h1:oLl1jrMQAVo6v3GAggN+1VH9VIz9iUSvW53sW1Q8PIE=
go.opentelemetry.io/proto/otlp v1.10.0 h1:IQRWgT5srOCYfiWnpqUYz9CVmbO8bFmKcwYxpuCSL2g=
go.opentelemetry.io/proto/otlp v1.10.0/go.mod h1:/CV4QoCR/S9yaPj8utp3lvQPoqMtxXdzn7ozvvozVqk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0 h1:QRefszxJmfPdjXUUm3j6iDzY03mTPXMjqErFqQ67vUg=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.45.0/go.mod h1:Tiz03lTBVBrm7eWZBOidzEaYaJa8tjwGUGv6d8mlTyk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0 h1:fG5MCxGz8+2VtrN/WgqSpJFctVz24gpxj8CxkKmc8Ww=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.45.0/go.mod h1:BmAYTn+3ysbRe+IU2msxmf5Rx3g6DHvex+tWI3LdhYI=
go.opentelemetry.io/otel/metric v1.45.0 h1:7Eg1uH7CJ5cXv9is6tnBe1FI6rj1nwUdbFypRm3br/M=
go.opentelemetry.io/otel/metric v1.45.0/go.mod h1:HAPbm1nd3p1PmFH7v2dR+6BjXxw+Lq4a2+pndMAm08s=
go.opentelemetry.io/otel/sdk v1.45.0 h1:4VVSMgQ83dUgW2aoX5f6JgLvHwIvzcuLnF9lUdCSpCw=
go.opentelemetry.io/otel/sdk v1.45.0/go.mod h1:Sr40LgXV7DsKMMJMKOhUWOgMWTfAaqvm2kF0g7ilwuA=
go.opentelemetry.io/otel/sdk/metric v1.45.0 h1:oVFszMfyj1Am6s24Vtc7wBb8BKLcwepJjNEYILuiE3o=
go.opentelemetry.io/otel/sdk/metric v1.45.0/go.mod h1:vUWUxDZvu1WVRj8JA8S0AdhsPrZoDpA2DdZauIh4mDA=
go.opentelemetry.io/otel/trace v1.45.0 h1:l/mP6Uv7oNO7/TblbhpbgMidxhq1uO/rPsikOyVhxag=
go.opentelemetry.io/otel/trace v1.45.0/go.mod h1:qoJJA2xNMnxRrdISU/kLtfUH2wNeQbiv+jhs/CxI8bc=
go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk=
go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
@@ -1001,8 +1001,9 @@ go.uber.org/zap v1.27.1 h1:08RqriUEv8+ArZRYSTXy1LeBScaMpVSTBhCeaZYfMYc=
go.uber.org/zap v1.27.1/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ=
go.yaml.in/yaml/v2 v2.4.4/go.mod h1:gMZqIpDtDqOfM0uNfy0SkpRhvUryYH0Z6wdMYcacYXQ=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -1325,10 +1326,10 @@ google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7 h1:XzmzkmB14QhVhgnawEVsOn6OFsnpyxNPRY9QV01dNB0=
google.golang.org/genproto v0.0.0-20260319201613-d00831a3d3e7/go.mod h1:L43LFes82YgSonw6iTXTxXUX1OlULt4AQtkik4ULL/I=
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa h1:Kjn0N0tCrDgiAFW+lGO4JZ3ck44CehvJQMAwj9QF0G8=
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:q4lMZS6kskjT5HvCPrnnypcDPVJqT/f4nfxmkE7gryY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa h1:mZHHdPZl0dbGHCflZgAq/Q468DWVFcU2whhB2KAo8fk=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d h1:FarXi840EJWSHYTN3ERkADbPWjl307+FGrA22KAVjjc=
google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d/go.mod h1:K/+WGbmBY7aNW1HDw1fJnKYo10i0DkAX6pows00dLig=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d h1:IL4hdHzcUv2l/gcg98/Rj3FbtE6axwqslOW8SW0C+S0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
+30 -4
View File
@@ -3,6 +3,7 @@ package natsjsregistry
import (
"context"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
@@ -14,6 +15,7 @@ import (
natsjskv "github.com/go-micro/plugins/v4/store/nats-js-kv"
"github.com/nats-io/nats.go"
"github.com/owncloud/ocis/v2/ocis-pkg/generators"
revastore "github.com/owncloud/reva/v2/pkg/store"
"go-micro.dev/v4/registry"
"go-micro.dev/v4/server"
"go-micro.dev/v4/store"
@@ -21,10 +23,13 @@ import (
)
var (
_registryName = "nats-js-kv"
_registryAddressEnv = "MICRO_REGISTRY_ADDRESS"
_registryUsernameEnv = "MICRO_REGISTRY_AUTH_USERNAME"
_registryPasswordEnv = "MICRO_REGISTRY_AUTH_PASSWORD"
_registryName = "nats-js-kv"
_registryAddressEnv = "MICRO_REGISTRY_ADDRESS"
_registryUsernameEnv = "MICRO_REGISTRY_AUTH_USERNAME"
_registryPasswordEnv = "MICRO_REGISTRY_AUTH_PASSWORD"
_registryEnableTLSEnv = "MICRO_REGISTRY_ENABLE_TLS"
_registryTLSInsecureEnv = "MICRO_REGISTRY_TLS_INSECURE"
_registryTLSRootCAEnv = "MICRO_REGISTRY_TLS_ROOT_CA_CERTIFICATE"
_serviceDelimiter = "@"
)
@@ -211,6 +216,10 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option {
natsOptions := nats.GetDefaultOptions()
natsOptions.Name = generators.GenerateConnectionName(serviceName, generators.NTypeRegistry)
natsOptions.User, natsOptions.Password = getAuth()
if tlsConf := getTLS(); tlsConf != nil {
natsOptions.TLSConfig = tlsConf
natsOptions.Secure = true
}
natsOptions.ReconnectedCB = func(_ *nats.Conn) {
if err := n.Init(); err != nil {
fmt.Println("cannot reconnect to nats")
@@ -233,3 +242,20 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option {
func getAuth() (string, string) {
return os.Getenv(_registryUsernameEnv), os.Getenv(_registryPasswordEnv)
}
var (
_tlsOnce sync.Once
_tlsConfig *tls.Config
)
func getTLS() *tls.Config {
_tlsOnce.Do(func() {
if os.Getenv(_registryEnableTLSEnv) != "true" {
return
}
insecure := os.Getenv(_registryTLSInsecureEnv) == "true"
rootCA := os.Getenv(_registryTLSRootCAEnv)
_tlsConfig = revastore.BuildNatsTLSConfig(insecure, rootCA)
})
return _tlsConfig
}
+5 -2
View File
@@ -62,8 +62,11 @@ type Cache struct {
Table string `yaml:"table" env:"OCIS_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL" desc:"Time to live for events in the store. The duration can be set as number followed by a unit identifier like s, m or h." introductionVersion:"pre5.0"`
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"`
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"`
}
// Commons holds configuration that are common to all extensions. Each extension can then decide whether
@@ -90,6 +90,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Store.Database),
microstore.Table(cfg.Store.Table),
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
)
tm, err := pool.StringToTLSMode(cfg.GRPCClientTLS.Mode)
+5 -2
View File
@@ -52,8 +52,11 @@ type Store struct {
Database string `yaml:"database" env:"ACTIVITYLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"ACTIVITYLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
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"`
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"`
}
// ServiceAccount is the configuration for the used service account
@@ -83,6 +83,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Store.Database),
microstore.Table(cfg.Store.Table),
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
)
gr := runner.NewGroup()
+5 -2
View File
@@ -9,6 +9,9 @@ type Store struct {
Database string `yaml:"database" env:"COLLABORATION_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.0.0"`
Table string `yaml:"table" env:"COLLABORATION_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.0.0"`
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"`
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"`
}
@@ -72,6 +72,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Store.Database),
microstore.Table(cfg.Store.Table),
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
)
service := grpc.NewService(
+5 -2
View File
@@ -42,8 +42,11 @@ type Store struct {
Database string `yaml:"database" env:"EVENTHISTORY_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"EVENTHISTORY_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
// Events combines the configuration options for the event bus.
+5 -2
View File
@@ -93,6 +93,9 @@ type Cache struct {
ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
+5 -2
View File
@@ -72,8 +72,11 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i
"cache_table": "provider",
"cache_ttl": cfg.Cache.ProviderCacheTTL,
"disable_persistence": cfg.Cache.ProviderCacheDisablePersistence,
"cache_auth_username": cfg.Cache.ProviderCacheAuthUsername,
"cache_auth_password": cfg.Cache.ProviderCacheAuthPassword,
"cache_auth_username": cfg.Cache.ProviderCacheAuthUsername,
"cache_auth_password": cfg.Cache.ProviderCacheAuthPassword,
"cache_enable_tls": cfg.Cache.ProviderCacheEnableTLS,
"cache_tls_insecure": cfg.Cache.ProviderCacheTLSInsecure,
"cache_tls_root_ca_certificate": cfg.Cache.ProviderCacheTLSRootCACertificate,
},
},
"authregistry": map[string]interface{}{
+5 -2
View File
@@ -10,6 +10,9 @@ type Cache struct {
Table string `yaml:"table" env:"GRAPH_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;GRAPH_CACHE_TTL" desc:"Time to live for cache records in the graph. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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"`
}
+41
View File
@@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"path"
"slices"
"sort"
"strconv"
"strings"
@@ -260,6 +261,12 @@ func (g Graph) getDrives(r *http.Request, unrestricted bool, apiVersion APIVersi
return nil, errorcode.New(errorcode.GeneralException, err.Error())
}
// An unrestricted listing includes other users' personal spaces; drop the
// ones the caller may not see (project/shared spaces are unaffected).
if unrestricted {
spaces = g.filterForeignPersonalSpaces(ctx, spaces)
}
spaces, err = sortSpaces(odataReq, spaces)
if err != nil {
logger.Debug().Err(err).Msg("could not get drives: error sorting the spaces list according to query")
@@ -269,6 +276,37 @@ func (g Graph) getDrives(r *http.Request, unrestricted bool, apiVersion APIVersi
return spaces, nil
}
// filterForeignPersonalSpaces drops personal spaces the caller does not own,
// unless the caller holds full account management permission (OCISDEV-660).
func (g Graph) filterForeignPersonalSpaces(ctx context.Context, spaces []*libregraph.Drive) []*libregraph.Drive {
user, ok := revactx.ContextGetUser(ctx)
if !ok {
// No caller identity: drop every personal space rather than leak it.
return slices.DeleteFunc(slices.Clone(spaces), func(d *libregraph.Drive) bool {
return d.GetDriveType() == _spaceTypePersonal
})
}
callerID := user.GetId().GetOpaqueId()
isForeignPersonal := func(d *libregraph.Drive) bool {
if d.GetDriveType() != _spaceTypePersonal {
return false
}
owner := d.GetOwner()
ownerUser := owner.GetUser()
return ownerUser.GetId() != callerID
}
if !slices.ContainsFunc(spaces, isForeignPersonal) {
return spaces
}
if g.contextUserHasFullAccountPerms(ctx) {
return spaces
}
return slices.DeleteFunc(slices.Clone(spaces), isForeignPersonal)
}
// GetSingleDrive V1 does a lookup of a single space by spaceId
func (g Graph) GetSingleDrive(w http.ResponseWriter, r *http.Request) {
g.getSingleDrive(w, r, APIVersion_1)
@@ -331,6 +369,9 @@ func (g Graph) getSingleDrive(w http.ResponseWriter, r *http.Request, apiVersion
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, err.Error())
return
}
// Runs unrestricted, so decomposedfs skips per-node checks; drop a foreign
// personal space here so it renders the same 404 as a missing drive below.
spaces = g.filterForeignPersonalSpaces(ctx, spaces)
switch num := len(spaces); {
case num == 0:
log.Debug().Msg("could not get drive: no drive returned from storage")
+171
View File
@@ -1345,6 +1345,177 @@ var _ = Describe("Graph", func() {
})
})
Describe("Foreign personal drive access (OCISDEV-660)", func() {
var (
callerCtx = func(opaqueID string) context.Context {
return revactx.ContextSetUser(context.Background(), &userprovider.User{
Id: &userprovider.UserId{Type: userprovider.UserType_USER_TYPE_PRIMARY, OpaqueId: opaqueID},
})
}
personalSpace = func(owner string) *provider.StorageSpace {
return &provider.StorageSpace{
Id: &provider.StorageSpaceId{OpaqueId: "targetspace"},
SpaceType: "personal",
Owner: &userprovider.User{Id: &userprovider.UserId{OpaqueId: owner}},
Root: &provider.ResourceId{
StorageId: "pro-1",
SpaceId: "targetspace",
OpaqueId: "targetspace",
},
Name: "targetuser",
}
}
projectSpace = func(owner string) *provider.StorageSpace {
return &provider.StorageSpace{
Id: &provider.StorageSpaceId{OpaqueId: "projectspace"},
SpaceType: "project",
Owner: &userprovider.User{Id: &userprovider.UserId{OpaqueId: owner}},
Root: &provider.ResourceId{
StorageId: "pro-1",
SpaceId: "projectspace",
OpaqueId: "projectspace",
},
Name: "aproject",
}
}
mockAccountPerms = func(constraint v0.Permission_Constraint) {
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settingssvc.GetPermissionByIDResponse{
Permission: &v0.Permission{Constraint: constraint},
}, nil)
}
mockSpaceFormatting = func() {
gatewayClient.On("GetQuota", mock.Anything, mock.Anything).Return(&provider.GetQuotaResponse{
Status: status.NewUnimplemented(ctx, fmt.Errorf("not supported"), "not supported"),
}, nil)
gatewayClient.On("InitiateFileDownload", mock.Anything, mock.Anything).Return(&gateway.InitiateFileDownloadResponse{
Status: status.NewNotFound(ctx, "not found"),
}, nil)
}
)
Describe("GetSingleDrive", func() {
singleDriveReq := func(userCtx context.Context) *http.Request {
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/drives/{driveID}/", nil)
rctx := chi.NewRouteContext()
rctx.URLParams.Add("driveID", "targetspace")
return r.WithContext(context.WithValue(userCtx, chi.RouteCtxKey, rctx))
}
It("returns 404 when a non-admin looks up another user's personal drive", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_OWN)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser")},
}, nil)
svc.GetSingleDrive(rr, singleDriveReq(callerCtx("otheruser")))
Expect(rr.Code).To(Equal(http.StatusNotFound))
})
It("returns the personal drive to a full-account admin", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_ALL)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser")},
}, nil)
svc.GetSingleDrive(rr, singleDriveReq(callerCtx("admin")))
Expect(rr.Code).To(Equal(http.StatusOK))
})
It("returns the owner's own personal drive", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_OWN)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser")},
}, nil)
svc.GetSingleDrive(rr, singleDriveReq(callerCtx("targetuser")))
Expect(rr.Code).To(Equal(http.StatusOK))
})
It("returns another user's project drive to a non-admin (unaffected)", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_OWN)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{projectSpace("targetuser")},
}, nil)
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/drives/{driveID}/", nil)
rctx := chi.NewRouteContext()
rctx.URLParams.Add("driveID", "projectspace")
r = r.WithContext(context.WithValue(callerCtx("otheruser"), chi.RouteCtxKey, rctx))
svc.GetSingleDrive(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
})
})
Describe("GetAllDrivesV1 (unrestricted listing)", func() {
listedDriveIDs := func() []string {
var lr struct {
Value []map[string]interface{} `json:"value"`
}
body, _ := io.ReadAll(rr.Body)
Expect(json.Unmarshal(body, &lr)).To(Succeed())
ids := make([]string, 0, len(lr.Value))
for _, d := range lr.Value {
ids = append(ids, d["id"].(string))
}
return ids
}
It("hides other users' personal drives from a non-admin", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_OWN)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser"), projectSpace("targetuser")},
}, nil)
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/drives", nil).WithContext(callerCtx("otheruser"))
svc.GetAllDrivesV1(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
Expect(listedDriveIDs()).To(ConsistOf("pro-1$projectspace"))
})
It("shows all personal drives to a full-account admin", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_ALL)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser"), projectSpace("targetuser")},
}, nil)
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/drives", nil).WithContext(callerCtx("admin"))
svc.GetAllDrivesV1(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
Expect(listedDriveIDs()).To(ConsistOf("pro-1$targetspace", "pro-1$projectspace"))
})
It("keeps the caller's own personal drive", func() {
mockSpaceFormatting()
mockAccountPerms(v0.Permission_CONSTRAINT_OWN)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{personalSpace("targetuser")},
}, nil)
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/drives", nil).WithContext(callerCtx("targetuser"))
svc.GetAllDrivesV1(rr, r)
Expect(rr.Code).To(Equal(http.StatusOK))
Expect(listedDriveIDs()).To(ConsistOf("pro-1$targetspace"))
})
})
})
Describe("Delete a drive", func() {
It("fails on invalid drive ids", func() {
r := httptest.NewRequest(http.MethodDelete, "/graph/v1.0/drives/{driveID}/", nil)
+2
View File
@@ -114,6 +114,7 @@ type Service interface { //nolint:interfacebloat
GetSharedByMe(w http.ResponseWriter, r *http.Request)
ListSharedWithMe(w http.ResponseWriter, r *http.Request)
GetUserDrive(w http.ResponseWriter, r *http.Request)
GetRootDriveChildren(w http.ResponseWriter, r *http.Request)
GetDriveItem(w http.ResponseWriter, r *http.Request)
GetDriveItemChildren(w http.ResponseWriter, r *http.Request)
@@ -199,6 +200,7 @@ func NewService(opts ...Option) (Graph, error) { //nolint:maintidx
microstore.Table(options.Config.Cache.Table),
store.DisablePersistence(options.Config.Cache.DisablePersistence),
store.Authentication(options.Config.Cache.AuthUsername, options.Config.Cache.AuthPassword),
store.TLS(options.Config.Cache.EnableTLS, options.Config.Cache.TLSInsecure, options.Config.Cache.TLSRootCACertificate),
}
m := roles.NewManager(
roles.StoreOptions(storeOptions),
+16 -7
View File
@@ -131,14 +131,23 @@ func (g Graph) GetUserDrive(w http.ResponseWriter, r *http.Request) {
return
}
if userID == "" {
u, ok := revactx.ContextGetUser(r.Context())
if !ok {
logger.Debug().Msg("could not get user: user not in context")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "user not in context")
return
}
u, ok := revactx.ContextGetUser(r.Context())
if !ok {
logger.Debug().Msg("could not get user: user not in context")
errorcode.GeneralException.Render(w, r, http.StatusInternalServerError, "user not in context")
return
}
switch {
case userID == "":
// /me/drive — self access
userID = u.GetId().GetOpaqueId()
case userID != u.GetId().GetOpaqueId() && !g.contextUserHasFullAccountPerms(r.Context()):
// Only the owner or a full-account admin may read another user's drive;
// return the same 404 as a missing drive so UUIDs can't be probed.
logger.Debug().Str("userID", userID).Msg("could not get drive: access to another user's drive is not permitted")
errorcode.ItemNotFound.Render(w, r, http.StatusNotFound, "no drive returned from storage")
return
}
logger.Debug().Str("userID", userID).Msg("calling list storage spaces with user and personal filter")
@@ -937,6 +937,88 @@ var _ = Describe("Users", func() {
})
})
Describe("GetUserDrive", func() {
// grantPerms sets the permission constraint returned for every
// GetPermissionByID call. CONSTRAINT_ALL makes
// contextUserHasFullAccountPerms return true (admin); CONSTRAINT_OWN
// makes it return false (non-admin).
grantPerms := func(c settingsmsg.Permission_Constraint) {
permissionService.On("GetPermissionByID", mock.Anything, mock.Anything).Return(&settings.GetPermissionByIDResponse{
Permission: &settingsmsg.Permission{Constraint: c},
}, nil)
}
// expectPersonalSpace mocks a successful personal-drive listing owned by ownerID.
expectPersonalSpace := func(ownerID string) {
gatewayClient.On("GetQuota", mock.Anything, mock.Anything, mock.Anything).Return(&provider.GetQuotaResponse{
Status: status.NewOK(ctx),
TotalBytes: 10,
}, nil)
gatewayClient.On("ListStorageSpaces", mock.Anything, mock.Anything, mock.Anything).Return(&provider.ListStorageSpacesResponse{
Status: status.NewOK(ctx),
StorageSpaces: []*provider.StorageSpace{
{
Id: &provider.StorageSpaceId{OpaqueId: "personal"},
Owner: &userv1beta1.User{Id: &userv1beta1.UserId{OpaqueId: ownerID}},
Root: &provider.ResourceId{SpaceId: "personal", OpaqueId: "personal"},
SpaceType: "personal",
},
},
}, nil)
}
doRequest := func(userID string) {
r := httptest.NewRequest(http.MethodGet, "/graph/v1.0/users/"+userID+"/drive", nil)
rctx := chi.NewRouteContext()
rctx.URLParams.Add("userID", userID)
r = r.WithContext(context.WithValue(revactx.ContextSetUser(ctx, currentUser), chi.RouteCtxKey, rctx))
svc.GetUserDrive(rr, r)
}
It("returns the caller's own drive (self, non-admin)", func() {
grantPerms(settingsmsg.Permission_CONSTRAINT_OWN)
expectPersonalSpace("user")
doRequest("user")
Expect(rr.Code).To(Equal(http.StatusOK))
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
drive := &libregraph.Drive{}
Expect(json.Unmarshal(data, drive)).To(Succeed())
Expect(drive.GetId()).To(Equal("personal"))
})
It("returns the personal drive for the /me path (empty userID)", func() {
grantPerms(settingsmsg.Permission_CONSTRAINT_OWN)
expectPersonalSpace("user")
doRequest("")
Expect(rr.Code).To(Equal(http.StatusOK))
})
It("allows a full-account admin to read another user's drive", func() {
grantPerms(settingsmsg.Permission_CONSTRAINT_ALL)
expectPersonalSpace("other")
doRequest("other")
Expect(rr.Code).To(Equal(http.StatusOK))
})
It("denies a non-admin reading another user's drive (IDOR), without listing spaces", func() {
grantPerms(settingsmsg.Permission_CONSTRAINT_OWN)
doRequest("other")
Expect(rr.Code).To(Equal(http.StatusNotFound))
data, err := io.ReadAll(rr.Body)
Expect(err).ToNot(HaveOccurred())
Expect(string(data)).To(ContainSubstring("no drive returned from storage"))
gatewayClient.AssertNotCalled(GinkgoT(), "ListStorageSpaces", mock.Anything, mock.Anything, mock.Anything)
})
})
Describe("PostUser", func() {
var (
user *libregraph.User
@@ -134,6 +134,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Store.Database),
microstore.Table(cfg.Store.Table),
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
)
svc := service.NewEventsNotifier(traceProvider, evts, channel, logger, gatewaySelector, valueService,
+5 -2
View File
@@ -76,6 +76,9 @@ type Store struct {
Database string `yaml:"database" env:"NOTIFICATIONS_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.1.0"`
Table string `yaml:"table" env:"NOTIFICATIONS_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.1.0"`
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"`
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." 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"`
}
+5 -2
View File
@@ -35,6 +35,9 @@ type SigningKeys struct {
Store string `yaml:"store" env:"OCIS_CACHE_STORE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE" desc:"The type of the signing key store. Supported values are: 'redis-sentinel' and 'nats-js-kv'. See the text description for details." introductionVersion:"5.0"`
Nodes []string `yaml:"addresses" env:"OCIS_CACHE_STORE_NODES;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_NODES" desc:"A list of nodes to access the configured store. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"5.0"`
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"`
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." 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"`
}
+1
View File
@@ -43,6 +43,7 @@ func Server(opts ...Option) (http.Service, error) {
microstore.Database("proxy"),
microstore.Table("signing-keys"),
store.Authentication(options.Config.SigningKeys.AuthUsername, options.Config.SigningKeys.AuthPassword),
store.TLS(options.Config.SigningKeys.EnableTLS, options.Config.SigningKeys.TLSInsecure, options.Config.SigningKeys.TLSRootCACertificate),
)
handle := svc.NewService(
@@ -65,6 +65,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Store.Database),
microstore.Table(cfg.Store.Table),
store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword),
store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate),
)
svc, err := service.NewPostprocessingService(ctx, bus, logger, st, traceProvider, cfg.Postprocessing)
+5 -2
View File
@@ -62,6 +62,9 @@ type Store struct {
Database string `yaml:"database" env:"POSTPROCESSING_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"POSTPROCESSING_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
+2
View File
@@ -77,6 +77,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Table(cfg.OIDC.UserinfoCache.Table),
store.DisablePersistence(cfg.OIDC.UserinfoCache.DisablePersistence),
store.Authentication(cfg.OIDC.UserinfoCache.AuthUsername, cfg.OIDC.UserinfoCache.AuthPassword),
store.TLS(cfg.OIDC.UserinfoCache.EnableTLS, cfg.OIDC.UserinfoCache.TLSInsecure, cfg.OIDC.UserinfoCache.TLSRootCACertificate),
)
signingKeyStore := store.Create(
@@ -86,6 +87,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database("proxy"),
microstore.Table("signing-keys"),
store.Authentication(cfg.PreSignedURL.SigningKeys.AuthUsername, cfg.PreSignedURL.SigningKeys.AuthPassword),
store.TLS(cfg.PreSignedURL.SigningKeys.EnableTLS, cfg.PreSignedURL.SigningKeys.TLSInsecure, cfg.PreSignedURL.SigningKeys.TLSRootCACertificate),
)
cfg.GrpcClient, err = grpc.NewClient(
+10 -4
View File
@@ -144,8 +144,11 @@ type Cache struct {
Table string `yaml:"table" env:"PROXY_OIDC_USERINFO_CACHE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_OIDC_USERINFO_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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"`
}
// RoleAssignment contains the configuration for how to assign roles to users during login
@@ -199,8 +202,11 @@ type SigningKeys struct {
Nodes []string `yaml:"addresses" env:"OCIS_CACHE_STORE_NODES;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_NODES" desc:"A list of nodes to access the configured store. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_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"`
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"`
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"`
}
// ClaimsSelectorConf is the config for the claims-selector
+2
View File
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
default-src:
- '''none'''
font-src:
@@ -21,6 +22,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifest-src:
- '''self'''
media-src:
+9 -6
View File
@@ -13,27 +13,30 @@ import (
// LoadCSPConfig loads CSP header configuration from a yaml file.
func LoadCSPConfig(proxyCfg *config.Config) (*config.CSP, error) {
serviceName := proxyCfg.Service.Name
yamlContent, err := loadCSPYaml(proxyCfg)
if err != nil {
return nil, err
}
return loadCSPConfig(yamlContent)
return loadCSPConfig(serviceName, yamlContent)
}
// LoadCSPConfig loads CSP header configuration from a yaml file.
func loadCSPConfig(yamlContent []byte) (*config.CSP, error) {
func loadCSPConfig(svcName string, yamlContent []byte) (*config.CSP, error) {
// The LoadCSPConfig (public) is expected to be called once, so
// creating a new gookit config instance each time here is fine.
// substitute env vars and load to struct
gofig.WithOptions(gofig.ParseEnv)
gofig.AddDriver(yaml.Driver)
cfg := gofig.NewWithOptions(svcName, gofig.ParseEnv)
cfg.AddDriver(yaml.Driver)
err := gofig.LoadSources("yaml", yamlContent)
err := cfg.LoadSources("yaml", yamlContent)
if err != nil {
return nil, err
}
// read yaml
cspConfig := config.CSP{}
err = gofig.BindStruct("", &cspConfig)
err = cfg.BindStruct("", &cspConfig)
if err != nil {
return nil, err
}
@@ -20,7 +20,7 @@ directives:
- 'https://${COLLABORA_DOMAIN|collabora.owncloud.test}/'
`
config, err := loadCSPConfig([]byte(yaml))
config, err := loadCSPConfig("proxy", []byte(yaml))
if err != nil {
t.Error(err)
}
+5 -2
View File
@@ -63,6 +63,9 @@ type Cache struct {
DirectoryTable string `yaml:"directories_table" env:"SETTINGS_DIRECTORY_CACHE_TABLE" desc:"The database table the store should use for the directory cache." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;SETTINGS_CACHE_TTL" desc:"Default time to live for entries in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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"`
}
@@ -140,6 +140,7 @@ func (c *CachedMDC) Init(ctx context.Context, id string) error {
microstore.Table(c.cfg.Metadata.Cache.DirectoryTable),
store.DisablePersistence(c.cfg.Metadata.Cache.DisablePersistence),
store.Authentication(c.cfg.Metadata.Cache.AuthUsername, c.cfg.Metadata.Cache.AuthPassword),
store.TLS(c.cfg.Metadata.Cache.EnableTLS, c.cfg.Metadata.Cache.TLSInsecure, c.cfg.Metadata.Cache.TLSRootCACertificate),
)
c.filesCache = store.Create(
store.Store(c.cfg.Metadata.Cache.Store),
@@ -149,6 +150,7 @@ func (c *CachedMDC) Init(ctx context.Context, id string) error {
microstore.Table(c.cfg.Metadata.Cache.FileTable),
store.DisablePersistence(c.cfg.Metadata.Cache.DisablePersistence),
store.Authentication(c.cfg.Metadata.Cache.AuthUsername, c.cfg.Metadata.Cache.AuthPassword),
store.TLS(c.cfg.Metadata.Cache.EnableTLS, c.cfg.Metadata.Cache.TLSInsecure, c.cfg.Metadata.Cache.TLSRootCACertificate),
)
return c.next.Init(ctx, id)
}
@@ -68,6 +68,9 @@ type Store struct {
Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;STORAGE_PUBLICLINK_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"8.0.0"`
Database string `yaml:"database" env:"STORAGE_PUBLICLINK_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"8.0.0"`
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"`
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." 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"`
}
@@ -44,8 +44,11 @@ func StoragePublicLinkConfigFromStruct(cfg *config.Config) map[string]interface{
"store_nodes": cfg.Store.Nodes,
"store_database": cfg.Store.Database,
"store_table": cfg.Store.Table,
"store_username": cfg.Store.AuthUsername,
"store_password": cfg.Store.AuthPassword,
"store_username": cfg.Store.AuthUsername,
"store_password": cfg.Store.AuthPassword,
"store_enable_tls": cfg.Store.EnableTLS,
"store_tls_insecure": cfg.Store.TLSInsecure,
"store_tls_root_ca_certificate": cfg.Store.TLSRootCACertificate,
},
},
},
+5 -2
View File
@@ -91,6 +91,9 @@ type Cache struct {
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_SYSTEM_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
@@ -169,8 +169,11 @@ func metadataDrivers(localEndpoint string, cfg *config.Config) map[string]interf
"cache_database": cfg.FileMetadataCache.Database,
"cache_ttl": cfg.FileMetadataCache.TTL,
"cache_disable_persistence": cfg.FileMetadataCache.DisablePersistence,
"cache_auth_username": cfg.FileMetadataCache.AuthUsername,
"cache_auth_password": cfg.FileMetadataCache.AuthPassword,
"cache_auth_username": cfg.FileMetadataCache.AuthUsername,
"cache_auth_password": cfg.FileMetadataCache.AuthPassword,
"cache_enable_tls": cfg.FileMetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FileMetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FileMetadataCache.TLSRootCACertificate,
},
},
}
+39
View File
@@ -181,6 +181,45 @@ OPTIONS:
--help, -h show help
```
Note that removing a stale node does not reclaim the quota it consumed. Use the
Recalculate Treesize command afterwards to correct the reported quota usage of the space.
#### Recalculate Treesize command
The treesize of a directory is maintained as a running counter that is updated on every
change, so a failed or incomplete update leaves the counter wrong and the reported quota
usage of a space drifts from the data actually stored on disk. This command walks a space
bottom up, recalculates the treesize of every directory from the actual size of its
children and corrects the stored values.
```bash
~/ocis storage-users spaces recalculate-treesize <commandoptions>
```
```
NAME:
ocis storage-users spaces recalculate-treesize - Recalculate the treesize of all directories in a space from the actual size of their children. Use this to repair a space whose reported quota usage drifted from the data on disk
USAGE:
ocis storage-users spaces recalculate-treesize [command options]
OPTIONS:
--space-id value, -s value Space ID to recalculate (omit to process all spaces)
--dry-run Only show which treesizes would be corrected without writing them (default: true)
--verbose, -v Enable verbose logging (default: false)
--help, -h show help
```
```bash
# report incorrect treesizes of a single space without changing anything
ocis storage-users spaces recalculate-treesize --space-id 43972c79-f7ce-441b-9fe0-cf5170e4d61e
# correct them
ocis storage-users spaces recalculate-treesize --space-id 43972c79-f7ce-441b-9fe0-cf5170e4d61e --dry-run=false
```
Note: the command reads the metadata of every node in the space, so it is I/O intensive on
large spaces. Prefer targeting a single space with `--space-id` over processing all spaces.
#### Command Examples
Dry run to see what would be deleted (recommended first step)
@@ -33,6 +33,7 @@ func Spaces(cfg *config.Config) *cli.Command {
Usage: "manage spaces",
Subcommands: []*cli.Command{
PurgeDisabledSpaces(cfg),
RecalculateTreesize(cfg),
},
}
}
@@ -0,0 +1,222 @@
package command
import (
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
"strconv"
"strings"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/olekukonko/tablewriter"
"github.com/owncloud/ocis/v2/ocis-pkg/config/configlog"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config"
"github.com/owncloud/ocis/v2/services/storage-users/pkg/config/parser"
"github.com/owncloud/reva/v2/pkg/storage/utils/decomposedfs/lookup"
"github.com/owncloud/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/shamaton/msgpack/v2"
"github.com/urfave/cli/v2"
)
// metadataExtension is the suffix of the messagepack metadata file of a node
const metadataExtension = ".mpk"
// RecalculateTreesize is the entry point for the recalculate-treesize command
func RecalculateTreesize(cfg *config.Config) *cli.Command {
return &cli.Command{
Name: "recalculate-treesize",
Usage: "Recalculate the treesize of all directories in a space from the actual size of their children. " +
"Use this to repair a space whose reported quota usage drifted from the data on disk",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "space-id",
Usage: "Space ID to recalculate (omit to process all spaces)",
Required: false,
Aliases: []string{"s"},
},
&cli.BoolFlag{
Name: "dry-run",
Usage: "Only show which treesizes would be corrected without writing them",
Value: true, // default must be true to avoid accidental writes!
},
&cli.BoolFlag{
Name: "verbose",
Usage: "Enable verbose logging",
Value: false,
Aliases: []string{"v"},
},
},
Before: func(c *cli.Context) error {
return configlog.ReturnFatal(parser.ParseConfig(cfg))
},
Action: func(c *cli.Context) error {
dryRun := c.Bool("dry-run")
verbose := c.Bool("verbose")
spaceIDs := []string{}
if c.IsSet("space-id") {
spaceIDs = append(spaceIDs, c.String("space-id"))
} else {
fmt.Println("Scanning all spaces for incorrect treesizes...")
spaceIDs = globSpaceIDs(cfg)
}
if dryRun {
fmt.Print("Dry run mode enabled, no treesize will be written\n\n")
}
var (
table *tablewriter.Table
corrected int
)
table = tablewriter.NewTable(os.Stdout)
table.Header("Space", "Node", "Stored", "Calculated", "Difference")
for _, spaceID := range spaceIDs {
if verbose {
fmt.Printf("Recalculating treesizes for space: %s\n", spaceID)
}
root := filepath.Join(cfg.Drivers.OCIS.Root, "spaces", lookup.Pathify(spaceID, 1, 2), "nodes", lookup.Pathify(spaceID, 4, 2))
_, n, err := recalculateNode(cfg, spaceID, root, dryRun, verbose, table)
if err != nil {
fmt.Fprintf(os.Stderr, "Error recalculating space %s: %s\n", spaceID, err)
continue
}
corrected += n
}
if corrected > 0 {
table.Render()
}
switch {
case corrected == 0:
fmt.Println("All treesizes are correct")
case dryRun:
fmt.Printf("Would correct %d treesizes. Run with --dry-run=false to apply\n", corrected)
default:
fmt.Printf("Corrected %d treesizes\n", corrected)
}
return nil
},
}
}
// recalculateNode calculates the size of the node at the given path. For directories it
// recurses into the children first, so the whole subtree is corrected bottom up, and
// compares the sum against the stored treesize. It returns the calculated size of the
// node and the number of corrected treesizes in the subtree.
func recalculateNode(cfg *config.Config, spaceID, path string, dryRun, verbose bool, table *tablewriter.Table) (uint64, int, error) {
attribs, err := readAttributes(path)
if err != nil {
return 0, 0, err
}
// Files simply report their blobsize, there is nothing to recalculate. Only an
// explicit file type is treated as a file, everything else is walked as a
// directory: a space root for example carries no type attribute at all. This
// matches how the propagator classifies children.
if string(attribs[prefixes.TypeAttr]) == strconv.FormatUint(uint64(provider.ResourceType_RESOURCE_TYPE_FILE), 10) {
size, err := strconv.ParseUint(string(attribs[prefixes.BlobsizeAttr]), 10, 64)
if err != nil {
// a node without a blobsize contributes nothing, but it is worth reporting
if verbose {
fmt.Fprintf(os.Stderr, " Could not read blobsize of %s: %s\n", path, err)
}
return 0, 0, nil
}
return size, 0, nil
}
entries, err := os.ReadDir(path)
if err != nil {
if errors.Is(err, fs.ErrNotExist) {
return 0, 0, nil
}
return 0, 0, err
}
var (
calculated uint64
corrected int
)
for _, entry := range entries {
child, err := filepath.EvalSymlinks(filepath.Join(path, entry.Name()))
if err != nil {
// dangling child entry, it contributes nothing
if verbose {
fmt.Fprintf(os.Stderr, " Could not resolve child %s: %s\n", entry.Name(), err)
}
continue
}
size, n, err := recalculateNode(cfg, spaceID, child, dryRun, verbose, table)
if err != nil {
if verbose {
fmt.Fprintf(os.Stderr, " Could not recalculate child %s: %s\n", child, err)
}
continue
}
calculated += size
corrected += n
}
stored, storedErr := strconv.ParseUint(string(attribs[prefixes.TreesizeAttr]), 10, 64)
if storedErr == nil && stored == calculated {
return calculated, corrected, nil
}
storedStr := string(attribs[prefixes.TreesizeAttr])
if storedStr == "" {
storedStr = "unset"
}
diff := "n/a"
if storedErr == nil {
diff = fmt.Sprintf("%+d", int64(calculated)-int64(stored))
}
table.Append([]string{spaceID, nodeIDFromPath(path), storedStr, strconv.FormatUint(calculated, 10), diff})
corrected++
if !dryRun {
if err := writeTreesize(path, attribs, calculated); err != nil {
return calculated, corrected, fmt.Errorf("could not write treesize of %s: %w", path, err)
}
}
return calculated, corrected, nil
}
// readAttributes reads the messagepack metadata of the node at the given path
func readAttributes(path string) (map[string][]byte, error) {
b, err := os.ReadFile(path + metadataExtension)
if err != nil {
return nil, err
}
attribs := map[string][]byte{}
if err := msgpack.Unmarshal(b, &attribs); err != nil {
return nil, err
}
return attribs, nil
}
// writeTreesize sets the treesize attribute of the node at the given path
func writeTreesize(path string, attribs map[string][]byte, size uint64) error {
attribs[prefixes.TreesizeAttr] = []byte(strconv.FormatUint(size, 10))
b, err := msgpack.Marshal(attribs)
if err != nil {
return err
}
return os.WriteFile(path+metadataExtension, b, 0600)
}
// nodeIDFromPath rebuilds the node id from a pathified node path, i.e.
// .../nodes/5b/ba/1e/a7/-f185-4f31-8342-ed4b5743f096 -> 5bba1ea7-f185-4f31-8342-ed4b5743f096
func nodeIDFromPath(path string) string {
parts := strings.Split(path, string(filepath.Separator))
if len(parts) < 5 {
return path
}
return strings.Join(parts[len(parts)-5:], "")
}
@@ -0,0 +1,180 @@
package command
import (
"os"
"path/filepath"
"strconv"
"testing"
provider "github.com/cs3org/go-cs3apis/cs3/storage/provider/v1beta1"
"github.com/olekukonko/tablewriter"
"github.com/owncloud/reva/v2/pkg/storage/utils/decomposedfs/metadata/prefixes"
"github.com/shamaton/msgpack/v2"
"github.com/test-go/testify/require"
)
// writeNode creates a node file with the given attributes on disk
func writeNode(t *testing.T, path string, attribs map[string][]byte) {
t.Helper()
require.NoError(t, os.MkdirAll(filepath.Dir(path), 0700))
b, err := msgpack.Marshal(attribs)
require.NoError(t, err)
require.NoError(t, os.WriteFile(path+metadataExtension, b, 0600))
}
// writeFileNode creates a file node with the given blobsize. The node file itself
// has to exist as well, decomposedfs resolves children through it.
func writeFileNode(t *testing.T, path string, blobsize int) {
t.Helper()
writeNode(t, path, map[string][]byte{
prefixes.TypeAttr: []byte(strconv.FormatUint(uint64(provider.ResourceType_RESOURCE_TYPE_FILE), 10)),
prefixes.BlobsizeAttr: []byte(strconv.Itoa(blobsize)),
})
require.NoError(t, os.WriteFile(path, []byte{}, 0600))
}
// writeDirNode creates a directory node with the given stored treesize
func writeDirNode(t *testing.T, path string, treesize int) {
t.Helper()
require.NoError(t, os.MkdirAll(path, 0700))
writeNode(t, path, map[string][]byte{
prefixes.TypeAttr: []byte(strconv.FormatUint(uint64(provider.ResourceType_RESOURCE_TYPE_CONTAINER), 10)),
prefixes.TreesizeAttr: []byte(strconv.Itoa(treesize)),
})
}
// storedTreesize reads back the treesize attribute of a node
func storedTreesize(t *testing.T, path string) string {
t.Helper()
attribs, err := readAttributes(path)
require.NoError(t, err)
return string(attribs[prefixes.TreesizeAttr])
}
// linkChild links a child node into a parent directory, mirroring how decomposedfs
// references children by symlink
func linkChild(t *testing.T, parent, child, name string) {
t.Helper()
rel, err := filepath.Rel(parent, child)
require.NoError(t, err)
require.NoError(t, os.Symlink(rel, filepath.Join(parent, name)))
}
func TestRecalculateNode(t *testing.T) {
t.Run("corrects a wrong treesize", func(t *testing.T) {
root := t.TempDir()
dir := filepath.Join(root, "dir")
writeDirNode(t, dir, 999)
f := filepath.Join(root, "file")
writeFileNode(t, f, 100)
linkChild(t, dir, f, "file")
size, corrected, err := recalculateNode(nil, "spaceid", dir, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(100), size)
require.Equal(t, 1, corrected)
require.Equal(t, "100", storedTreesize(t, dir))
})
t.Run("leaves a correct treesize untouched", func(t *testing.T) {
root := t.TempDir()
dir := filepath.Join(root, "dir")
writeDirNode(t, dir, 100)
f := filepath.Join(root, "file")
writeFileNode(t, f, 100)
linkChild(t, dir, f, "file")
size, corrected, err := recalculateNode(nil, "spaceid", dir, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(100), size)
require.Equal(t, 0, corrected)
})
t.Run("does not write in dry-run mode", func(t *testing.T) {
root := t.TempDir()
dir := filepath.Join(root, "dir")
writeDirNode(t, dir, 999)
f := filepath.Join(root, "file")
writeFileNode(t, f, 100)
linkChild(t, dir, f, "file")
size, corrected, err := recalculateNode(nil, "spaceid", dir, true, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(100), size)
require.Equal(t, 1, corrected)
require.Equal(t, "999", storedTreesize(t, dir), "dry-run must not write the treesize")
})
t.Run("sums nested directories bottom up", func(t *testing.T) {
root := t.TempDir()
outer := filepath.Join(root, "outer")
writeDirNode(t, outer, 0)
inner := filepath.Join(root, "inner")
writeDirNode(t, inner, 0)
f1 := filepath.Join(root, "f1")
writeFileNode(t, f1, 10)
f2 := filepath.Join(root, "f2")
writeFileNode(t, f2, 32)
linkChild(t, inner, f2, "f2")
linkChild(t, outer, f1, "f1")
linkChild(t, outer, inner, "inner")
size, corrected, err := recalculateNode(nil, "spaceid", outer, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(42), size)
require.Equal(t, 2, corrected, "both the inner and the outer directory are corrected")
require.Equal(t, "32", storedTreesize(t, inner))
require.Equal(t, "42", storedTreesize(t, outer))
})
t.Run("treats a node without a type attribute as a directory", func(t *testing.T) {
// space roots carry no type attribute
root := t.TempDir()
spaceRoot := filepath.Join(root, "space")
require.NoError(t, os.MkdirAll(spaceRoot, 0700))
writeNode(t, spaceRoot, map[string][]byte{
prefixes.TreesizeAttr: []byte("999"),
})
f := filepath.Join(root, "file")
writeFileNode(t, f, 64)
linkChild(t, spaceRoot, f, "file")
size, corrected, err := recalculateNode(nil, "spaceid", spaceRoot, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(64), size)
require.Equal(t, 1, corrected)
require.Equal(t, "64", storedTreesize(t, spaceRoot))
})
t.Run("skips dangling child links", func(t *testing.T) {
root := t.TempDir()
dir := filepath.Join(root, "dir")
writeDirNode(t, dir, 0)
f := filepath.Join(root, "file")
writeFileNode(t, f, 20)
linkChild(t, dir, f, "file")
require.NoError(t, os.Symlink("../gone", filepath.Join(dir, "gone")))
size, _, err := recalculateNode(nil, "spaceid", dir, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, uint64(20), size, "the dangling entry contributes nothing")
})
t.Run("sets an unset treesize", func(t *testing.T) {
root := t.TempDir()
dir := filepath.Join(root, "dir")
require.NoError(t, os.MkdirAll(dir, 0700))
writeNode(t, dir, map[string][]byte{
prefixes.TypeAttr: []byte(strconv.FormatUint(uint64(provider.ResourceType_RESOURCE_TYPE_CONTAINER), 10)),
})
f := filepath.Join(root, "file")
writeFileNode(t, f, 7)
linkChild(t, dir, f, "file")
_, corrected, err := recalculateNode(nil, "spaceid", dir, false, false, tablewriter.NewTable(os.Stdout))
require.NoError(t, err)
require.Equal(t, 1, corrected)
require.Equal(t, "7", storedTreesize(t, dir))
})
}
+10 -4
View File
@@ -229,8 +229,11 @@ type FilemetadataCache struct {
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_FILEMETADATA_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
// IDCache holds cache config
@@ -240,8 +243,11 @@ type IDCache struct {
Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens have no expiration. Defaults to 300s which is derived from the underlaying package though not explicitly set as default. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
// S3Driver is the storage driver configuration when using 's3' storage driver
@@ -102,8 +102,11 @@ func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} {
"cache_database": cfg.IDCache.Database,
"cache_ttl": cfg.IDCache.TTL,
"cache_disable_persistence": cfg.IDCache.DisablePersistence,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_enable_tls": cfg.IDCache.EnableTLS,
"cache_tls_insecure": cfg.IDCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate,
},
"filemetadatacache": map[string]interface{}{
"cache_store": cfg.FilemetadataCache.Store,
@@ -111,8 +114,11 @@ func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} {
"cache_database": cfg.FilemetadataCache.Database,
"cache_ttl": cfg.FilemetadataCache.TTL,
"cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_enable_tls": cfg.FilemetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate,
},
"use_space_groups": cfg.Drivers.Posix.UseSpaceGroups,
"watch_fs": enableFSWatch,
@@ -186,8 +192,11 @@ func Ocis(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.FilemetadataCache.Database,
"cache_ttl": cfg.FilemetadataCache.TTL,
"cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_enable_tls": cfg.FilemetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate,
},
"idcache": map[string]interface{}{
"cache_store": cfg.IDCache.Store,
@@ -195,8 +204,11 @@ func Ocis(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.IDCache.Database,
"cache_ttl": cfg.IDCache.TTL,
"cache_disable_persistence": cfg.IDCache.DisablePersistence,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_enable_tls": cfg.IDCache.EnableTLS,
"cache_tls_insecure": cfg.IDCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate,
},
"events": map[string]interface{}{
"numconsumers": cfg.Events.NumConsumers,
@@ -214,6 +226,7 @@ func Ocis(cfg *config.Config) map[string]interface{} {
// OcisNoEvents is the config mapping for the ocis storage driver emitting no events
func OcisNoEvents(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"mount_id": cfg.MountID,
"metadata_backend": "messagepack",
"propagator": cfg.Drivers.OCIS.Propagator,
"async_propagator_options": map[string]interface{}{
@@ -241,8 +254,11 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.FilemetadataCache.Database,
"cache_ttl": cfg.FilemetadataCache.TTL,
"cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_enable_tls": cfg.FilemetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate,
},
"idcache": map[string]interface{}{
"cache_store": cfg.IDCache.Store,
@@ -250,8 +266,11 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.IDCache.Database,
"cache_ttl": cfg.IDCache.TTL,
"cache_disable_persistence": cfg.IDCache.DisablePersistence,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_enable_tls": cfg.IDCache.EnableTLS,
"cache_tls_insecure": cfg.IDCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate,
},
}
}
@@ -272,6 +291,7 @@ func S3(cfg *config.Config) map[string]interface{} {
// S3NG is the config mapping for the s3ng storage driver
func S3NG(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"mount_id": cfg.MountID,
"metadata_backend": "messagepack",
"propagator": cfg.Drivers.S3NG.Propagator,
"async_propagator_options": map[string]interface{}{
@@ -310,8 +330,11 @@ func S3NG(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.FilemetadataCache.Database,
"cache_ttl": cfg.FilemetadataCache.TTL,
"cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_enable_tls": cfg.FilemetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate,
},
"idcache": map[string]interface{}{
"cache_store": cfg.IDCache.Store,
@@ -319,8 +342,11 @@ func S3NG(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.IDCache.Database,
"cache_ttl": cfg.IDCache.TTL,
"cache_disable_persistence": cfg.IDCache.DisablePersistence,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_enable_tls": cfg.IDCache.EnableTLS,
"cache_tls_insecure": cfg.IDCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate,
},
"events": map[string]interface{}{
"numconsumers": cfg.Events.NumConsumers,
@@ -338,6 +364,7 @@ func S3NG(cfg *config.Config) map[string]interface{} {
// S3NGNoEvents is the config mapping for the s3ng storage driver emitting no events
func S3NGNoEvents(cfg *config.Config) map[string]interface{} {
return map[string]interface{}{
"mount_id": cfg.MountID,
"metadata_backend": "messagepack",
"propagator": cfg.Drivers.S3NG.Propagator,
"async_propagator_options": map[string]interface{}{
@@ -369,8 +396,11 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.FilemetadataCache.Database,
"cache_ttl": cfg.FilemetadataCache.TTL,
"cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_auth_username": cfg.FilemetadataCache.AuthUsername,
"cache_auth_password": cfg.FilemetadataCache.AuthPassword,
"cache_enable_tls": cfg.FilemetadataCache.EnableTLS,
"cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate,
},
"idcache": map[string]interface{}{
"cache_store": cfg.IDCache.Store,
@@ -378,8 +408,11 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} {
"cache_database": cfg.IDCache.Database,
"cache_ttl": cfg.IDCache.TTL,
"cache_disable_persistence": cfg.IDCache.DisablePersistence,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_auth_username": cfg.IDCache.AuthUsername,
"cache_auth_password": cfg.IDCache.AuthPassword,
"cache_enable_tls": cfg.IDCache.EnableTLS,
"cache_tls_insecure": cfg.IDCache.TLSInsecure,
"cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate,
},
}
}
+1
View File
@@ -95,6 +95,7 @@ func Server(cfg *config.Config) *cli.Command {
microstore.Database(cfg.Persistence.Database),
microstore.Table(cfg.Persistence.Table),
store.Authentication(cfg.Persistence.AuthUsername, cfg.Persistence.AuthPassword),
store.TLS(cfg.Persistence.EnableTLS, cfg.Persistence.TLSInsecure, cfg.Persistence.TLSRootCACertificate),
)
tm, err := pool.StringToTLSMode(cfg.GRPCClientTLS.Mode)
+5 -2
View File
@@ -45,8 +45,11 @@ type Persistence struct {
Database string `yaml:"database" env:"USERLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"`
Table string `yaml:"table" env:"USERLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"`
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"`
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." 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"`
}
// Events combines the configuration options for the event bus.
+1 -1
View File
@@ -34,7 +34,7 @@ ci-node-generate: build-assets
build-assets:
cd $(WEB_DIR) && pnpm install && pnpm check:types && pnpm build
cp $(WEB_DIR)/config/config.json.dist $(WEB_DIR)/dist/
git clean -xfd assets
if ! git status > /dev/null; then echo 'Re-extract the source to a clean directory to avoid leftover files.'; else git clean -xfd assets; fi
cp -r $(WEB_DIR)/dist/. assets/core/
############ licenses ############
+10 -6
View File
@@ -1831,29 +1831,33 @@ class GraphHelper {
/**
* @param string $baseUrl
* @param string $user
* @param string $password
* @param string|null $user
* @param string|null $password
* @param string $spaceId
* @param string $itemId
* @param mixed $body
* @param array $headers
* @param boolean $isVault
*
* @return ResponseInterface
* @throws GuzzleException
*/
public static function createLinkShare(
string $baseUrl,
string $user,
string $password,
?string $user,
?string $password,
string $spaceId,
string $itemId,
$body,
array $headers = [],
bool $isVault = false,
): ResponseInterface {
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/createLink");
$url = self::getBetaFullUrl($baseUrl, "drives/$spaceId/items/$itemId/createLink", $isVault);
return HttpRequestHelper::post(
$url,
$user,
$password,
self::getRequestHeaders(),
array_merge(self::getRequestHeaders(), $headers),
$body,
);
}
+1 -1
View File
@@ -192,7 +192,7 @@ class EmailContext implements Context {
$expectedEmailBodyContent,
$actualEmailBodyContent,
"The email address '$address' should have received an"
. "email with the body containing $expectedEmailBodyContent
. " email with the body containing $expectedEmailBodyContent
but the received email is $actualEmailBodyContent",
);
}
@@ -71,14 +71,15 @@ class SharingNgContext implements Context {
public function createLinkShare(string $user, TableNode $body): ResponseInterface {
$bodyRows = $body->getRowsHash();
$resource = $bodyRows['resource'] ?? "";
$isVault = isset($bodyRows['storage']) && $bodyRows['storage'] === 'vault';
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space']);
$space = $this->spacesContext->getSpaceByName($user, $bodyRows['space'], $isVault);
$spaceId = $space['id'];
if ($resource === '' && !\in_array($bodyRows['space'], ['Personal', 'Shares'])) {
$itemId = $space['fileId'];
} else {
$itemId = $this->spacesContext->getResourceId($user, $bodyRows['space'], $resource);
$itemId = $this->spacesContext->getResourceId($user, $bodyRows['space'], $resource, $isVault);
}
$bodyRows['quickLink'] = $bodyRows['quickLink'] ?? false;
@@ -97,13 +98,25 @@ class SharingNgContext implements Context {
'password' => $this->featureContext->getActualPassword($bodyRows['password']),
];
$headers = [];
if (KeycloakHelper::isTestingWithKeycloak()) {
$accessToken = $this->featureContext->getOcisUserToken($user)['token']['accessToken'];
$headers['Authorization'] = 'Bearer ' . $accessToken;
$user = null;
$password = null;
} else {
$password = $this->featureContext->getPasswordForUser($user);
}
$response = GraphHelper::createLinkShare(
$this->featureContext->getBaseUrl(),
$user,
$this->featureContext->getPasswordForUser($user),
$password,
$spaceId,
$itemId,
\json_encode($body),
$headers,
$isVault,
);
if ($response->getStatusCode() == 200) {
+14 -1
View File
@@ -1929,11 +1929,12 @@ class SpacesContext implements Context {
}
/**
* @Given /^user "([^"]*)" has created a space "([^"]*)"(| in vault)? with the default quota using the Graph API$/
* @Given /^user "([^"]*)" has created a space "([^"]*)"(| in vault)?(| with retry) with the default quota using the Graph API$/
*
* @param string $user
* @param string $spaceName
* @param string $isVault
* @param string $withRetry
*
* @return void
*
@@ -1944,10 +1945,22 @@ class SpacesContext implements Context {
string $user,
string $spaceName,
string $isVault,
string $withRetry,
): void {
$space = ["name" => $spaceName];
$isVault = trim($isVault) === "in vault";
$withRetry = trim($withRetry) === "with retry";
// The user role may take some time to update
// This can cause an unauthorized error
// Retry once after 1 second
$response = $this->createSpace($user, $space, $isVault);
if ($withRetry && $response->getStatusCode() === 401) {
sleep(1); // Wait 1 second before retrying.
$response = $this->createSpace($user, $space, $isVault);
}
$this->featureContext->theHTTPStatusCodeShouldBe(
201,
"Expected response status code should be 201 (Created)",
@@ -399,7 +399,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiGraphUser/editUser.feature:231](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/editUser.feature#L231)
- [apiGraphUser/editUser.feature:235](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/editUser.feature#L235)
- [apiGraphUser/getUser.feature:696](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L696)
- [apiGraphUser/getUser.feature:700](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraphUser/getUser.feature#L700)
#### [metadata search gives 500](https://github.com/owncloud/ocis/issues/12230)
- [apiSearchContent/metadataSerch.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSearchContent/metadataSerch.feature#L30)
@@ -834,7 +834,7 @@ Feature: collaboration (wopi)
Scenario: user with Viewer role tries to create a odt file inside shared project space using wopi endpoint
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "new-space" with the default quota using the Graph API
And user "Alice" has created a space "new-space" with retry with the default quota using the Graph API
And user "Alice" has created a folder "testFolder" in space "new-space"
And user "Alice" has sent the following space share invitation:
| space | new-space |
@@ -694,10 +694,6 @@ Feature: get users
| Admin | Space Admin |
| Admin | User |
| Admin | User Light |
| Space Admin | Admin |
| Space Admin | Space Admin |
| Space Admin | User |
| Space Admin | User Light |
Scenario Outline: non-admin user tries to get drive information of other user with different user role
@@ -723,15 +719,19 @@ Feature: get users
}
"""
Examples:
| user-role | user-role-2 |
| User | Admin |
| User | Space Admin |
| User | User |
| User | User Light |
| User Light | Admin |
| User Light | Space Admin |
| User Light | User |
| User Light | User Light |
| user-role | user-role-2 |
| Space Admin | Admin |
| Space Admin | Space Admin |
| Space Admin | User |
| Space Admin | User Light |
| User | Admin |
| User | Space Admin |
| User | User |
| User | User Light |
| User Light | Admin |
| User Light | Space Admin |
| User Light | User |
| User Light | User Light |
Scenario Outline: user with different user role gets his/her own drive information
@@ -414,3 +414,30 @@ Feature: Notification
| resource |
| HelloWorld |
| text.txt |
@issue-11908 @email
Scenario: recipient should not get PO file headers on removing access from resource for translated locale
Given user "Brian" has switched the system language to "es" using the Graph API
And user "Alice" has sent the following resource share invitation:
| resource | textfile1.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Alice" removes the access of user "Brian" from resource "textfile1.txt" of space "Personal" using the Graph API
Then the HTTP status code should be "204"
And user "Brian" should get a notification with subject "Recurso no compartido" and message:
| message |
| Alice Hansen dejó de compartir textfile1.txt contigo |
And user "Brian" should have received the following email from user "Alice"
"""
Hola Brian Murphy,
Alice Hansen ha eliminado la compartición 'textfile1.txt' con usted.
incluso habiendo eliminado esta compartición, usted podría tener acceso a través de otras comparticiones y/o membresías en spaces.
---
ownCloud - Store. Share. Work.
"""
@@ -311,3 +311,67 @@ Feature: Remove access to a drive item
Then the HTTP status code should be "204"
And for user "Brian" the space "Shares" should not contain these entries:
| folderToShare |
Scenario Outline: space viewer and space editor tries to remove the space creator from the project space using the permissions endpoint
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" removes the access of user "Alice" from space "NewSpace" using permissions endpoint of the Graph API
Then the HTTP status code should be "403"
And the user "Alice" should have a space called "NewSpace"
And the user "Brian" should have a space called "NewSpace"
Examples:
| permissions-role |
| Space Viewer |
| Space Editor |
Scenario: space manager can remove the space creator from the project space using the permissions endpoint
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Manager |
When user "Brian" removes the access of user "Alice" from space "NewSpace" using permissions endpoint of the Graph API
Then the HTTP status code should be "204"
And the user "Alice" should not have a space called "NewSpace"
And the user "Brian" should have a space called "NewSpace"
Scenario Outline: space viewer and space editor tries to remove themselves from the project space using the permissions endpoint
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | <permissions-role> |
When user "Brian" removes the access of user "Brian" from space "NewSpace" using permissions endpoint of the Graph API
Then the HTTP status code should be "403"
And the user "Alice" should have a space called "NewSpace"
And the user "Brian" should have a space called "NewSpace"
Examples:
| permissions-role |
| Space Viewer |
| Space Editor |
Scenario: space manager can remove themselves from the project space using the permissions endpoint
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
And user "Alice" has sent the following space share invitation:
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Manager |
When user "Brian" removes the access of user "Brian" from space "NewSpace" using permissions endpoint of the Graph API
Then the HTTP status code should be "204"
And the user "Brian" should not have a space called "NewSpace"
And the user "Alice" should have a space called "NewSpace"
@@ -49,10 +49,10 @@ Feature: Space management
And the json response should not contain a space with name "Alice Hansen"
Scenario: space admin user can see another personal spaces
Scenario: space admin user cannot see another user's personal space
When user "Brian" lists all spaces via the Graph API with query "$filter=driveType eq 'personal'"
Then the HTTP status code should be "200"
And the JSON response should contain space called "Alice Hansen" and match
And the JSON response should contain space called "Brian Murphy" and match
"""
{
"type": "object",
@@ -64,7 +64,7 @@ Feature: Space management
"properties": {
"name": {
"type": "string",
"enum": ["Alice Hansen"]
"enum": ["Brian Murphy"]
},
"driveType": {
"type": "string",
@@ -77,6 +77,7 @@ Feature: Space management
}
}
"""
And the json response should not contain a space with name "Alice Hansen"
And the json response should not contain a space with name "Project"
@@ -275,6 +275,123 @@ Feature: vault
| testfile.txt |
Scenario: user tries to create a public link of a folder inside vault
Given user "Alice" has logged in via web UI
And user "Alice" has created a folder "vaultFolder" in space "Personal" in vault
When user "Alice" creates the following resource link share using the Graph API:
| resource | vaultFolder |
| space | Personal |
| permissionsRole | View |
| storage | vault |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": ["code", "innererror", "message"],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "public links are not allowed for vault resources"
}
}
}
}
}
"""
Scenario: user tries to create a public link of a file inside vault
Given user "Alice" has logged in via web UI
And user "Alice" has uploaded a file inside space "Personal" with content "some content" to "testfile.txt" in vault
When user "Alice" creates the following resource link share using the Graph API:
| resource | testfile.txt |
| space | Personal |
| permissionsRole | View |
| storage | vault |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": ["code", "innererror", "message"],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "public links are not allowed for vault resources"
}
}
}
}
}
"""
Scenario: user tries to create a public link of a space root inside vault
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has logged in via web UI
And user "Alice" has created a space "vault-space" in vault with the default quota using the Graph API
When user "Alice" tries to create the following space link share using permissions endpoint of the Graph API:
| space | vault-space |
| permissionsRole | View |
| storage | vault |
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["error"],
"properties": {
"error": {
"type": "object",
"required": ["code", "innererror", "message"],
"properties": {
"code": {
"const": "invalidRequest"
},
"innererror": {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message": {
"const": "public links are not allowed for vault resources"
}
}
}
}
}
"""
Scenario Outline: send share invitation for project space in vault to user with different roles (permissions endpoint)
Given the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has logged in via web UI
@@ -90,9 +90,9 @@ Feature: sharing
@issue-8242 @env-config
Scenario Outline: share receiver renames the shared item (old/new webdav)
Given user "Alice" has uploaded file with content "foo" to "/sharefile.txt"
Given using <dav-path-version> DAV path
And the administrator has enabled the permissions role "Secure Viewer"
And using <dav-path-version> DAV path
And user "Alice" has uploaded file with content "foo" to "/sharefile.txt"
And user "Alice" has sent the following resource share invitation:
| resource | sharefile.txt |
| space | Personal |
@@ -133,8 +133,9 @@ Feature: sharing
@issue-8242 @env-config
Scenario Outline: share receiver renames the shared item (spaces webdav)
Given user "Alice" has uploaded file with content "foo" to "/sharefile.txt"
Given using spaces DAV path
And the administrator has enabled the permissions role "Secure Viewer"
And user "Alice" has uploaded file with content "foo" to "/sharefile.txt"
And user "Alice" has sent the following resource share invitation:
| resource | sharefile.txt |
| space | Personal |
@@ -154,7 +155,6 @@ Feature: sharing
And as "Carol" file "Shares/renamedsharefile.txt" should exist
And as "Brian" file "Shares/sharefile.txt" should exist
And as "Alice" file "sharefile.txt" should exist
And using spaces DAV path
When user "Carol" sends HTTP method "PROPFIND" to URL "<dav-path>"
Then the HTTP status code should be "207"
And as user "Carol" the value of the item "//oc:name" of path "<dav-path>/renamedsharefile.txt" in the response should be "renamedsharefile.txt"
@@ -219,7 +219,7 @@ Feature: download file
And the following headers should be set
| header | value |
| Content-Disposition | attachment; filename*=UTF-8''<encoded-file-name>; filename="<file-name>" |
| Content-Security-Policy | child-src 'self'; connect-src 'self' blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/; default-src 'none'; font-src 'self' data:; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
| Content-Security-Policy | child-src 'self'; connect-src 'self' blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/ https://marketplace.owncloud.com/; default-src 'none'; font-src 'self' data:; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/ https://marketplace.owncloud.com/; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
| X-Content-Type-Options | nosniff |
| X-Frame-Options | SAMEORIGIN |
| X-Permitted-Cross-Domain-Policies | none |
@@ -246,7 +246,7 @@ Feature: download file
And the following headers should be set
| header | value |
| Content-Disposition | attachment; filename*=UTF-8''%22quote%22double%22.txt; filename=""quote"double".txt" |
| Content-Security-Policy | child-src 'self'; connect-src 'self' blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/; default-src 'none'; font-src 'self' data:; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
| Content-Security-Policy | child-src 'self'; connect-src 'self' blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/ https://marketplace.owncloud.com/; default-src 'none'; font-src 'self' data:; frame-ancestors 'self'; frame-src 'self' blob: https://embed.diagrams.net/; img-src 'self' data: blob: https://raw.githubusercontent.com/owncloud/awesome-ocis/ https://marketplace.owncloud.com/; manifest-src 'self'; media-src 'self'; object-src 'self' blob:; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline' |
| X-Content-Type-Options | nosniff |
| X-Frame-Options | SAMEORIGIN |
| X-Permitted-Cross-Domain-Policies | none |
+2
View File
@@ -5,6 +5,7 @@ directives:
- '''self'''
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${KEYCLOAK_DOMAIN|keycloak.owncloud.test}/'
- 'https://localhost:8443/'
@@ -27,6 +28,7 @@ directives:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
# In contrary to bash and docker the default is given after the | character
- 'https://${ONLYOFFICE_DOMAIN|onlyoffice:443}/'
- 'https://${COLLABORA_DOMAIN|collabora:9980}/'
+2
View File
@@ -94,6 +94,7 @@ http:
- "'self'"
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
defaultSrc:
- "'none'"
fontSrc:
@@ -110,6 +111,7 @@ http:
- 'data:'
- 'blob:'
- 'https://raw.githubusercontent.com/owncloud/awesome-ocis/'
- 'https://marketplace.owncloud.com/'
manifestSrc:
- "'self'"
mediaSrc:
Loaded 100 of 418 files, more files were not shown because too many files have changed in this diff. Show more