2016/04/12分のコミットです。
CHANGELOGへの追加はありませんでした。
Merge pull request #24485 from prathamesh-sonpatki/protected_database_env_message
activerecord/lib/active_record/migration.rb
の修正です。
ProtectedEnvironmentError
が発生した場合に表示されるエラーメッセージのグラマーの修正を行っています。
remove explicit curlies for hash argument
railties/lib/rails/application.rb
の修正です。
env_config
メソッドでHashの生成を行っている箇所にあった不要な中括弧を削除しています。
edit pass over the RDoc of Rails::Railtie [ci skip]
railties/lib/rails/railtie.rb
のdocの修正です
Rails::Railtie
クラスのdocの、グラマー、フォーマットの修正等をまとめて行っています。
Improved ActionView flows.rb documention [ci skip]
actionview/lib/action_view/flows.rb
のdocの修正です。
ActionView::OutputFlow#get
メソッド、及びActionView::StreamingFlow#append!
メソッドのdoc内のメソッドの説明についての言い回しの修正を行なっています。
Pass over all Rails 5 warnings, to make sure:
Rails 5で表示されるようになったwarningメッセージのグラマーの修正、及び各メッセージの終端にピリオドの追加を行っています。
[ci skip] This modifies the HTTP Token authentication example's authenticate
method, to use the secure_compare
method with two constant-length strings. This defends against timing attacks, and is best practice. Using ==
for sensitive actions is not recommended, and this was the source of a CVE fixed in October 2015: https://github.com/rails/rails/commit/17e6f1507b7f2c2a883c180f4f9548445d6dfbda
actionpack/lib/action_controller/metal/http_authentication.rb
のdocの修正です。
ActionController::HttpAuthentication::Basic
moduleのdoc内にあるauthenticate処理のexampleコードで、String#==
で比較処理を行っていたのを、ActiveSupport::SecurityUtils.secure_compare
を行って比較処理を行うよう修正しています。
# def authenticate # authenticate_or_request_with_http_token do |token, options| - # token == TOKEN + # # Compare the tokens in a time-constant manner, to mitigate + # # timing attacks. + # ActiveSupport::SecurityUtils.secure_compare( + # ::Digest::SHA256.hexdigest(token), + # ::Digest::SHA256.hexdigest(TOKEN) + # ) # end
AStringの比較処理の実行時間からパスワードを推測されるのを避ける為。
set default parameter to nil to speed up attribute_changed?
activemodel/lib/active_model/dirty.rb
の修正です。
#attribute_changed?
メソッドのoptions
パラメータのデフォルト値をnil
に変更し、options
が設定されてない場合は、options
に関する処理を行わないよう修正しています。
Merge pull request #24490 from prathamesh-sonpatki/add-config-to-deprecation-warning
railties/lib/rails/application/configuration.rb
の修正です。
static_cache_control
、serve_static_files
を使用した場合に出力されるdeprecateメッセージの各パラメータの箇所に、config
を追加しています。
ActiveSupport::Deprecation.warn <<-eow.strip_heredoc - `static_cache_control` is deprecated and will be removed in Rails 5.1. + `config.static_cache_control` is deprecated and will be removed in Rails 5.1.
Merge pull request #24495 from vipulnsward/rails-changelog-pass
railties/CHANGELOG.md
の修正です。
各entryのグラマー、フォーマットの修正等をまとめて行っています。
Use a single memoized loop to find max mtime in ActiveSupport::FileUpdateChecker#max_mtime
activesupport/lib/active_support/file_update_checker.rb
の修正です。
ActiveSupport::FileUpdateChecker#max_mtime
メソッドで、 ファイルのmax timeを取得するのに複数回ループ処理を行っていたのを、値を保持してループが一回で済むようリファクタリングを行っています。
Use Time#compare_without_coercion for super speed
activesupport/lib/active_support/file_update_checker.rb
の修正です。
ActiveSupport::FileUpdateChecker#max_mtime
メソッドで、tiimeの比較処理で#compare_without_coercion
メソッドを使用するよ修正しています。
- if time < time_now && time > max_time + # This avoids ActiveSupport::CoreExt::Time#time_with_coercion + # which is super slow when comparing two Time objects + # + # Equivalent Ruby: + # time < time_now && time > max_time + if time.compare_without_coercion(time_now) < 0 && time.compare_without_coercion(max_time) > 0
コメントにある通り、ActiveSupport::CoreExt::Time#time_with_coercion
が遅い為、との事です。