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

オープン 初心者向け
#67,246 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
php
領域
api, backend

調査の方向性

apps/cloud_federation_api/lib/Controller/RequestHandlerController.phpを読み、addShare()からprotocolCarriesSharedSecret()まで追ってください。issueに記載されたOCMのembeddedプロトコルのルールを確認し、共有リクエストの既存テストを探してください。embedded共有がsharedSecretなしで登録済みプロバイダーに届き、sharedSecretを必要とするプロトコルでは、それがないリクエストが引き続き拒否される状態になれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
PHP
スター
37.6k
フォーク
5.4k
平均マージ
1日 14時間
マージ済み PR(30日)
640

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

nextcloud/server のほかの issue

nextcloud/server の issue をすべて見る

似ている issue

PHP の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。