OCM: shares using the `embedded` protocol are rejected with "Missing sharedSecret in protocol"

Abierto Apto para principiantes
#67,246 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
api, backend

Línea de trabajo

Lee apps/cloud_federation_api/lib/Controller/RequestHandlerController.php y sigue addShare() hasta protocolCarriesSharedSecret(). Comprueba las reglas del protocolo OCM embedded descritas en el issue y encuentra las pruebas existentes para las solicitudes de compartición. El trabajo estará terminado cuando las comparticiones embedded lleguen al proveedor registrado sin sharedSecret, mientras que los protocolos que lo requieren sigan rechazando las solicitudes que no lo incluyan.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Bug description

POST /ocm/shares rejects every share that uses the OCM embedded protocol with HTTP 400 Missing sharedSecret in protocol, before the share reaches the registered ICloudFederationProvider.

The embedded protocol carries the resource inline (protocol: { "name": "multi", "embedded": <JSON> }) and, per the extension, needs no access credential: "No sharedSecret, access token, URI, or other access credential is required or defined for the embedded protocol." RequestHandlerController::protocolCarriesSharedSecret() nevertheless requires a sharedSecret for any protocol, so an app that registers a provider for an embedded resource type never sees such shares.

Senders can work around it by adding a dummy protocol.options.sharedSecret, which is what we do for now.

Steps to reproduce
  1. Register an ICloudFederationProvider for some resource type (e.g. calendar-event) in an app.
  2. Send a correctly signed share to that server:
    { "shareWith": "[email protected]", "name": "x", "providerId": "…",
      "owner": "[email protected]", "sender": "[email protected]",
      "shareType": "user", "resourceType": "calendar-event",
      "protocol": { "name": "multi", "embedded": { "example": "value" } } }
    
  3. Observe the response.
Expected behavior

Shares whose protocol is embedded (no access credential by design) are passed to the provider, which decides whether it can handle them; a sharedSecret is only required for protocols that define one.

Actual behavior

400 {"message":"Missing sharedSecret in protocol"}.

Nextcloud Server version

35 (35.0.3.2); master has the same check.

Operating system / PHP / Web server / Database

Official Docker image nextcloud:35-apache (Debian), PHP 8.5.13, Apache 2.4.71, PostgreSQL 18.7.

Is this bug present after an update or on a fresh install?

Fresh install.

Additional context

Found while implementing calendar invitations over OCM (calendar-event carried with embedded, proposed to the OCM spec in https://github.com/cs3org/OCM-API/pull/464). The code path is apps/cloud_federation_api/lib/Controller/RequestHandlerController.php, addShare() → protocolCarriesSharedSecret().

Lenguaje dominante
PHP
Estrellas
37.6k
Forks
5.4k
Merge medio
1 d 14 h
PR fusionados (30 d)
640

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de nextcloud/server

Todos los issues de nextcloud/server

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.