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

Đang mở Phù hợp với người mới
#67,246 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
api, backend

Hướng nghiên cứu

Đọc apps/cloud_federation_api/lib/Controller/RequestHandlerController.php, lần theo addShare() đến protocolCarriesSharedSecret(). Kiểm tra các quy tắc của giao thức OCM embedded được mô tả trong issue và tìm các bài kiểm thử hiện có cho yêu cầu chia sẻ. Hoàn tất khi các lượt chia sẻ embedded đến được nhà cung cấp đã đăng ký mà không cần sharedSecret, trong khi các giao thức yêu cầu sharedSecret vẫn từ chối những yêu cầu không có nó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
PHP
Star
37.6k
Fork
5.4k
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
640

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của nextcloud/server

Tất cả issue của nextcloud/server

Issue tương tự

Thêm issue về PHP

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.