Tech Racho エンジニアの「?」を「!」に。
  • Ruby / Rails関連

Rails 7.2.0 Action Pack CHANGELOG(全項目リンク付き)

概要

MITライセンスに基づいて翻訳・公開いたします。

なお、機能削除のエントリについては、原則として7.2での削除プルリクではなく、その機能が非推奨化されたときの過去のプルリクへリンクしています。

Rails 7.2.0 Action Pack CHANGELOG(全項目リンク付き)

更新22件(うち非推奨削除6件)

🔗 include the HTTP Permissions-Policy on non-HTML Content-Types · rails/rails@c7b9e0c

  • HTTP Permissions-PolicyをHTML以外のContent-Typeにも含めるよう修正

Aaron Patterson, Zack Deveau

※このセキュリティ修正はRails 7.1.3.4でもリリース済みです↓。

Railsセキュリティ修正7.1.3.4、7.0.8.4、6.1.7.8がリリースされました

🔗 Fix Mime::Type.parse for HTTP Accept with parameters by notchairmk · Pull Request #51616 · rails/rails

  • Mime::Type.parseがHTTP AcceptヘッダーのMIMEタイプパラメータを正しく解析できない場合がある問題を修正

Taylor Chaparro

参考: Accept - HTTP | MDN

🔗 [Fix #51095] Missing template error page showing incorrect view path example for nested controller path by joshuay03 · Pull Request #51096 · rails/rails

  • ビューテンプレートが見つからない場合に表示されるエラーメッセージを修正

見つからないテンプレートの置き場所が、ネステッドコントローラのパスでも正しくネスト表示されるようになった。

Joshua Young

🔗 Add save_and_open_page helper to IntegrationTest by JoeDupuis · Pull Request #49267 · rails/rails

  • IntegrationTestsave_and_open_pageヘルパーを追加

Capybaraのsave_and_open_pageヘルパーは、システムテストを書くときの細かな調整を簡潔に繰り返したいときに有用。
これと同様のヘルパーを同じシグネチャで統合テストに追加した。

Joé Dupuis

参考: Method: Capybara::Session#save_and_open_page — Documentation for capybara (3.40.0)

🔗 Restore to: option in routes with an implicit controller by etiennebarrie · Pull Request #51523 · rails/rails

  • Rails 7.1.3で、コントローラが既にスコープで定義されている状態で、コントローラを指定せずにto:オプションを利用するとエラーになる問題を修正
Rails.application.routes.draw do
  controller :home do
    get "recent", to: "recent_posts"
  end
end

Étienne Barrié

🔗 Request Forgery takes relative paths into account by zealot128 · Pull Request #32770 · rails/rails

  • リクエストフォージェリ対策で相対パスも考慮するよう修正

Stefan Wienert

参考: 9 リクエストフォージェリからの保護 -- Action Controller の概要 - Railsガイド

🔗 Allow .test by default in development by dhh · Pull Request #51087 · rails/rails

参考: 週刊Railsウォッチ20240228: puma-devの改修2件

  • .testという名前をdevelopment環境で許可されるホスト名リストに追加

puma.devでのセットアップを最短の方法でスムーズに行えるようにするため。

DHH

puma/puma-dev - GitHub

🔗 Add allow_browser to set minimum versions for your application by dhh · Pull Request #50505 · rails/rails

参考: 週刊Railsウォッチ20240123: アプリでの利用を許可するブラウザの最小バージョンをallow_browserで指定できるようになった

  • アプリケーションでブラウザの最小バージョンを設定するallow_browserを追加

ブロックされるブラウザでは、public/406-unsupported-browser.htmlのファイルがHTTPステータスコード"406 Not Acceptable"で配信される。

class ApplicationController < ActionController::Base
  # `:modern`を指定すると、webp画像、webプッシュ、バッジ、importmap、
  # CSSネスティング、:hasをネイティブでサポートするブラウザのみが許可される
  allow_browser versions: :modern
end

class ApplicationController < ActionController::Base
  # この設定ではChromeとOperaは全バージョンが許可されるが、"internet explorer"(ie)はどのバージョンも許可されない。
  # Safariは16.4以上、Firefoxは121以上が必要。
  allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
end

class MessagesController < ApplicationController
  # ApplicationControllerでブロックされるブラウザに加えて、
  # showアクションではOpera 104未満とChrome 119未満もブロックされる
  allow_browser versions: { opera: 104, chrome: 119 }, only: :show
end

DHH

🔗 Add rate limiting to Action Controller via the Kredis limiter type by dhh · Pull Request #50490 · rails/rails

参考: 週刊Railsウォッチ20240123: レート制限APIを追加

  • レート制限APIを追加
class SessionsController < ApplicationController
  rate_limit to: 10, within: 3.minutes, only: :create
end

class SignupsController < ApplicationController
  rate_limit to: 1000, within: 10.seconds,
    by: -> { request.domain }, with: -> { redirect_to busy_controller_url, alert: "Too many signups!" }, only: :new
end

DHH, Jean Boussier

Rails 8: 組み込みのレート制限APIを導入(翻訳)

🔗 feature: Allow serving compressed SVG images (rebased) by flavorjones · Pull Request #50359 · rails/rails

参考: 週刊Railsウォッチ20240117: image/svg+xmlが圧縮可能Content-Typeに追加された

  • image/svg+xmlActionDispatch::Staticの圧縮可能Content Typeに追加された

Georg Ledermann

🔗 Add instrumentation for ActionController::Live#send_stream by hannahramadan · Pull Request #49297 · rails/rails

参考: 週刊Railsウォッチ20240117: ActionController::Live#send_streamにinstrumentationが追加された

  • ActionController::Live#send_stream用のinstrumentationが追加

これにより、send_streamイベントへのサブスクライブが可能になる。このイベントのペイロードにはfilenamedispositiontypeが含まれる。

Hannah Ramadan

🔗 Make with_routing test helper work for integration tests by gmcgibbon · Pull Request #49819 · rails/rails

参考: 週刊Railsウォッチ20231213: with_routingテストヘルパーを統合テストで使えるようにした

  • ActionDispatch::IntegrationTestwith_routingテストヘルパーのサポートを追加

Gannon McGibbon

🔗 (削除)Make the test environment show rescuable exceptions in responses by jdufresne · Pull Request #45867 · rails/rails

参考: 週刊Railsウォッチ20230613: rescue可能な例外をtest環境のエラー画面に表示するようになった

  • Rails.application.config.action_dispatch.show_exceptionsで設定可能な非推奨値truefalseのサポートを削除

Rafael Mendonça França

🔗 (削除)Deprecate obsolete permissions policy directives by jonathanhefner · Pull Request #46199 · rails/rails

参考: 週刊Railsウォッチ20221018: Feature-Policyヘッダーのリストを更新した

  • パーミッションポリシーの非推奨化されたディレクティブspeakervibratevrを削除

Rafael Mendonça França

🔗 (削除)Remove deprecated behavior on Request#content_type · rails/rails@689b277

参考: 週刊Railsウォッチ20210201: content_typeメソッドがContent-Typeヘッダーをそのまま返すよう修正

  • 非推奨化されていたRails.application.config.action_dispatch.return_only_request_media_type_on_content_typeを削除

Rafael Mendonça França

🔗 (削除)Remove deprecated comparison between ActionController::Parameters a… · rails/rails@43e42c1

  • Rails.application.config.action_controller.allow_deprecated_parameters_hash_equalityを非推奨化

Rafael Mendonça França

  • 非推奨化されていたActionController::ParametersHashの比較機能を削除

Rafael Mendonça França

参考: Make behaviour of has_value?/value? more consistent by stefkin · Pull Request #44866 · rails/rails

🔗 (削除)Deprecate AbstractController MissingHelperError by skipkayhil · Pull Request #47199 · rails/rails

参考: 週刊Railsウォッチ20230221: AbstractControllerのMissingHelperErrorを非推奨化

  • 非推奨化されていたAbstractController::Helpers::MissingHelperError定数を削除

Rafael Mendonça França

🔗 Preload Selenium driver_path before parallelizing system tests by mattbrictson · Pull Request #49908 · rails/rails

参考: 週刊Railsウォッチ20231122: システムテストをパラレル実行したときの競合状態を修正

注: この修正はRails 7.1.2でリリース済みです。

  • システムテストをパラレルで実行するとText file busy - chromedriverエラーが発生する可能性のある競合状態を修正

Matt Brictson

🔗 Add racc dependency because it will be bundled by skipkayhil · Pull Request #49722 · rails/rails

注: この改修はRails 7.1.2でリリース済みです。

  • racc gem(LALR(1)パーサージェネレータ)を依存性に追加(Ruby 3.4.0からはbundled gemとなる予定)

Hartley McGuire


現時点では、racc gemはRuby 3.3.1からbundled gemとなっています↓。

参考: Standard Gems: racc
参考: standard librariesとdefault gemsとbundled gemsの違い - ESM アジャイル事業部 開発者ブログ

🔗 (削除)Use Rack's own headers classes where appropriate. by ioquatix · Pull Request #47091 · rails/rails

  • 非推奨化されていたActionDispatch::IllegalStateError定数を削除

Rafael Mendonça França

参考: 週刊Railsウォッチ20230221: 必要な場所ではRack固有のヘッダーを使うよう修正

https://techracho.bpsinc.jp/hachi8833/2023_01_05/123107

🔗 Add parameter filter capability for redirect locations by tonytonyjan · Pull Request #51131 · rails/rails

参考: 週刊Railsウォッチ20240306: リダイレクトのクエリパラメータのログ出力にconfig.filter_parametersが効くようになった

  • リダイレクト先のパラメータをフィルタする機能を追加

config.filter_parametersを用いてフィルタが必要なものとマッチさせる。
結果は以下のようになる。

    Redirected to http://secret.foo.bar?username=roque&password=[FILTERED]

修正: #14055

Roque Pinel, Trevor Turk, tonytonyjan


これより前のChangelogについては、7-1-stableを参照してください。

関連記事

Rails 7.1.0 Action Pack CHANGELOG(翻訳)


CONTACT

TechRachoでは、パートナーシップをご検討いただける方からの
ご連絡をお待ちしております。ぜひお気軽にご意見・ご相談ください。