Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ac24d9b9a | ||
|
|
9b6a08fdf9 | ||
|
|
294453e31f | ||
|
|
af8c14f124 | ||
|
|
6f4552eb99 | ||
|
|
7bade0a76b | ||
|
|
9ec70585cc | ||
|
|
430fdb5c2a | ||
|
|
47c96bf8ee | ||
|
|
89d028edbd | ||
|
|
f73b3a524e | ||
|
|
9553d80d41 | ||
|
|
d81e26b1f6 | ||
|
|
68fb545935 | ||
|
|
6bcc233282 | ||
|
|
c117c5513f | ||
|
|
641dd4d2e8 | ||
|
|
d5de682266 | ||
|
|
265e63a70d | ||
|
|
2c918627b3 |
No files matched your search
@@ -3837,6 +3837,7 @@ def prepareOcisDeployment():
|
||||
"sed -i '/{{- define \"ocis.basicServiceTemplates\" -}}/a\\\\ {{- $_ := set .scope \"appNameAuthBasic\" \"authbasic\" -}}' ./charts/ocis/templates/_common/_tplvalues.tpl",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/{n;N;N;N;d;}' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: IDM_ADMIN_PASSWORD/a\\\\\\n value: \"admin\"' ./charts/ocis/templates/idm/deployment.yaml",
|
||||
"sed -i '/- name: STORAGE_PUBLICLINK_DEBUG_ADDR/i\\\\ {{- include \"ocis.persistentStore\" . | nindent 12 }}\\\n' ./charts/ocis/templates/storagepubliclink/deployment.yaml",
|
||||
"sed -i '/- name: PROXY_HTTP_ADDR/i\\\\ - name: PROXY_ENABLE_BASIC_AUTH\\\n value: \"true\"' ./charts/ocis/templates/proxy/deployment.yaml",
|
||||
"sed -i 's|/etc/ocis/sharing-banned-passwords.txt|config/drone/banned-password-list.txt|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
"sed -i 's|- name: configs|- name: banned-passwords|' ./charts/ocis/templates/sharing/deployment.yaml",
|
||||
|
||||
@@ -76,6 +76,8 @@ The following sections list the changes for unreleased.
|
||||
* Bugfix - Fix error code when a user can't disable a space: [#11845](https://github.com/owncloud/ocis/pull/11845)
|
||||
* Bugfix - Fix Sharingroles: [#11898](https://github.com/owncloud/ocis/pull/11898)
|
||||
* Bugfix - Fix the error handling for empty name on space update: [#11933](https://github.com/owncloud/ocis/pull/11933)
|
||||
* Bugfix - Translation for some email notifications: [#11979](https://github.com/owncloud/ocis/pull/11979)
|
||||
* Bugfix - Rework monitoring in the ocis_full deployment example: [#11995](https://github.com/owncloud/ocis/pull/11995)
|
||||
* Change - Remove deprecated OCIS_SHOW_USER_EMAIL_IN_RESULTS: [#11942](https://github.com/owncloud/ocis/pull/11942)
|
||||
* Enhancement - Bump Reva: [#460](https://github.com/owncloud/reva/pull/460)
|
||||
* Enhancement - Set Referrer-Policy to no-referrer: [#11722](https://github.com/owncloud/ocis/pull/11722)
|
||||
@@ -99,6 +101,7 @@ The following sections list the changes for unreleased.
|
||||
* Enhancement - Update the traefik image for some deployment examples: [#11915](https://github.com/owncloud/ocis/pull/11915)
|
||||
* Enhancement - Add users instances: [#11925](https://github.com/owncloud/ocis/pull/11925)
|
||||
* Enhancement - Introduce external shares permission: [#11931](https://github.com/owncloud/ocis/pull/11931)
|
||||
* Enhancement - Add AI-assisted development guide: [#11941](https://github.com/owncloud/ocis/pull/11941)
|
||||
* Enhancement - Bump Web to 12.3.0: [#13519](https://github.com/owncloud/web/pull/13519)
|
||||
|
||||
## Details
|
||||
@@ -166,6 +169,27 @@ The following sections list the changes for unreleased.
|
||||
https://github.com/owncloud/ocis/issues/11887
|
||||
https://github.com/owncloud/ocis/pull/11933
|
||||
|
||||
* Bugfix - Translation for some email notifications: [#11979](https://github.com/owncloud/ocis/pull/11979)
|
||||
|
||||
Some email notifications showed a wrong translated message that shouldn't
|
||||
appear. It's fixed so that message won't appear anymore.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11979
|
||||
|
||||
* Bugfix - Rework monitoring in the ocis_full deployment example: [#11995](https://github.com/owncloud/ocis/pull/11995)
|
||||
|
||||
The ocis_full deployment example has been basically reworked for how to provide
|
||||
monitoring.
|
||||
|
||||
We now have: - a singe place for the definition of the tracing envvars for all
|
||||
ocis related container services - an easy and modular setup defining which
|
||||
sources should be inlcuded in monitoring via .env - comments describing the
|
||||
setup for the ease extending it - the monitoring definition in .env has been
|
||||
moved to the bottom and the compose_file assembly has monitoring as last entry
|
||||
now to guarantee nothing gets overwritten by accident
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11995
|
||||
|
||||
* Change - Remove deprecated OCIS_SHOW_USER_EMAIL_IN_RESULTS: [#11942](https://github.com/owncloud/ocis/pull/11942)
|
||||
|
||||
Deprecated OCIS_SHOW_USER_EMAIL_IN_RESULTS environment variable was removed from
|
||||
@@ -394,6 +418,18 @@ The following sections list the changes for unreleased.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11931
|
||||
|
||||
* Enhancement - Add AI-assisted development guide: [#11941](https://github.com/owncloud/ocis/pull/11941)
|
||||
|
||||
A new guide has been added to the oCIS documentation demonstrating how to build
|
||||
web extensions using AI-assisted development with Claude AI. The guide covers
|
||||
MCP connector setup, a five-phase development workflow, debugging techniques,
|
||||
and contribution workflows.
|
||||
|
||||
This approach has been validated through real contributions including PR #11912
|
||||
(photo metadata search backend) and web extensions PRs #305 and #306.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11941
|
||||
|
||||
* Enhancement - Bump Web to 12.3.0: [#13519](https://github.com/owncloud/web/pull/13519)
|
||||
|
||||
Bugfix [owncloud/web#13406](https://github.com/owncloud/web/pull/13406): Prevent
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Enhancement: Add AI-assisted development guide
|
||||
|
||||
A new guide has been added to the oCIS documentation demonstrating how to build
|
||||
web extensions using AI-assisted development with Claude AI. The guide covers
|
||||
MCP connector setup, a five-phase development workflow, debugging techniques,
|
||||
and contribution workflows.
|
||||
|
||||
This approach has been validated through real contributions including PR #11912
|
||||
(photo metadata search backend) and web extensions PRs #305 and #306.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11941
|
||||
@@ -0,0 +1,6 @@
|
||||
Bugfix: Translation for some email notifications
|
||||
|
||||
Some email notifications showed a wrong translated message that shouldn't appear.
|
||||
It's fixed so that message won't appear anymore.
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11979
|
||||
@@ -0,0 +1,12 @@
|
||||
Bugfix: Rework monitoring in the ocis_full deployment example
|
||||
|
||||
The ocis_full deployment example has been basically reworked for how to provide monitoring.
|
||||
|
||||
We now have:
|
||||
- a singe place for the definition of the tracing envvars for all ocis related container services
|
||||
- an easy and modular setup defining which sources should be inlcuded in monitoring via .env
|
||||
- comments describing the setup for the ease extending it
|
||||
- the monitoring definition in .env has been moved to the bottom and the compose_file assembly
|
||||
has monitoring as last entry now to guarantee nothing gets overwritten by accident
|
||||
|
||||
https://github.com/owncloud/ocis/pull/11995
|
||||
@@ -204,12 +204,6 @@ COLLABORA_SSL_VERIFICATION=false
|
||||
# and configure the service as required.
|
||||
|
||||
|
||||
### Debugging - Monitoring ###
|
||||
# Please see documentation at: https://owncloud.dev/ocis/deployment/monitoring-tracing/
|
||||
# Note: the leading colon is required to enable the service.
|
||||
#MONITORING=:monitoring_tracing/monitoring.yml
|
||||
|
||||
|
||||
### Virusscanner Settings ###
|
||||
# IMPORTANT: If you enable antivirus, you also MUST configure the START_ADDITIONAL_SERVICES
|
||||
# envvar in the Infinite Scale Settings above by adding 'antivirus' to the list.
|
||||
@@ -260,8 +254,18 @@ MAIL_SERVER_DOMAIN=
|
||||
MAIL_SERVER_DOCKER_TAG=v1.28.0
|
||||
|
||||
|
||||
### Debugging - Monitoring ###
|
||||
# Please see documentation at: https://owncloud.dev/ocis/deployment/monitoring-tracing/
|
||||
# Note: the leading colon is required to enable the service.
|
||||
#MONITORING=:monitoring_tracing/monitoring.yml
|
||||
# Uncomment to extend monitoring for the Collabora and OnlyOffice services if enabled above
|
||||
# Note that the value must match the filenames in the monitoring_tracing folder, do not change
|
||||
#MONITORING_COLLABORATION=m_collaboration.yml
|
||||
#MONITORING_COLLABORATION_OO=m_collaboration-oo.yml
|
||||
|
||||
|
||||
## IMPORTANT ##
|
||||
# This MUST be the last line as it assembles the supplemental compose files to be used.
|
||||
# ALL supplemental configs must be added here, whether commented or not.
|
||||
# Each var must either be empty or contain :path/file.yml
|
||||
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${MONITORING:-}${IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${EXTENSIONS:-}${UNZIP:-}${DRAWIO:-}${JSONVIEWER:-}${PROGRESSBARS:-}${EXTERNALSITES:-}${MAIL_SERVER:-}
|
||||
COMPOSE_FILE=docker-compose.yml${OCIS:-}${TIKA:-}${S3NG:-}${S3NG_MINIO:-}${COLLABORA:-}${IMPORTER:-}${CLAMAV:-}${ONLYOFFICE:-}${EXTENSIONS:-}${UNZIP:-}${DRAWIO:-}${JSONVIEWER:-}${PROGRESSBARS:-}${EXTERNALSITES:-}${MAIL_SERVER:-}${MONITORING:-}
|
||||
@@ -0,0 +1,4 @@
|
||||
# this file has ho compose configuration on purpose
|
||||
# it is required to be present and used in the monitoring.yml file
|
||||
# with this, we can mimic missing conditional rendering
|
||||
# DO NOT DELETE OR ADD CONTENT !
|
||||
@@ -0,0 +1,13 @@
|
||||
# define the collaboration monitoring for onlyoffice
|
||||
# the filename must match the value in the .env file
|
||||
services:
|
||||
collaboration-oo:
|
||||
extends:
|
||||
# add common tracing envvars for collaboration-oo (onlyoffice)
|
||||
# note that the path is relative because the file is included
|
||||
file: tracing_env.yml
|
||||
service: common_monitoring_environment
|
||||
environment:
|
||||
# as onlyoffice runs as a single process, all <debug>/metrics endpoints
|
||||
# will expose the same metrics, so it's sufficient to query one endpoint
|
||||
COLLABORATION_DEBUG_ADDR: 0.0.0.0:9304
|
||||
@@ -0,0 +1,13 @@
|
||||
# define the collaboration monitoring for collabora
|
||||
# the filename must match the value in the .env file
|
||||
services:
|
||||
collaboration:
|
||||
extends:
|
||||
# add common tracing envvars for collaboration (collabora)
|
||||
# note that the path is relative because the file is included
|
||||
file: tracing_env.yml
|
||||
service: common_monitoring_environment
|
||||
environment:
|
||||
# as collabora runs as a single process, all <debug>/metrics endpoints
|
||||
# will expose the same metrics, so it's sufficient to query one endpoint
|
||||
COLLABORATION_DEBUG_ADDR: 0.0.0.0:9304
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
|
||||
services:
|
||||
ocis:
|
||||
environment:
|
||||
# tracing
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "otlp"
|
||||
OCIS_TRACING_ENDPOINT: jaeger:4317
|
||||
# metrics
|
||||
# if oCIS runs as a single process, all <debug>/metrics endpoints
|
||||
# will expose the same metrics, so it's sufficient to query one endpoint
|
||||
PROXY_DEBUG_ADDR: 0.0.0.0:9205
|
||||
|
||||
collaboration-oo:
|
||||
environment:
|
||||
# tracing
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "otlp"
|
||||
OCIS_TRACING_ENDPOINT: jaeger:4317
|
||||
# metrics
|
||||
COLLABORATION_DEBUG_ADDR: 0.0.0.0:9304
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
@@ -1,25 +1,29 @@
|
||||
---
|
||||
|
||||
# monitoring and tracing if enabled
|
||||
services:
|
||||
ocis:
|
||||
# add common tracing envvars for ocis
|
||||
extends:
|
||||
file: monitoring_tracing/tracing_env.yml
|
||||
service: common_monitoring_environment
|
||||
environment:
|
||||
# tracing
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "otlp"
|
||||
OCIS_TRACING_ENDPOINT: jaeger:4317
|
||||
# metrics
|
||||
# if oCIS runs as a single process, all <debug>/metrics endpoints
|
||||
# as oCIS runs as a single process, all <debug>/metrics endpoints
|
||||
# will expose the same metrics, so it's sufficient to query one endpoint
|
||||
PROXY_DEBUG_ADDR: 0.0.0.0:9205
|
||||
|
||||
collaboration:
|
||||
environment:
|
||||
# tracing
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "otlp"
|
||||
OCIS_TRACING_ENDPOINT: jaeger:4317
|
||||
# metrics
|
||||
COLLABORATION_DEBUG_ADDR: 0.0.0.0:9304
|
||||
# include additional monitoring definitions such as collabora and onlyoffice via the .env file
|
||||
# if the envvars are not uncommented in the .env file, use a dummy file with no content instead
|
||||
# compose is not able to conditionally include, this mimics the behavior
|
||||
include:
|
||||
# collaboration
|
||||
- monitoring_tracing/${MONITORING_COLLABORATION:-empty_dummy.yml}
|
||||
|
||||
# collaboration-oo
|
||||
- monitoring_tracing/${MONITORING_COLLABORATION_OO:-empty_dummy.yml}
|
||||
|
||||
networks:
|
||||
ocis-net:
|
||||
|
||||
# additional includes to define monitoring products to be used in this setup
|
||||
#include:
|
||||
# ...
|
||||
@@ -0,0 +1,11 @@
|
||||
# this is the commonly used ocis envvar definition for tracing when included
|
||||
# this makes this a single point of maintenance
|
||||
|
||||
services:
|
||||
# this is a dummy environment required for the compose extend attribute
|
||||
common_monitoring_environment:
|
||||
environment:
|
||||
# tracing envvars
|
||||
OCIS_TRACING_ENABLED: "true"
|
||||
OCIS_TRACING_TYPE: "otlp"
|
||||
OCIS_TRACING_ENDPOINT: jaeger:4317
|
||||
@@ -0,0 +1,434 @@
|
||||
---
|
||||
title: "Building oCIS Web Extensions with AI-Assisted Development"
|
||||
date: 2026-01-21T16:00:00+02:00
|
||||
weight: 9
|
||||
geekdocRepo: https://github.com/owncloud/ocis
|
||||
geekdocEditPath: edit/master/docs/ocis/guides
|
||||
geekdocFilePath: ai_assisted_dev.md
|
||||
geekdocCollapseSection: true
|
||||
---
|
||||
|
||||
{{< toc >}}
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide demonstrates how to build Infinite Scale (oCIS) web extensions using AI-assisted development (sometimes called "vibe coding") with Claude AI. By following this approach, review-ready extensions can be created without writing code manually—the AI handles syntax, boilerplate, and implementation while the developer focuses on architecture and user experience.
|
||||
|
||||
**What you'll learn:**
|
||||
- Setting up MCP connectors so Claude can access your server
|
||||
- Using Claude to install development tools and manage your environment
|
||||
- The five-phase workflow for AI-assisted extension development
|
||||
- Practical tips for supervising AI-generated code
|
||||
- How to contribute extensions back to the oCIS community
|
||||
|
||||
**Time investment:** ~10-14 hours per extension (concept to review-ready)
|
||||
|
||||
**Cost:** ~$100 USD for two extensions (using the Claude Max subscription)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before starting, ensure you have the following:
|
||||
|
||||
- A running oCIS instance, see the [Admin Docs](https://doc.owncloud.com/ocis/latest/depl-examples/ubuntu-compose/ubuntu-compose-prod.html) for a deployment example
|
||||
- [Claude Max subscription](https://claude.com/pricing/max) (starts with $100 US/month at the time of writing, other plans availabe)
|
||||
- SSH access to your server (for MCP connectivity)
|
||||
- Full root access to the server unless Claude Code, Claude MCP connector, oCIS and other tools all run as another user
|
||||
|
||||
That's it. Claude will help install everything else.
|
||||
|
||||
## Step 1: Configure MCP Connector
|
||||
|
||||
{{< hint type=important title="This Is the Hardest Part" >}}
|
||||
Setting up the MCP connector is the most challenging step. Once this is done, Claude handles everything else—including installing development tools, managing git, and building extensions.
|
||||
{{< /hint >}}
|
||||
|
||||
MCP (Model Context Protocol) allows Claude to connect directly to a server, enabling both the Claude web interface and Claude Code to access files, run commands, and debug oCIS deployments.
|
||||
|
||||
### Installation
|
||||
|
||||
Follow the official MCP documentation to set up a connector:
|
||||
|
||||
- **[MCP Quickstart Guide](https://modelcontextprotocol.io/quickstart)**
|
||||
- **[Connect to Local Servers](https://modelcontextprotocol.io/docs/develop/connect-local-servers)**
|
||||
- **[Claude Desktop MCP Setup](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop)**
|
||||
|
||||
### Verify Connection
|
||||
|
||||
Once configured, verify Claude can access the server by asking:
|
||||
|
||||
```text
|
||||
Can you list the contents of /home on my server?
|
||||
```
|
||||
|
||||
If Claude successfully lists directories, proceed to the next step.
|
||||
|
||||
## Step 2: Let Claude Set Up Your Environment
|
||||
|
||||
With MCP connected, Claude can install the development tools needed. Simply ask:
|
||||
|
||||
```text
|
||||
Please install Claude Code and Git on my server. I'll need these for
|
||||
developing an oCIS web extension.
|
||||
```
|
||||
|
||||
Claude will:
|
||||
- Detect the operating system
|
||||
- Install Claude Code using the appropriate method
|
||||
- Install Git if not already present
|
||||
- Configure any necessary paths or permissions
|
||||
|
||||
## The Five-Phase Workflow
|
||||
|
||||
This workflow has been refined over several projects and consistently produces review-ready code.
|
||||
|
||||
### Phase 1: Architecture (~15-30 minutes)
|
||||
|
||||
Start in the Claude web interface (not Claude Code). Describe the project and have a conversation:
|
||||
|
||||
```text
|
||||
I want to build an oCIS web extension that displays photos in a timeline
|
||||
grouped by their EXIF capture date. It should have infinite scroll starting
|
||||
from today and going backwards, show camera metadata when you click on a photo,
|
||||
and include an interactive map view showing where photos were taken.
|
||||
|
||||
What questions do you have about the requirements?
|
||||
```
|
||||
|
||||
Claude will ask clarifying questions about scope, user experience, and technical constraints. This back-and-forth shapes the architecture before any code is written.
|
||||
|
||||
### Phase 2: Deep Research (~30 minutes)
|
||||
|
||||
Ask Claude to research the existing oCIS architecture:
|
||||
|
||||
```text
|
||||
Please research how oCIS web extensions work. I need to understand:
|
||||
- The extension manifest format
|
||||
- How extensions integrate with the oCIS web UI
|
||||
- What APIs are available (Graph API, WebDAV, etc.)
|
||||
- How existing extensions like json-viewer are structured
|
||||
- The AMD module format requirements
|
||||
|
||||
Examine the oCIS documentation and existing extensions to synthesise
|
||||
a technical approach for my photo gallery extension.
|
||||
```
|
||||
|
||||
Claude reads documentation, examines code patterns, and produces an architectural plan.
|
||||
|
||||
### Phase 3: Scaffolding (~15 minutes)
|
||||
|
||||
Ask Claude to create the project structure on the server:
|
||||
|
||||
```text
|
||||
Please create the project structure for my photo-addon extension:
|
||||
- Git repository initialised
|
||||
- Build configuration (Vite with AMD output)
|
||||
- TypeScript configuration
|
||||
- manifest.json for oCIS
|
||||
- Basic Vue 3 component structure
|
||||
- A starter CLAUDE.md file documenting the project for future sessions
|
||||
```
|
||||
|
||||
By the end of this phase, a working (empty) extension exists.
|
||||
|
||||
### Phase 4: Implementation (~5-6 hours)
|
||||
|
||||
Login to the server and change to the folder where the new project was created, then run:
|
||||
|
||||
```text
|
||||
claude "Please review the CLAUDE.md project file, build the web extension,
|
||||
and deploy it to our server. Install and configure any dependencies required.
|
||||
Use 'sudo' where needed to modify or configure the oCIS environment."
|
||||
```
|
||||
Once complete, work through features incrementally. Example prompts:
|
||||
|
||||
**Feature requests:**
|
||||
|
||||
```text
|
||||
Please adjust the logic to start by searching for today's date (unless
|
||||
overwritten by the dropdowns at the top), then display them on the screen.
|
||||
If the images don't fill the screen, load up another day, until the screen
|
||||
is filled plus some buffer. Then when I scroll, bring in more images.
|
||||
```
|
||||
|
||||
```text
|
||||
In the map view, when I hover over a dot, the thumbnail shows up above
|
||||
off the screen. Can you fix the positioning?
|
||||
```
|
||||
|
||||
**Bug fixes:**
|
||||
|
||||
```text
|
||||
I'm seeing this error in the console:
|
||||
[paste error here]
|
||||
|
||||
Can you investigate and fix it?
|
||||
```
|
||||
|
||||
### Phase 5: Polish (~3 hours)
|
||||
|
||||
Once core features work, request comprehensive cleanup:
|
||||
|
||||
**Performance optimisation:**
|
||||
|
||||
```text
|
||||
Are there any performance improvements that we can make?
|
||||
```
|
||||
|
||||
**Bug hunting:**
|
||||
|
||||
```text
|
||||
Are there any memory leaks or bugs that can be found?
|
||||
```
|
||||
|
||||
**Code quality:**
|
||||
|
||||
```text
|
||||
Are there any inefficiencies we can improve on? Unused variables?
|
||||
Duplicate functions? Excessive if statements? Overwriting CSS styles?
|
||||
Overly complex logic?
|
||||
```
|
||||
|
||||
**Error handling:**
|
||||
|
||||
```text
|
||||
Are there any error handling gaps or functions that may fall through
|
||||
without handling all scenarios?
|
||||
```
|
||||
|
||||
**Documentation:**
|
||||
|
||||
```text
|
||||
Are there any missing comments? Or complex code that could use
|
||||
clear documentation?
|
||||
```
|
||||
|
||||
**Internationalisation:**
|
||||
|
||||
```text
|
||||
Are there any visible text strings that are not yet set up for translation?
|
||||
```
|
||||
|
||||
**Comprehensive cleanup:**
|
||||
|
||||
```text
|
||||
Pulling from the backlog list, can you do a good code refactor to simplify,
|
||||
add all required unit tests, and add i18n support, then commit and push the
|
||||
code with the right comments.
|
||||
```
|
||||
|
||||
## Active Supervision
|
||||
|
||||
{{< hint type=warning title="This is NOT 'Set It and Forget It'" >}}
|
||||
While no coding is required, this approach demands active supervision. Developers cannot simply give Claude a prompt and walk away.
|
||||
{{< /hint >}}
|
||||
|
||||
### When to Intervene
|
||||
|
||||
There are times when Claude Code may:
|
||||
- Deviate from requirements (with good intentions)
|
||||
- Undo something it had just done
|
||||
- Go down a path that doesn't match the architecture
|
||||
|
||||
The decisions are always logical, but sometimes the harder path is required. Expect to intervene and redirect approximately ~5% of the time.
|
||||
|
||||
**Watch for:**
|
||||
- Changes that don't match architectural decisions
|
||||
- Unnecessary complexity being added
|
||||
- Repeated undo/redo cycles
|
||||
- Deviation from oCIS extension patterns
|
||||
|
||||
### Code Cleanup Is Essential
|
||||
|
||||
AI-generated code works, but it can accumulate:
|
||||
- Redundant logic
|
||||
- Unused variables
|
||||
- Overly complex conditionals
|
||||
- Duplicate CSS styles
|
||||
- Missing good practice for the orders of directives
|
||||
- Missing the definition of required interactive handlers
|
||||
|
||||
When submitting a pull request (PR), issues highlighted during CI steps, such as linting, can be resolved by explicitly asking for code refactoring and optimisation.
|
||||
|
||||
### UI Testing Is Manual
|
||||
|
||||
The AI can write unit tests, but exploratory testing requires human judgment:
|
||||
- Click around the interface
|
||||
- Try unexpected inputs
|
||||
- Test with different user accounts (search in oCIS is space-scoped!)
|
||||
- Check mobile layouts
|
||||
- Look for edge cases
|
||||
|
||||
## Debugging Techniques
|
||||
|
||||
When issues arise, these techniques help Claude understand and fix problems:
|
||||
|
||||
### Console Output
|
||||
|
||||
Open Chrome DevTools, copy console errors, and paste into Claude:
|
||||
|
||||
```text
|
||||
I'm seeing this error in the console:
|
||||
[paste error here]
|
||||
|
||||
Can you investigate and fix it?
|
||||
```
|
||||
|
||||
### HAR Files
|
||||
|
||||
For performance issues, export HAR files (network traffic captures):
|
||||
|
||||
1. Open DevTools > Network tab
|
||||
2. Reproduce the issue
|
||||
3. Right-click > Save all as HAR
|
||||
4. Share the HAR file with Claude for analysis
|
||||
|
||||
### HTML/CSS Inspection
|
||||
|
||||
Copy specific HTML/CSS snippets from DevTools:
|
||||
|
||||
```text
|
||||
The thumbnail hover popup is positioned incorrectly. Here's the current
|
||||
CSS and HTML structure:
|
||||
[paste code here]
|
||||
|
||||
Can you fix the positioning so the popup appears above the cursor
|
||||
but stays within the viewport?
|
||||
```
|
||||
|
||||
{{< hint type=tip title="Chrome Extension Limitations" >}}
|
||||
Claude has a Chrome extension, but it may be limited for this use case. Manually copying console output and HTML/CSS snippets into Claude is often more effective.
|
||||
{{< /hint >}}
|
||||
|
||||
## Example Web Extensions Built with This Approach
|
||||
|
||||
### Photo Gallery Extension (web-app-photo-addon)
|
||||
|
||||
Features:
|
||||
- **Timeline View**: Photos grouped by EXIF capture date with infinite scroll
|
||||
- **Pinch-to-zoom calendar**: Navigate between day, month, and year views
|
||||
- **EXIF Metadata Panel**: Camera make/model, aperture, ISO, focal length
|
||||
- **Map View**: Interactive Leaflet map with marker clustering
|
||||
- **Lightbox**: Full-screen viewer with keyboard navigation
|
||||
|
||||
Tech stack: Vue 3 Composition API, TypeScript, Leaflet.js, AMD module format
|
||||
|
||||
### Advanced Search Extension (web-app-advanced-search)
|
||||
|
||||
Features:
|
||||
- **Photo Metadata Filters**: Search by camera, date range, aperture, ISO
|
||||
- **Filter Chips**: Visual indicators with one-click removal
|
||||
- **Search Saving**: Save and retrieve search queries
|
||||
- **KQL Search**: Direct advanced query editing
|
||||
- **Index Statistics**: View indexing status and configuration
|
||||
|
||||
### Backend Changes in oCIS
|
||||
|
||||
To enable photo metadata search, changes were contributed to oCIS core:
|
||||
- Photo field mappings in the KQL parser
|
||||
- `Store=true` configuration in Bleve for field retrieval
|
||||
- WebDAV properties for photo metadata
|
||||
|
||||
This was the trickiest part—understanding why searches returned empty results. The answer: Bleve was indexing fields but not storing them for retrieval.
|
||||
|
||||
## Tips for oCIS Development
|
||||
|
||||
### 1. Start with Conversation, Then Architecture
|
||||
|
||||
Don't jump straight into implementation. Spend ~30-60 minutes in regular chat, discussing the problem space and having Claude research the codebase. Those early conversations shape the architecture that makes implementation smooth.
|
||||
|
||||
### 2. Work Incrementally
|
||||
|
||||
Ask for one feature at a time. Get it working, then move to the next. This creates natural checkpoints and makes debugging much easier.
|
||||
|
||||
### 3. Use Browser DevTools Liberally
|
||||
|
||||
Console errors, network requests, and performance profiles are incredibly valuable context. Copy and paste them into AI conversations.
|
||||
|
||||
### 4. Understand oCIS Extension Requirements
|
||||
|
||||
Extensions must:
|
||||
- Use CJS module format (not ES modules)
|
||||
- Have a proper `manifest.json`
|
||||
- Use the oCIS web SDK for API access
|
||||
|
||||
Claude learns these constraints during the research phase and applies them consistently.
|
||||
|
||||
### 5. Test with Multiple Accounts
|
||||
|
||||
Search in oCIS is space-scoped. What works for an admin account might not work for regular users.
|
||||
|
||||
### 6. Read Maintainer Feedback Carefully
|
||||
|
||||
PR reviews teach things no documentation mentions. The oCIS team's suggestions can significantly improve code quality.
|
||||
|
||||
## Contributing to oCIS or web-extensions
|
||||
|
||||
Once a web-extension is ready, Claude can handle the entire contribution workflow:
|
||||
|
||||
- Install and configure Git
|
||||
- Create forks of the oCIS repositories
|
||||
- Create feature branches
|
||||
- Generate commits with appropriate messages
|
||||
- Push changes to GitHub
|
||||
- Create pull requests with descriptions and screenshots
|
||||
|
||||
Example prompts:
|
||||
|
||||
```text
|
||||
Please fork the owncloud/web-extensions repository to my GitHub account
|
||||
and clone it to my server.
|
||||
```
|
||||
|
||||
```text
|
||||
Create a new branch called feat/web-app-photo-addon and commit our
|
||||
extension with an appropriate commit message.
|
||||
```
|
||||
|
||||
```text
|
||||
Please create a pull request for our photo-addon extension. Include
|
||||
screenshots from the /screenshots directory and a clear description
|
||||
of what the extension does.
|
||||
```
|
||||
|
||||
**Contributions made by this approach:**
|
||||
- **oCIS core**: Photo metadata search backend
|
||||
- **web-extensions**: Photo gallery extension
|
||||
- **web-extensions**: Advanced search extension
|
||||
|
||||
{{< hint type=note title="CLA Requirement" >}}
|
||||
Contributors need to sign the ownCloud Contributor License Agreement (CLA) for PRs to be accepted. Claude can help find the CLA link and explain the process.
|
||||
{{< /hint >}}
|
||||
|
||||
## Notes
|
||||
|
||||
Additional steps can be required in the oCIS repository for changes in the web-extensions repository, in particular:
|
||||
|
||||
- If the web extension requires it, add proposals to the back-end code in the oCIS codebase.
|
||||
- In order to make the new web extension more easily accessible to the public, the `ocis_full` deployment example in the oCIS repository should be updated. The new oCIS version will then reference it automatically and the documentation team will update the release notes and documentation accordingly.
|
||||
|
||||
## Summary
|
||||
|
||||
Using this approach, complete web-extensions can be built without writing code manually. No git commands need to be typed manually. No pnpm commands either.
|
||||
|
||||
Every commit, every push, every PR—all generated through AI assistance. The backend changes to oCIS core were approved and merged. The web-extensions demonstrate the viability of this development approach.
|
||||
|
||||
The barrier to entry for meaningful open source contribution is significantly lower with AI-assisted development. For those interested in contributing to oCIS but feeling intimidated by the codebase, this approach is worth considering.
|
||||
|
||||
Please note that, as with all contributions, this approach requires a full review process from the code maintainers, with iterations required to finalise all steps. To ensure stability and maintainability, all feedback must be incorporated into the proposed changes.
|
||||
|
||||
---
|
||||
|
||||
## Resources
|
||||
|
||||
| Resource | URL |
|
||||
|----------|-----|
|
||||
| MCP Quickstart | https://modelcontextprotocol.io/quickstart |
|
||||
| MCP Local Servers | https://modelcontextprotocol.io/docs/develop/connect-local-servers |
|
||||
| Claude Desktop MCP | https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop |
|
||||
| oCIS Web Extensions | https://github.com/owncloud/web-extensions |
|
||||
| oCIS Admin Documentation | https://doc.owncloud.com/ocis/ |
|
||||
| oCIS Developer Documentation | https://owncloud.dev |
|
||||
---
|
||||
|
||||
*This guide was written with AI assistance and reviewed by the ownCloud documentation team for accuracy.*
|
||||
|
||||
@@ -66,7 +66,7 @@ require (
|
||||
github.com/open-policy-agent/opa v1.12.3
|
||||
github.com/orcaman/concurrent-map v1.0.0
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260123085534-22a1be2b211e
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260206095425-032663e2f51a
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/pkg/xattr v0.4.12
|
||||
github.com/prometheus/client_golang v1.23.2
|
||||
|
||||
@@ -742,8 +742,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.20260116104114-10074a92be64 h1:z9djjzd+leAy6QZpi8dLy3OVjc/um+1XAGk1SJEvwE8=
|
||||
github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64/go.mod h1:z61VMGAJRtR1nbgXWiNoCkxUXP1B3Je9rMuJbnGd+Og=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260123085534-22a1be2b211e h1:SL7kqt9HyZpyeWjb0saiRm1COMPZhQ9w8lUoCHWgm2o=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260123085534-22a1be2b211e/go.mod h1:eHbT6pmVlcjdiBeVEYw7exlfJmemMzKBh4R+HFgx9Cc=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260206095425-032663e2f51a h1:XvU5fvmqFzs9pT+JAZHR0QHY1KsCemNAJp000QkPqrM=
|
||||
github.com/owncloud/reva/v2 v2.0.0-20260206095425-032663e2f51a/go.mod h1:ahCZbT/ltp5J8aURUpTOfpA/dLBeTvHaMm772cvj7+U=
|
||||
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.9 h1:njquRbBU7fuwIe5rEvtaniVBjwWzcpdUVptSgzFqZsw=
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-01-03 00:30+0000\n"
|
||||
"POT-Creation-Date: 2026-01-23 00:05+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Victor Vinuela <vinuela.victor@dissectio.com>, 2026\n"
|
||||
"Language-Team: Spanish (https://app.transifex.com/owncloud-org/teams/6149/es/)\n"
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-01-03 00:30+0000\n"
|
||||
"POT-Creation-Date: 2026-01-23 00:05+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Cesare Capoferri, 2026\n"
|
||||
"Language-Team: Italian (https://app.transifex.com/owncloud-org/teams/6149/it/)\n"
|
||||
|
||||
@@ -3,10 +3,11 @@ package email
|
||||
import (
|
||||
"bytes"
|
||||
"embed"
|
||||
"github.com/pkg/errors"
|
||||
"strings"
|
||||
"text/template"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/owncloud/ocis/v2/ocis-pkg/l10n"
|
||||
)
|
||||
|
||||
@@ -32,9 +33,14 @@ func NewTextTemplate(mt MessageTemplate, locale, defaultLocale string, translati
|
||||
if err != nil {
|
||||
return mt, err
|
||||
}
|
||||
mt.CallToAction, err = composeMessage(t.Get(mt.CallToAction), vars)
|
||||
if err != nil {
|
||||
return mt, err
|
||||
|
||||
if mt.CallToAction != "" {
|
||||
// Some templates have an empty call-to-action. We don't want to translate
|
||||
// an empty key and get an unexpected message.
|
||||
mt.CallToAction, err = composeMessage(t.Get(mt.CallToAction), vars)
|
||||
if err != nil {
|
||||
return mt, err
|
||||
}
|
||||
}
|
||||
return mt, nil
|
||||
}
|
||||
@@ -55,9 +61,13 @@ func NewHTMLTemplate(mt MessageTemplate, locale, defaultLocale string, translati
|
||||
if err != nil {
|
||||
return mt, err
|
||||
}
|
||||
mt.CallToAction, err = composeMessage(callToActionToHTML(t.Get(mt.CallToAction)), vars)
|
||||
if err != nil {
|
||||
return mt, err
|
||||
if mt.CallToAction != "" {
|
||||
// Some templates have an empty call-to-action. We don't want to translate
|
||||
// an empty key and get an unexpected message.
|
||||
mt.CallToAction, err = composeMessage(callToActionToHTML(t.Get(mt.CallToAction)), vars)
|
||||
if err != nil {
|
||||
return mt, err
|
||||
}
|
||||
}
|
||||
return mt, nil
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"Report-Msgid-Bugs-To: EMAIL\n"
|
||||
"POT-Creation-Date: 2026-01-03 00:30+0000\n"
|
||||
"POT-Creation-Date: 2026-01-23 00:05+0000\n"
|
||||
"PO-Revision-Date: 2026-01-02 10:10+0000\n"
|
||||
"Last-Translator: Cesare Capoferri, 2026\n"
|
||||
"Language-Team: Italian (https://app.transifex.com/owncloud-org/teams/6149/it/)\n"
|
||||
|
||||
@@ -95,7 +95,7 @@ Feature: antivirus
|
||||
|
||||
Scenario Outline: public uploads a file with the virus to a public share
|
||||
Given using <dav-path-version> DAV path
|
||||
And the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And using SharingNG
|
||||
And user "Alice" has created folder "/uploadFolder"
|
||||
And user "Alice" has created the following resource link share:
|
||||
@@ -337,7 +337,7 @@ Feature: antivirus
|
||||
|
||||
@env-config
|
||||
Scenario Outline: try to overwrite a file with the virus content in a public link share
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And using <dav-path-version> DAV path
|
||||
And using SharingNG
|
||||
And user "Alice" has uploaded file with content "hello" to "test.txt"
|
||||
|
||||
@@ -74,9 +74,9 @@ Feature: PROPFIND with depth:infinity
|
||||
Scenario: get the list of resources in a folder shared through public link with depth infinity
|
||||
Given using SharingNG
|
||||
And the following configs have been set:
|
||||
| service |config | value |
|
||||
| ocdav |OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY | true |
|
||||
| ocdav |OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| ocdav | OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY | true |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And user "Alice" has created the following resource link share:
|
||||
| resource | simple-folder |
|
||||
| space | Personal |
|
||||
@@ -123,9 +123,9 @@ Feature: PROPFIND with depth:infinity
|
||||
|
||||
Scenario: get the list of resources in a folder shared through public link with depth infinity when depth infinity is not allowed
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| ocdav | OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY | false |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| ocdav | OCDAV_ALLOW_PROPFIND_DEPTH_INFINITY | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And using SharingNG
|
||||
And user "Alice" has created the following resource link share:
|
||||
| resource | simple-folder |
|
||||
|
||||
@@ -345,8 +345,8 @@ Feature: Link sharing of project spaces
|
||||
Scenario Outline: create a link share of a project-space when password is not enforced using permissions endpoint
|
||||
Given using spaces DAV path
|
||||
And the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has created a space "projectSpace" with the default quota using the Graph API
|
||||
When user "Alice" creates the following space link share using permissions endpoint of the Graph API:
|
||||
@@ -387,8 +387,8 @@ Feature: Link sharing of project spaces
|
||||
Scenario Outline: create a link share of a project-space when password is not enforced using root endpoint
|
||||
Given using spaces DAV path
|
||||
And the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has created a space "projectSpace" with the default quota using the Graph API
|
||||
When user "Alice" creates the following space link share using root endpoint of the Graph API:
|
||||
|
||||
@@ -9,8 +9,8 @@ Feature: Update a link share for a resource
|
||||
@env-config
|
||||
Scenario: set password on a existing link share of a project-space drive using root endpoint
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And 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 "projectSpace" with the default quota using the Graph API
|
||||
|
||||
+2
-2
@@ -7,8 +7,8 @@ Feature: Link share without enforcing password
|
||||
| username |
|
||||
| Alice |
|
||||
And the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
|
||||
@issue-7879
|
||||
Scenario Outline: create a link share of a folder
|
||||
|
||||
+2
-2
@@ -286,8 +286,8 @@ Feature: Update a link share for a resource
|
||||
@env-config
|
||||
Scenario: set password on a existing link share of a folder inside project-space using permissions endpoint
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And 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 "projectSpace" with the default quota using the Graph API
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Feature: public link for a space
|
||||
|
||||
Background:
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And these users have been created with default attributes:
|
||||
| username |
|
||||
| Alice |
|
||||
|
||||
@@ -14,7 +14,7 @@ Feature: Public can download folders from project space public link
|
||||
|
||||
@env-config
|
||||
Scenario: download a folder from public link of a space
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And using SharingNG
|
||||
And user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has uploaded a file inside space "new-space" with content "some content" to "NewFolder/test.txt"
|
||||
@@ -30,7 +30,7 @@ Feature: Public can download folders from project space public link
|
||||
|
||||
@env-config @issue-5229
|
||||
Scenario: download a folder from public link of a folder inside a space
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And using SharingNG
|
||||
And user "Alice" has created a folder "NewFolder" in space "new-space"
|
||||
And user "Alice" has created a folder "NewFolder/folder" in space "new-space"
|
||||
|
||||
@@ -147,7 +147,10 @@ Feature: create a public link share
|
||||
|
||||
@env-config
|
||||
Scenario Outline: getting the share information of password less public-links hides credential placeholders
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And using OCS API version "<ocs-api-version>"
|
||||
And user "Alice" has uploaded file with content "Random data" to "/randomfile.txt"
|
||||
When user "Alice" creates a public link share using the sharing API with settings
|
||||
@@ -302,7 +305,7 @@ Feature: create a public link share
|
||||
|
||||
@env-config @skipOnReva @issue-10071
|
||||
Scenario: get the size of a file shared by public link
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And user "Alice" has uploaded file with content "This is a test file" to "test-file.txt"
|
||||
And using SharingNG
|
||||
And user "Alice" has created the following resource link share:
|
||||
@@ -315,7 +318,10 @@ Feature: create a public link share
|
||||
|
||||
@env-config @issue-10071
|
||||
Scenario Outline: get the mtime of a file shared by public link
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And using <dav-path-version> DAV path
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT"
|
||||
When user "Alice" creates a public link share using the sharing API with settings
|
||||
@@ -330,7 +336,10 @@ Feature: create a public link share
|
||||
|
||||
@env-config @issue-10071
|
||||
Scenario Outline: get the mtime of a file inside a folder shared by public link
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "testFolder"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "testFolder/file.txt" with mtime "Thu, 08 Aug 2019 04:18:13 GMT"
|
||||
@@ -346,7 +355,11 @@ Feature: create a public link share
|
||||
|
||||
@env-config @skipOnReva @issue-10071
|
||||
Scenario: get the mtime of a file inside a folder shared by public link using new webDAV version
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
# Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
And user "Alice" has created folder "testFolder"
|
||||
And using SharingNG
|
||||
And user "Alice" has created the following resource link share:
|
||||
@@ -361,7 +374,10 @@ Feature: create a public link share
|
||||
|
||||
@env-config @issue-10071
|
||||
Scenario: overwriting a file changes its mtime (public webDAV API)
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "frontend" service
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| frontend | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
And user "Alice" has created folder "testFolder"
|
||||
When user "Alice" uploads file with content "uploaded content for file name ending with a dot" to "testFolder/file.txt" using the WebDAV API
|
||||
And user "Alice" creates a public link share using the sharing API with settings
|
||||
@@ -375,7 +391,7 @@ Feature: create a public link share
|
||||
|
||||
@env-config @skipOnReva @issue-10071
|
||||
Scenario: check the href of a public link file
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And using new DAV path
|
||||
And user "Alice" has uploaded file with content "Random data" to "/file.txt"
|
||||
And using SharingNG
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: copying from public link share
|
||||
Background:
|
||||
Given user "Alice" has been created with default attributes
|
||||
And user "Alice" has created folder "/PARENT"
|
||||
And the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
|
||||
|
||||
Scenario: copy file within a public link folder
|
||||
|
||||
+25
-15
@@ -86,13 +86,18 @@ Feature: enforce password on public link
|
||||
|
||||
Scenario Outline: create a public link with a password in accordance with the password policy
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_DIGITS | 2 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
And user "Alice" has been created with default attributes
|
||||
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
|
||||
And using OCS API version "<ocs-api-version>"
|
||||
@@ -150,14 +155,19 @@ Feature: enforce password on public link
|
||||
|
||||
Scenario Outline: update a public link with a password in accordance with the password policy
|
||||
Given the following configs have been set:
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 1 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
| service | config | value |
|
||||
| sharing | SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false |
|
||||
| sharing | SHARING_PUBLIC_WRITEABLE_SHARE_MUST_HAVE_PASSWORD | true |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_DIGITS | 1 |
|
||||
| sharing | SHARING_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_CHARACTERS | 13 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_LOWERCASE_CHARACTERS | 3 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_UPPERCASE_CHARACTERS | 2 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_DIGITS | 1 |
|
||||
| frontend | FRONTEND_PASSWORD_POLICY_MIN_SPECIAL_CHARACTERS | 2 |
|
||||
And user "Alice" has been created with default attributes
|
||||
And user "Alice" has uploaded file with content "test file" to "/testfile.txt"
|
||||
And using OCS API version "<ocs-api-version>"
|
||||
|
||||
@@ -111,7 +111,7 @@ Feature: list files
|
||||
@env-config @issue-10071
|
||||
Scenario: get the list of resources in a folder shared through public link with depth 0
|
||||
Given using new DAV path
|
||||
And the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And user "Alice" has created the following folders
|
||||
| path |
|
||||
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
|
||||
@@ -139,7 +139,7 @@ Feature: list files
|
||||
@env-config @issue-10071
|
||||
Scenario: get the list of resources in a folder shared through public link with depth 1
|
||||
Given using new DAV path
|
||||
And the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And user "Alice" has created the following folders
|
||||
| path |
|
||||
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
|
||||
|
||||
@@ -23,7 +23,7 @@ Feature: accessing a public link share
|
||||
|
||||
@env-config
|
||||
Scenario: access to the preview of public shared file without password
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg"
|
||||
And using SharingNG
|
||||
And user "Alice" has created the following resource link share:
|
||||
@@ -52,7 +52,7 @@ Feature: accessing a public link share
|
||||
|
||||
@env-config
|
||||
Scenario: access to the preview of public shared file inside a folder without password
|
||||
Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
Given the config "SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" for "sharing" service
|
||||
And user "Alice" has created folder "FOLDER"
|
||||
And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "FOLDER/testavatar.jpg"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile0.txt"
|
||||
|
||||
+53
-208
@@ -22,7 +22,6 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
appprovider "github.com/cs3org/go-cs3apis/cs3/app/provider/v1beta1"
|
||||
appregistry "github.com/cs3org/go-cs3apis/cs3/app/registry/v1beta1"
|
||||
@@ -41,17 +40,11 @@ import (
|
||||
"github.com/owncloud/reva/v2/pkg/errtypes"
|
||||
statuspkg "github.com/owncloud/reva/v2/pkg/rgrpc/status"
|
||||
"github.com/owncloud/reva/v2/pkg/rgrpc/todo/pool"
|
||||
"github.com/owncloud/reva/v2/pkg/storagespace"
|
||||
"github.com/owncloud/reva/v2/pkg/token"
|
||||
"github.com/owncloud/reva/v2/pkg/utils"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
const (
|
||||
scopeDelimiter = "#"
|
||||
scopeCacheExpiration = 3600
|
||||
)
|
||||
|
||||
func expandAndVerifyScope(ctx context.Context, req interface{}, tokenScope map[string]*authpb.Scope, user *userpb.User, gatewayAddr string, mgr token.Manager) error {
|
||||
log := appctx.GetLogger(ctx)
|
||||
client, err := pool.GetGatewayServiceClient(gatewayAddr)
|
||||
@@ -80,10 +73,6 @@ func expandAndVerifyScope(ctx context.Context, req interface{}, tokenScope map[s
|
||||
return nil
|
||||
}
|
||||
|
||||
case strings.HasPrefix(k, "lightweight"):
|
||||
if err = resolveLightweightScope(ctx, ref, tokenScope[k], user, client, mgr); err == nil {
|
||||
return nil
|
||||
}
|
||||
case strings.HasPrefix(k, "ocmshare"):
|
||||
if err = resolveOCMShare(ctx, ref, tokenScope[k], client, mgr); err == nil {
|
||||
return nil
|
||||
@@ -91,72 +80,11 @@ func expandAndVerifyScope(ctx context.Context, req interface{}, tokenScope map[s
|
||||
}
|
||||
log.Err(err).Interface("ref", ref).Interface("scope", k).Msg("error resolving reference under scope")
|
||||
}
|
||||
|
||||
} else if ref, ok := extractShareRef(req); ok {
|
||||
// It's a share ref
|
||||
// The request might be coming from a share created for a lightweight account
|
||||
// after the token was minted.
|
||||
log.Info().Msgf("resolving share reference against received shares to verify token scope %+v", ref.String())
|
||||
for k := range tokenScope {
|
||||
if strings.HasPrefix(k, "lightweight") {
|
||||
// Check if this ID is cached
|
||||
key := "lw:" + user.Id.OpaqueId + scopeDelimiter + ref.GetId().OpaqueId
|
||||
if _, err := scopeExpansionCache.Get(key); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
shares, err := client.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{})
|
||||
if err != nil || shares.Status.Code != rpc.Code_CODE_OK {
|
||||
log.Warn().Err(err).Msg("error listing received shares")
|
||||
continue
|
||||
}
|
||||
for _, s := range shares.Shares {
|
||||
shareKey := "lw:" + user.Id.OpaqueId + scopeDelimiter + s.Share.Id.OpaqueId
|
||||
_ = scopeExpansionCache.SetWithExpire(shareKey, nil, scopeCacheExpiration*time.Second)
|
||||
|
||||
if ref.GetId() != nil && ref.GetId().OpaqueId == s.Share.Id.OpaqueId {
|
||||
return nil
|
||||
}
|
||||
if key := ref.GetKey(); key != nil && (utils.UserEqual(key.Owner, s.Share.Owner) || utils.UserEqual(key.Owner, s.Share.Creator)) &&
|
||||
utils.ResourceIDEqual(key.ResourceId, s.Share.ResourceId) && utils.GranteeEqual(key.Grantee, s.Share.Grantee) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return errtypes.PermissionDenied(fmt.Sprintf("access to resource %+v not allowed within the assigned scope", req))
|
||||
}
|
||||
|
||||
func resolveLightweightScope(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, user *userpb.User, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
// Check if this ref is cached
|
||||
key := "lw:" + user.Id.OpaqueId + scopeDelimiter + getRefKey(ref)
|
||||
if _, err := scopeExpansionCache.Get(key); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
shares, err := client.ListReceivedShares(ctx, &collaboration.ListReceivedSharesRequest{})
|
||||
if err != nil || shares.Status.Code != rpc.Code_CODE_OK {
|
||||
return errtypes.InternalError("error listing received shares")
|
||||
}
|
||||
|
||||
for _, share := range shares.Shares {
|
||||
shareKey := "lw:" + user.Id.OpaqueId + scopeDelimiter + storagespace.FormatResourceID(share.Share.ResourceId)
|
||||
_ = scopeExpansionCache.SetWithExpire(shareKey, nil, scopeCacheExpiration*time.Second)
|
||||
|
||||
if ref.ResourceId != nil && utils.ResourceIDEqual(share.Share.ResourceId, ref.ResourceId) {
|
||||
return nil
|
||||
}
|
||||
if ok, err := checkIfNestedResource(ctx, ref, share.Share.ResourceId, client, mgr); err == nil && ok {
|
||||
_ = scopeExpansionCache.SetWithExpire(key, nil, scopeCacheExpiration*time.Second)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return errtypes.PermissionDenied("request is not for a nested resource")
|
||||
}
|
||||
|
||||
func resolvePublicShare(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
var share link.PublicShare
|
||||
err := utils.UnmarshalJSONToProtoV1(scope.Resource.Value, &share)
|
||||
@@ -164,13 +92,7 @@ func resolvePublicShare(ctx context.Context, ref *provider.Reference, scope *aut
|
||||
return err
|
||||
}
|
||||
|
||||
if err := checkCacheForNestedResource(ctx, ref, share.ResourceId, client, mgr); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Some services like wopi don't access the shared resource relative to the
|
||||
// share root but instead relative to the shared resources parent.
|
||||
return checkRelativeReference(ctx, ref, share.ResourceId, client)
|
||||
return checkIfNestedResource(ctx, ref, share.ResourceId, client, mgr)
|
||||
}
|
||||
|
||||
func resolveOCMShare(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
@@ -184,54 +106,7 @@ func resolveOCMShare(ctx context.Context, ref *provider.Reference, scope *authpb
|
||||
ref.ResourceId = share.GetResourceId()
|
||||
}
|
||||
|
||||
if err := checkCacheForNestedResource(ctx, ref, share.ResourceId, client, mgr); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Some services like wopi don't access the shared resource relative to the
|
||||
// share root but instead relative to the shared resources parent.
|
||||
return checkRelativeReference(ctx, ref, share.ResourceId, client)
|
||||
}
|
||||
|
||||
// checkRelativeReference checks if the shared resource is being accessed via a relative reference
|
||||
// e.g.:
|
||||
// storage: abcd, space: efgh
|
||||
// /root (id: efgh)
|
||||
// - New file.txt (id: ijkl) <- shared resource
|
||||
//
|
||||
// If the requested reference looks like this:
|
||||
// Reference{ResourceId: {StorageId: "abcd", SpaceId: "efgh"}, Path: "./New file.txt"}
|
||||
// then the request is considered relative and this function would return true.
|
||||
// Only references which are relative to the immediate parent of a resource are considered valid.
|
||||
func checkRelativeReference(ctx context.Context, requested *provider.Reference, sharedResourceID *provider.ResourceId, client gateway.GatewayAPIClient) error {
|
||||
sRes, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: sharedResourceID}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if sRes.Status.Code != rpc.Code_CODE_OK {
|
||||
return statuspkg.NewErrorFromCode(sRes.Status.Code, "auth interceptor")
|
||||
}
|
||||
|
||||
sharedResource := sRes.Info
|
||||
|
||||
// Is this a shared space
|
||||
if sharedResource.ParentId == nil {
|
||||
// Is the requested resource part of the shared space?
|
||||
if requested.ResourceId.StorageId != sharedResource.Id.StorageId || requested.ResourceId.SpaceId != sharedResource.Id.SpaceId {
|
||||
return errtypes.PermissionDenied("space access forbidden via public link")
|
||||
}
|
||||
} else {
|
||||
parentID := sharedResource.ParentId
|
||||
parentID.StorageId = sharedResource.Id.StorageId
|
||||
|
||||
if !utils.ResourceIDEqual(parentID, requested.ResourceId) && utils.MakeRelativePath(sharedResource.Path) != requested.Path {
|
||||
return errtypes.PermissionDenied("access forbidden via public link")
|
||||
}
|
||||
}
|
||||
|
||||
key := storagespace.FormatResourceID(sharedResourceID) + scopeDelimiter + getRefKey(requested)
|
||||
_ = scopeExpansionCache.SetWithExpire(key, nil, scopeCacheExpiration*time.Second)
|
||||
return nil
|
||||
return checkIfNestedResource(ctx, ref, share.ResourceId, client, mgr)
|
||||
}
|
||||
|
||||
func resolveUserShare(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
@@ -241,105 +116,99 @@ func resolveUserShare(ctx context.Context, ref *provider.Reference, scope *authp
|
||||
return err
|
||||
}
|
||||
|
||||
return checkCacheForNestedResource(ctx, ref, share.ResourceId, client, mgr)
|
||||
return checkIfNestedResource(ctx, ref, share.ResourceId, client, mgr)
|
||||
}
|
||||
|
||||
func checkCacheForNestedResource(ctx context.Context, ref *provider.Reference, resource *provider.ResourceId, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
// Check if this ref is cached
|
||||
key := storagespace.FormatResourceID(resource) + scopeDelimiter + getRefKey(ref)
|
||||
if _, err := scopeExpansionCache.Get(key); err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if ok, err := checkIfNestedResource(ctx, ref, resource, client, mgr); err == nil && ok {
|
||||
_ = scopeExpansionCache.SetWithExpire(key, nil, scopeCacheExpiration*time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
return errtypes.PermissionDenied("request is not for a nested resource")
|
||||
}
|
||||
|
||||
func checkIfNestedResource(ctx context.Context, ref *provider.Reference, parent *provider.ResourceId, client gateway.GatewayAPIClient, mgr token.Manager) (bool, error) {
|
||||
func checkIfNestedResource(ctx context.Context, ref *provider.Reference, shareRoot *provider.ResourceId, client gateway.GatewayAPIClient, mgr token.Manager) error {
|
||||
// Since the resource ID is obtained from the scope, the current token
|
||||
// has access to it.
|
||||
statResponse, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: parent}})
|
||||
rootStat, err := client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: shareRoot}})
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
if statResponse.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(statResponse.Status.Code, "auth interceptor")
|
||||
if rootStat.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return statuspkg.NewErrorFromCode(rootStat.Status.Code, "auth interceptor")
|
||||
}
|
||||
|
||||
pathResp, err := client.GetPath(ctx, &provider.GetPathRequest{ResourceId: statResponse.GetInfo().GetId()})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
if pathResp.Status.Code != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(pathResp.Status.Code, "auth interceptor")
|
||||
}
|
||||
parentPath := pathResp.Path
|
||||
rootInfo := rootStat.GetInfo()
|
||||
|
||||
childPath := ref.GetPath()
|
||||
if childPath != "" && childPath != "." && strings.HasPrefix(childPath, parentPath) {
|
||||
// if the request is relative from the root, we can return directly
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// The request is not relative to the root. We need to find out if the requested resource is child of the `parent` (coming from token scope)
|
||||
// We need to find out if the requested resource is a child of the `shareRoot` (coming from token scope)
|
||||
// We mint a token as the owner of the public share and try to stat the reference
|
||||
// TODO(ishank011): We need to find a better alternative to this
|
||||
// NOTE: did somebody say service accounts? ...
|
||||
|
||||
var user *userpb.User
|
||||
if statResponse.GetInfo().GetOwner().GetType() == userpb.UserType_USER_TYPE_SPACE_OWNER {
|
||||
if rootInfo.GetOwner().GetType() == userpb.UserType_USER_TYPE_SPACE_OWNER {
|
||||
// fake a space owner user
|
||||
user = &userpb.User{
|
||||
Id: statResponse.GetInfo().GetOwner(),
|
||||
Id: rootInfo.GetOwner(),
|
||||
}
|
||||
} else {
|
||||
userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: statResponse.Info.Owner, SkipFetchingUserGroups: true})
|
||||
userResp, err := client.GetUser(ctx, &userpb.GetUserRequest{UserId: rootInfo.GetOwner(), SkipFetchingUserGroups: true})
|
||||
if err != nil || userResp.Status.Code != rpc.Code_CODE_OK {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
user = userResp.User
|
||||
}
|
||||
|
||||
scope, err := scope.AddOwnerScope(map[string]*authpb.Scope{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
token, err := mgr.MintToken(ctx, user, scope)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
ctx = metadata.AppendToOutgoingContext(context.Background(), ctxpkg.TokenHeader, token)
|
||||
|
||||
childStat, err := client.Stat(ctx, &provider.StatRequest{Ref: ref})
|
||||
resourceStat, err := client.Stat(ctx, &provider.StatRequest{Ref: ref})
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
if childStat.GetStatus().GetCode() == rpc.Code_CODE_NOT_FOUND && ref.GetPath() != "" && ref.GetPath() != "." {
|
||||
if resourceStat.GetStatus().GetCode() == rpc.Code_CODE_NOT_FOUND && ref.GetPath() != "" && ref.GetPath() != "." {
|
||||
// The resource does not seem to exist (yet?). We might be part of an initiate upload request.
|
||||
// Stat the parent to get its path and check that against the root path.
|
||||
childStat, err = client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ref.GetResourceId()}})
|
||||
resourceStat, err = client.Stat(ctx, &provider.StatRequest{Ref: &provider.Reference{ResourceId: ref.GetResourceId()}})
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
}
|
||||
if childStat.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(childStat.Status.Code, "auth interceptor")
|
||||
if resourceStat.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return statuspkg.NewErrorFromCode(resourceStat.Status.Code, "auth interceptor")
|
||||
}
|
||||
pathResp, err = client.GetPath(ctx, &provider.GetPathRequest{ResourceId: childStat.GetInfo().GetId()})
|
||||
|
||||
// Check if the resource and the share root are in the same storage space
|
||||
ci := resourceStat.GetInfo()
|
||||
if ci.GetId().GetStorageId() != rootInfo.GetId().GetStorageId() ||
|
||||
ci.GetId().GetSpaceId() != rootInfo.GetId().GetSpaceId() {
|
||||
return errtypes.PermissionDenied("invalid resource")
|
||||
}
|
||||
|
||||
// check if the resource path is subpath of the share root path
|
||||
rootPath, err := getPath(ctx, rootStat.GetInfo().GetId(), client)
|
||||
if err != nil {
|
||||
return false, err
|
||||
return err
|
||||
}
|
||||
if pathResp.GetStatus().GetCode() != rpc.Code_CODE_OK {
|
||||
return false, statuspkg.NewErrorFromCode(pathResp.Status.Code, "auth interceptor")
|
||||
|
||||
resourcePath, err := getPath(ctx, resourceStat.GetInfo().GetId(), client)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
childPath = pathResp.Path
|
||||
|
||||
return strings.HasPrefix(childPath, parentPath), nil
|
||||
if rootPath == "/" || resourcePath == rootPath || strings.HasPrefix(resourcePath, rootPath+"/") {
|
||||
return nil
|
||||
}
|
||||
|
||||
return errtypes.PermissionDenied("invalid resource")
|
||||
}
|
||||
|
||||
func getPath(ctx context.Context, resourceId *provider.ResourceId, client gateway.GatewayAPIClient) (string, error) {
|
||||
pathResp, err := client.GetPath(ctx, &provider.GetPathRequest{ResourceId: resourceId})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if pathResp.Status.Code != rpc.Code_CODE_OK {
|
||||
return "", statuspkg.NewErrorFromCode(pathResp.Status.Code, "auth interceptor")
|
||||
}
|
||||
return pathResp.Path, nil
|
||||
}
|
||||
|
||||
func extractRefFromListProvidersReq(v *registry.ListStorageProvidersRequest) (*provider.Reference, bool) {
|
||||
@@ -503,27 +372,3 @@ func extractRef(req interface{}, tokenScope map[string]*authpb.Scope) (*provider
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func extractShareRef(req interface{}) (*collaboration.ShareReference, bool) {
|
||||
switch v := req.(type) {
|
||||
case *collaboration.GetReceivedShareRequest:
|
||||
return v.GetRef(), true
|
||||
case *collaboration.UpdateReceivedShareRequest:
|
||||
return &collaboration.ShareReference{Spec: &collaboration.ShareReference_Id{Id: v.GetShare().GetShare().GetId()}}, true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
|
||||
func getRefKey(ref *provider.Reference) string {
|
||||
if ref.GetPath() != "" {
|
||||
return ref.Path
|
||||
}
|
||||
|
||||
if ref.GetResourceId() != nil {
|
||||
return storagespace.FormatResourceID(ref.ResourceId)
|
||||
}
|
||||
|
||||
// on malicious request both path and rid could be empty
|
||||
// we still should not panic
|
||||
return ""
|
||||
}
|
||||
Vendored
+1
-1
@@ -1313,7 +1313,7 @@ github.com/orcaman/concurrent-map
|
||||
# github.com/owncloud/libre-graph-api-go v1.0.5-0.20260116104114-10074a92be64
|
||||
## explicit; go 1.18
|
||||
github.com/owncloud/libre-graph-api-go
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260123085534-22a1be2b211e
|
||||
# github.com/owncloud/reva/v2 v2.0.0-20260206095425-032663e2f51a
|
||||
## explicit; go 1.24.0
|
||||
github.com/owncloud/reva/v2/cmd/revad/internal/grace
|
||||
github.com/owncloud/reva/v2/cmd/revad/runtime
|
||||
|
||||
Reference in new issue
Block a user