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

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

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

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

評価

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

調査の方向性

sentry-rails gem 内で Sentry::Rails::IGNORE_DEFAULT を grep してデフォルトの除外リストを見つけ、次に Sentry::Configuration#excluded_exception_classes を読む。これは各名前を Object.const_get 経由で解決する。変更内容は、ActionController::InvalidCrossOriginRequest がすでに存在して定義されている場合に ActionController::InvalidAuthenticityToken を列挙しないようにし、非推奨の定数が決して解決されないようにすることだ。完了とは、Rails main 上で DEPRECATION WARNING なしで例外を捕捉できること、さらに既存の configuration specs が引き続きパスすることである。

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

説明

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
主要言語
Ruby
スター
990
フォーク
553
平均マージ
1日 19時間
マージ済み PR(30日)
31

環境構築

Codespaces で開く

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

はじめの一歩

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

getsentry/sentry-ruby のほかの issue

getsentry/sentry-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

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

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