OCM notifications without sharedSecret return 500 instead of 400

Đang mở Phù hợp với người mới
#67,595 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
76/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, đặc biệt là receiveNotification() và resolveNotificationIdentity(), để theo dõi cách xử lý ngoại lệ khi thiếu sharedSecret. Tìm các bài kiểm thử controller cho thông báo OCM và bổ sung kiểm thử cho một yêu cầu không có notification.sharedSecret. Công việc hoàn tất khi yêu cầu đó trả về 400 kèm lỗi xác thực thay vì 500 và bài kiểm thử chạy thành công.

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

Mô tả

1. to develop bug feature: federation
Bug description

When signature checks are enabled (the default), RequestHandlerController::receiveNotification() resolves the sender identity first:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php#L320-L331

resolveNotificationIdentity() throws a BadRequestException when the notification has no sharedSecret:

https://github.com/nextcloud/server/blob/3a68340a6c806a18cdd0d9667a3b9ec5f096b135/apps/cloud_federation_api/lib/Controller/RequestHandlerController.php#L477-L481

but that try block only catches IncomingRequestException – the BadRequestException handler belongs to the next try block – so the request ends in a 500 and an uncaught exception is logged. (Embedded shares without secret are tracked in #67246.)

Steps to reproduce

Found by code reading.

  1. Send an OCM notification without notification.sharedSecret to /ocm/notifications.
  2. The response is a 500.
Expected behavior

A 400 with the validation error, covered by a test.

Nextcloud version

master

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

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.