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

Offen Anfängerfreundlich
#67,246 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
php
Bereich
api, backend

Rechercherichtung

Lies apps/cloud_federation_api/lib/Controller/RequestHandlerController.php und verfolge addShare() bis zu protocolCarriesSharedSecret(). Prüfe die im Issue beschriebenen Regeln des OCM-Protokolls embedded und finde die vorhandenen Tests für Freigabeanfragen. Die Aufgabe ist abgeschlossen, wenn eingebettete Freigaben den registrierten Anbieter ohne sharedSecret erreichen, während Protokolle, die eines erfordern, Anfragen ohne dieses weiterhin ablehnen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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().

Vorherrschende Sprache
PHP
Sterne
37.6k
Forks
5.4k
Ø Merge
1 T. 14 Std.
Gemergte PRs (30 T.)
640

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nextcloud/server

Alle Issues in nextcloud/server

Ähnliche Issues

Weitere Issues zu PHP

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.