2023/01/18分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Use eval_gemfile to read .Gemfile
Gemfile
の修正です。
ローカルの.Gemfile
をロードするのにBundlerのeval_gemfile
メソッドを使用するよう修正しています。
Rename ::normalize to ::normalize_value_for
activerecord/lib/active_record/normalization.rb
の修正です。
特定のattributeに関する値に対してnormalize処理を行うメソッドの名前をnormalize
からnormalize_value_for
に変更しています。別にnormalizes
というメソッドがあり、normalize
とnormalizes
がほぼ同じ名前だと混乱の元になるのでは、という事でnormalize_value_for
に変更されました。
Added integer width check to PostgreSQL::Quoting
Active Recordの、railtiesの修正です。
PostgreSQLのquote処理で、値が64bit signed integerの範囲外だった場合に、エラーとするよう修正しています。左記範囲を越えた場合、PostgreSQLはcolumn typeをnumericとして扱うようになります。integer valueとnumeric valueの比較処理は大変遅い処理になり、これがDoSにつながってしまう可能性がある為、デフォルトはエラーになるよう修正しています。なお、これを今まで通りエラーとしたくない場合は、config.active_record.raise_int_wider_than_64bit
にfalseを指定すれば良いようになっています。
参考: [CVE-2022-44566] Possible Denial of Service Vulnerability in ActiveRecord's PostgreSQL adapter
Fix sec issue with _url_host_allowed?
actionpack/lib/action_controller/metal/redirecting.rb
の修正です。
redirect_to(params[:some_param])
のようにredirect_to
に信頼出来ない値を直接指定している場合に、Open Redirect 出来てしまう問題があったのを修正しています。
参考: [CVE-2023-22797] Possible Open Redirect Vulnerability in Action Pack
Use string#split instead of regex for domain parts
actionpack/lib/action_dispatch/middleware/cookies.rb
の修正です。
X_FORWARDED_HOST
headerに加工された不正な値を指定した場合に、ReDoS出来てしまう可能性があったのを修正しています。
参考: [CVE-2023-22792] Possible ReDoS based DoS vulnerability in Action Dispatch
Avoid regex backtracking in Inflector.underscore
activesupport/lib/active_support/inflector/methods.rb
の修正です。
String#underscore
やActiveSupport::Inflector.underscore
に加工された不正な値を指定した場合に、Ruby 3.2未満の場合にReDoS出来てしまう可能性があったのを修正しています。
参考: [CVE-2023-22796] Possible ReDoS based DoS vulnerability in Active Support's underscore
Avoid regex backtracking on If-None-Match header
actionpack/lib/action_dispatch/http/cache.rb
の修正です。
If-None-Match
headerに加工された不正な値を指定した場合に、Ruby 3.2未満の場合にReDoS出来てしまう可能性があったのを修正しています。
[CVE-2023-22795] Possible ReDoS based DoS vulnerability in Action Dispatch
Make sanitize_as_sql_comment more strict
Active Recordの修正です。
Post.where(id: 1).annotate("#{params[:user_input]}")
やPost.where(id: 1).optimizer_hints("#{params[:user_input]}")のように、
annotateや
optimizer_hints`等のメソッドを使って、SQLのコメントに加工された不正な値を指定しているような場合に、SQLインジェクション出来てしまう問題があったのを修正しています。
rubocopの設定に違反している箇所があったのを修正しています。
Make sure Enumerable#sum works with objects that implement #coerce without deprecation
activesupport/lib/active_support/core_ext/enumerable.rb
の修正です。
独自にcoerce
メソッドを定義してるクラスをEnumerable#sum
メソッドに指定した場合に、本来不要なdeprecateメッセージが表示されてしまっていたのを修正しています。
rubocopの設定に違反している箇所があったのを修正しています。
activerecord/test/cases/adapters/mysql2/optimizer_hints_test.rb
の修正です。
Make sanitize_as_sql_comment more strictの対応によりoptimizer hintのテストが壊れてしまったのを修正しています。
Run through AR Callbacks guide
rails guideのActive Record Callbacks
の修正です。
guide全体について、言い回しの修正やexampleコードの追加などを行っています。
Make Active Storage setup a bit more clear [ci skip]
rails guideのActive Storage Overview
の修正です。
Setup
項の言い回しの修正を行っています。
activerecord/lib/active_record/normalization.rb
のdocの修正です。
Rename ::normalize to ::normalize_value_forで変更されたメソッドの古い名前を使用している箇所がdocにあったのを修正しています。
AR Basics guide now includes associations since #46909
rails guideのActive Record Basics
の修正です。
guideの内容について説明している箇所に、associationsについても説明されている旨説明を追加しています。
Merge pull request #46690 from adrianna-chang-shopify/ac-db-warning-reporting
Active Recordの修正です。
SQLのwarningが発生した場合に、そのwarningをreporting出来るよう修正しています。warningが発生した場合にどのようはアクションを行うかは、config.active_record.db_warnings_action
に指定出来るようなっており、:ignore
、:log
、:raise
、:report
(Rails.error.report
を使用)、または custom procが指定出来るようになっています。また、ignoreしたいwarningはconfig.active_record.db_warnings_ignore
に指定出来るようになっています。
config.active_record.db_warnings_action = :raise config.active_record.db_warnings_ignore = [ /Invalid utf8mb4 character string/, "An exact warning message", ]
Merge pull request #47019 from yahonda/action_mailbox_test_isolated
actionmailbox/Rakefile
の修正です。
Action Mailboxにテストを単体で実行する為のtest:isolated
taskを追加しています。
Improve Rails' Shape friendliness (third pass)
actionpack/lib/action_controller/metal/url_for.rb
、
activesupport/lib/active_support/configurable.rb
の修正です。
Improve Rails' Shape friendlinessの続きで、Object Shapesが効率的に使われるよう修正を行っています。