sentry-rails: excluded_exceptions triggers a Rails deprecation warning for ActionController::InvalidAuthenticityToken

Đang mở Phù hợp với người mới
#3,228 1 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
78/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ệ
rails, ruby
Lĩnh vực
backend

Hướng nghiên cứu

Grep gem sentry-rails để tìm Sentry::Rails::IGNORE_DEFAULT nhằm tìm danh sách loại trừ mặc định, sau đó đọc Sentry::Configuration#excluded_exception_classes, thứ phân giải từng tên qua Object.const_get. Thay đổi là ngừng liệt kê ActionController::InvalidAuthenticityToken khi ActionController::InvalidCrossOriginRequest đã có mặt và được định nghĩa, để hằng số đã lỗi thời không bao giờ được phân giải. Hoàn thành nghĩa là bắt được một exception dưới Rails main mà không có DEPRECATION WARNING, cộng với các spec cấu hình hiện có vẫn pass.

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

Mô tả

Bug Ruby Waiting for: Product Owner

Rails main (8.2) deprecates ActionController::InvalidAuthenticityToken in favour of ActionController::InvalidCrossOriginRequest (release notes). The old name is now a deprecated constant that warns when it is resolved.

Sentry::Rails::IGNORE_DEFAULT still lists "ActionController::InvalidAuthenticityToken", and Sentry::Configuration#excluded_exception_classes resolves every name with Object.const_get. So the first exception that Sentry captures in each process prints:

DEPRECATION WARNING: ActionController::InvalidAuthenticityToken has been deprecated and will be removed in Rails 9.0. Use ActionController::InvalidCrossOriginRequest instead.

Versions: sentry-ruby / sentry-rails 7.2.0 (7.3.0 has the same list), Rails main.

Suggested fix: leave "ActionController::InvalidAuthenticityToken" out of the default list when ActionController::InvalidCrossOriginRequest is defined, because the list already holds that name and the old name refers to the same class.

Workaround:

Sentry::Configuration.after(:initialize) do
  excluded_exceptions.delete("ActionController::InvalidAuthenticityToken")
end
Ngôn ngữ chính
Ruby
Star
990
Fork
553
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
31

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 getsentry/sentry-ruby

Tất cả issue của getsentry/sentry-ruby

Issue tương tự

Thêm issue về Ruby

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.