## Rails 4.0.13 (January 6, 2015) ##
* Added an explicit error message, in `ActionView::PartialRenderer`
for partial `rendering`, when the value of option `as` has invalid characters.
*Angelo Capilleri*
* Restore handling of a bare `Authorization` header, without `token=`
prefix.
Fixes #17108.
*Guo Xiang Tan*
## Rails 4.0.12 (November 16, 2014) ##
* Fix a bug where malformed query strings lead to 500.
fixes #11502.
*Yuki Nishijima*
## Rails 4.0.11.1 (November 19, 2014) ##
* Fix arbitrary file existence disclosure in Action Pack.
CVE-2014-7829.
## Rails 4.0.11 (September 11, 2014) ##
* Fix arbitrary file existence disclosure in Action Pack.
CVE-2014-7818.
## Rails 4.0.10 (September 11, 2014) ##
* Return an absolute instead of relative path from an asset url in the case
of the `asset_host` proc returning nil
*Jolyon Pawlyn*
* Prepend a JS comment to JSONP callbacks. Addresses CVE-2014-4671
("Rosetta Flash")
*Greg Campbell*
* Generate shallow paths for all children of shallow resources.
Fixes #15783.
*Seb Jacobs*
* JSONP responses are now rendered with the `text/javascript` content type
when rendering through a `respond_to` block.
Fixes #15081.
*Lucas Mazza*
* Added `config.action_view.raise_on_missing_translations` to define whether an
error should be raised for missing translations.
Fixes #13196
*Kassio Borges*
* ActionController::Parameters#require now accepts `false` values.
Fixes #15685.
*Sergio Romano*
* With authorization header `Authorization: Token token=`, `authenticate` now
recognize token as nil, instead of "token".
Fixes #14846.
*Larry Lv*
## Rails 4.0.9 (August 18, 2014) ##
*No changes*
## Rails 4.0.8 (July 2, 2014) ##
*No changes*
## Rails 4.0.7 (July 2, 2014) ##
*No changes*
## Rails 4.0.6 (June 26, 2014) ##
* Fix URL generation with `:trailing_slash` such that it does not add
a trailing slash after `.:format`
*Dan Langevin*
* Fix `'Stack level too deep'` when rendering `head :ok` in an action method
called 'status' in a controller.
Fixes #13905.
*Christiaan Van den Poel*
* Always use the provided port if the protocol is relative.
Fixes #15043.
*Guilherme Cavalcanti*, *Andrew White*
* Change `asset_path` to use File.join to create proper paths.
https://some.host.com//assets/some.js
becomes
https://some.host.com/assets/some.js
*Peter Schröder*
* Returns null type format when format is not known and controller is using `any`
format block.
Fixes #14462.
*Rafael Mendonça França*
* `collection_check_boxes` respects `:index` option for the hidden field name.
Fixes #14147.
*Vasiliy Ermolovich*
* Only make deeply nested routes shallow when parent is shallow.
Fixes #14684.
*Andrew White*, *James Coglan*
* `date_select` helper with option `with_css_classes: true` does not overwrite other classes.
*Izumi Wong-Horiuchi*
* Swaps the parameters of `assert_equal` in `assert_select` so that the
proper values are printed correctly.
Fixes #14422.
*Vishal Lal*
* The method `shallow?` returns false if the parent resource is a singleton so
we need to check if we're not inside a nested scope before copying the `:path`
and `:as` options to their shallow equivalents.
Fixes #14388.
*Andrew White*
## Rails 4.0.5 (May 6, 2014) ##
* Only accept actions without File::SEPARATOR in the name.
This will avoid directory traversal in implicit render.
Fixes: CVE-2014-0130
*Rafael Mendonça França*
## Rails 4.0.4 (March 14, 2014) ##
* Fix label translation for more than 10 nested elements.
*Vladimir Krylov*
* Use a custom route visitor for optimized url generation. Fixes #13349.
*Andrew White*
* Set the `:shallow_path` scope option as each scope is generated rather than
waiting until the `shallow` option is set. Also make the behavior of the
`:shallow` resource option consistent with the behavior of the `shallow` method.
Fixes #12498.
*Andrew White*, *Aleksi Aalto*
* Do not discard query parameters that form a hash with the same root key as
the `wrapper_key` for a request using `wrap_parameters`.
*Josh Jordan*
* Ensure that `request.filtered_parameters` is reset between calls to `process`
in `ActionController::TestCase`.
Fixes #13803.
*Andrew White*
* Fix `rake routes` error when `Rails::Engine` with empty routes is mounted.
Fixes #13810.
*Maurizio De Santis*
* Unique the segment keys array for non-optimized url helpers
In Rails 3.2 you only needed to pass an argument for a dynamic segment once so
unique the segment keys array to match the number of args. Since the number
of args is less than required parts, the non-optimized code path is selected.
To benefit from optimized url generation, the arg needs to be specified as
many times as it appears in the path.
Fixes #12808.
*Andrew White*
* Show full route constraints in error message
When an optimized helper fails to generate, show the full route constraints
in the error message. Previously it would only show the contraints that were
required as part of the path.
Fixes #13592.
*Andrew White*
* Allow engine root relative redirects using an empty string.
Example:
# application routes.rb
mount BlogEngine => '/blog'
# engine routes.rb
get '/welcome' => redirect('')
This now redirects to the path `/blog`, whereas before it would redirect
to the application root path. In the case of a path redirect or a custom
redirect, if the path returned contains a host then the path is treated as
absolute. Similarly for option redirects, if the options hash returned
contains a `:host` or `:domain` key then the path is treated as absolute.
Fixes #7977.
*Andrew White*
* Fix `Encoding::CompatibilityError` when public path is UTF-8
In #5337 we forced the path encoding to ASCII-8BIT to prevent static file handling
from blowing up before an application has had a chance to deal with possibly
invalid urls. However this has a negative side effect of making it an incompatible
encoding if the application's public path has UTF-8 characters in it.
To work around the problem we check to see if the path has a valid encoding once
it has been unescaped. If it is not valid then we can return early since it will
not match any file anyway.
Fixes #13518.
*Andrew White*
* `ActionController::Parameters#permit!` permits hashes in array values.
*Xavier Noria*
* Converts hashes in arrays of unfiltered params to unpermitted params.
Fixes #13382.
*Xavier Noria*
* `rake routes` shows routes defined under assets prefix.
*Ryunosuke SATO*
* Label tags generated by collection helpers only inherit the `:index` and
`:namespace` from the input, because only these attributes modify the
`for` attribute of the label. Also, the input attributes don't have
precedence over the label attributes anymore.
Before:
collection = [[1, true, { class: 'foo' }]]
f.collection_check_boxes :options, collection, :second, :first do |b|
b.label(class: 'my_custom_class')
end
# =>
After:
collection = [[1, true, { class: 'foo' }]]
f.collection_check_boxes :options, collection, :second, :first do |b|
b.label(class: 'my_custom_class')
end
# =>
*Andriel Nuernberg*
* Fix regression when using `ActionView::Helpers::TranslationHelper#translate` with
`options[:raise]`.
This regression was introduced at ec16ba75a5493b9da972eea08bae630eba35b62f.
*Shota Fukumori (sora_h)*
* Fix rendering localized templates without an explicit format using wrong
content header and not passing correct formats to template due to the
introduction of the `NullType` for mimes.
Templates like `hello.it.erb` were subject to this issue.
Fixes #13064.
*Angelo Capilleri*, *Carlos Antonio da Silva*
* Fix regression with `simple_format` not having access to the `raw` method
when included in isolation, introduced with the security fix in Rails 4.0.2.
*Mario Visic*
* Fix formatting for `rake routes` when a section is shorter than a header.
*Sıtkı Bağdat*
* Use `set_backtrace` instead of instance variable `@backtrace` in ActionView exceptions.
*Shimpei Makimoto*
* Fix `simple_format` escapes own output when passing `sanitize: true`.
*Paul Seidemann*
* Don't let strong parameters mutate the given hash via `fetch`.
Create a new instance if the given parameter is a `Hash` instead of
passing it to the `convert_hashes_to_parameters` method since it is
overriding its default value.
*Brendon Murphy*, *Doug Cole*
## Rails 4.0.3 (February 18, 2014) ##
* Escape format, negative_format and units options of number helpers
Fixes: CVE-2014-0081
## Rails 4.0.2 (December 02, 2013) ##
* Ensure simple_format escapes its html attributes. This fixes CVE-2013-6416
* Deep Munge the parameters for GET and POST Fixes CVE-2013-6417
* Stop using i18n's built in HTML error handling. Fixes: CVE-2013-4491
* Escape the unit value provided to number_to_currency Fixes CVE-2013-6415
* Only use valid mime type symbols as cache keys CVE-2013-6414
## Rails 4.0.1 (November 01, 2013) ##
* Respect `SCRIPT_NAME` when using `redirect` with a relative path
Example:
# application routes.rb
mount BlogEngine => '/blog'
# engine routes.rb
get '/admin' => redirect('admin/dashboard')
This now redirects to the path `/blog/admin/dashboard`, whereas before it would've
generated an invalid url because there would be no slash between the host name and
the path. It also allows redirects to work where the application is deployed to a
subdirectory of a website.
Fixes #7977.
*Andrew White*
* Fix `ActionDispatch::RemoteIp::GetIp#calculate_ip` to only check for spoofing
attacks if both `HTTP_CLIENT_IP` and `HTTP_X_FORWARDED_FOR` are set.
Fixes #10844.
*Tamir Duberstein*
* Strong parameters should permit nested number as key.
Fixes #12293.
*kennyj*
* Fix `collection_check_boxes` generated hidden input to use the name attribute provided
in the options hash.
*Angel N. Sciortino*
* Fix some edge cases for AV `select` helper with `:selected` option
*Bogdan Gusiev*
* Handle `:namespace` form option in collection labels
*Vasiliy Ermolovich*
* Fix an issue where router can't recognize downcased url encoding path.
Fixes #12269.
*kennyj*
* Fix custom flash type definition. Misuse of the `_flash_types` class variable
caused an error when reloading controllers with custom flash types.
Fixes #12057.
*Ricardo de Cillo*
* Do not break params filtering on `nil` values.
Fixes #12149.
*Vasiliy Ermolovich*
* Fix `excerpt` when `:separator` is `nil`.
*Paul Nikitochkin*
* Make Live Streaming work with basic authentication or builder.
Fixes #10984.
*Aaron Patterson*
* Always use `Rack::Sendfile` to make possible to it be automatically
configured by the webserver.
Fixes #11440.
*Martin Schürrer*
* Flag cookies as secure with ignore case in `ActionDispatch::SSL`.
*Yamagishi Kazutoshi*
* Don't include STS header in non-HTTPS responses.
*Geoff Buesing*
* Fix an issue where rails raise exception about missing helper where it
should throw `LoadError`. When helper file exists and only loaded file from
this helper does not exist rails should throw LoadError instead of
`MissingHelperError`.
*Piotr Niełacny*
* Only cache template digests if `config.cache_template_loading` is true.
*Josh Lauer*, *Justin Ridgewell*
* Fix an issue where `:if` and `:unless` controller action procs were being run
before checking for the correct action in the `:only` and `:unless` options.
Fixes #11799.
*Nicholas Jakobsen*
* Fix an issue where `assert_dom_equal` and `assert_dom_not_equal` were
ignoring the passed failure message argument.
Fixes #11751.
*Ryan McGeary*
* Fix `current_page?` when the URL contains escaped characters and the
original URL is using the hexadecimal lowercased.
*Rafael Mendonça França*
* Allow `REMOTE_ADDR`, `HTTP_HOST` and `HTTP_USER_AGENT` to be overridden from
the environment passed into `ActionDispatch::TestRequest.new`.
Fixes #11590.
*Andrew White*
* Fix `text_area` to behave like `text_field` when `nil` is given as
value.
Before:
f.text_field :field, value: nil #=>
f.text_area :field, value: nil #=>
After:
f.text_area :field, value: nil #=>
*Joel Cogen*
* Fix an issue where Journey was failing to clear the named routes hash when the
routes were reloaded and since it doesn't overwrite existing routes then if a
route changed but wasn't renamed it kept the old definition. This was being
masked by the optimised url helpers so it only became apparent when passing an
options hash to the url helper.
*Andrew White*
* Skip routes pointing to a redirect or mounted application when generating urls
using an options hash as they aren't relevant and generate incorrect urls.
Fixes #8018.
*Andrew White*
* Fix default rendered format problem when calling `render` without `:content_type` option.
It should return `:html`.
Fixes #11393.
*Gleb Mazovetskiy*, *Oleg*, *kennyj*
* Fix `ActionDispatch::ParamsParser#parse_formatted_parameters` to rewind body input stream on
parsing json params.
Fixes #11345.
*Yuri Bol*, *Paul Nikitochkin*
* Fix `link_to` with block and url hashes.
Before:
link_to(action: 'bar', controller: 'foo') { content_tag(:span, 'Example site') }
# => "Example site"
After:
link_to(action: 'bar', controller: 'foo') { content_tag(:span, 'Example site') }
# => "Example site"
*Murahashi Sanemat Kenichi*
* Fix "Stack Level Too Deep" error when rendering recursive partials.
Fixes #11340.
*Rafael Mendonça França*
* Pick `DateField` `DateTimeField` and `ColorField` values from stringified options allowing use of symbol keys with helpers.
*Jon Rowe*
* Fix `Mime::Type.parse` when bad accepts header is looked up. Previously it
was setting `request.formats` with an array containing a `nil` value, which
raised an error when setting the controller formats.
Fixes #10965.
*Becker*
* Always escape the result of `link_to_unless` method.
Before:
link_to_unless(true, 'Showing', 'github.com')
# => "Showing"
After:
link_to_unless(true, 'Showing', 'github.com')
# => "<b>Showing</b>"
*dtaniwaki*
## Rails 4.0.0 (June 25, 2013) ##
* Merge `:action` from routing scope and assign endpoint if both `:controller`
and `:action` are present. The endpoint assignment only occurs if there is
no `:to` present in the options hash so should only affect routes using the
shorthand syntax (i.e. endpoint is inferred from the the path).
Fixes #9856
*Yves Senn*, *Andrew White*
* Use a case insensitive URI Regexp for #asset_path.
This fix a problem where the same asset path using different case are generating
different URIs.
Before:
image_tag("HTTP://google.com")
# => ""
image_tag("http://google.com")
# => ""
After:
image_tag("HTTP://google.com")
# => ""
image_tag("http://google.com")
# => ""
*David Celis*
* Add `has_named_route?(route_name)` to the mapper API.
*José Valim*
* Fix an issue where partials with a number in the filename weren't being digested for cache dependencies.
*Bryan Ricker*
* Add support for passing custom url options other than `:host` and custom
status and flash options to `force_ssl`.
*Andrew White*
* The `force_ssl` command now builds the redirect url from `request.fullpath`.
This ensures that the format is maintained and it doesn't redirect to a route
that has the same parameters but is defined earlier in `routes.rb`. Also any
optional segments are maintained.
Fixes #7528, #9061, #10305.
*Andrew White*
* Return a 405 Method Not Allowed response when a request contains an unknown
HTTP method.
*Lewis Marshall*
* Add support for extracting the port from the `:host` option passed to `url_for`.
*Andrew White*
* Add support for removing the subdomain from a url by passing `nil`, `false` or `''`.
Fixes #10180.
*Derek Watson + Andrew White*
* Element of the collection for `options_from_collection_for_select` helper can
optionally contain html attributes as the last element of the array as
`options_for_select` helper.
*Vasiliy Ermolovich*
* Fix explicit names on multiple file fields. If a file field tag has
the multiple option, it is turned into an array field (appending `[]`),
but if an explicit name is passed to `file_field` the `[]` is not
appended.
Fixes #9830.
*Ryan McGeary*
* Add block support for the `mail_to` helper, similar to the `link_to` helper.
*Sam Pohlenz*
* Automatically configure cookie-based sessions to be encrypted if
`secret_key_base` is set, falling back to signed if only `secret_token`
is set. Automatically upgrade existing signed cookie-based sessions from
Rails 3.x to be encrypted if both `secret_key_base` and `secret_token`
are set, or signed with the new key generator if only `secret_token` is
set. This leaves only the `config.session_store :cookie_store` option and
removes the two new options introduced in 4.0.0.beta1:
`encrypted_cookie_store` and `upgrade_signature_to_encryption_cookie_store`.
*Trevor Turk*
* Ensure consistent fallback to the default layout lookup for layouts set
using symbols or procs that return `nil`.
All of the following layouts will result in the default layout lookup:
layout nil
layout proc { nil }
layout :returns_nil
def returns_nil
nil
end
Previously symbols and procs which returned `nil` resulted in no layout which
differed from the `layout nil` behavior. To get the "no layout" behavior just
return `false` instead of `nil` for `layout`.
*Chris Nicola*
* Create `UpgradeLegacySignedCookieJar` to transparently upgrade existing signed
cookies generated by Rails 3.x to avoid invalidating them when upgrading to Rails 4.x.
*Trevor Turk + Neeraj Singh*
* Raise an `ArgumentError` when a clashing named route is defined.
*Trevor Turk*
* Allow default url options to accept host with protocol such as `http://`
config.action_mailer.default_url_options = { host: "http://mydomain.com" }
*Richard Schneeman*
* Ensure that digest authentication responds with a 401 status when a basic
header is received.
*Brad Dunbar*
* Include I18n locale fallbacks in view lookup.
Fixes #3512.
*Juan Barreneche*
* Integration and functional tests allow headers and rack env
variables to be passed when performing requests.
Fixes #6513.
Example:
# integration test
get "/success", {}, "HTTP_REFERER" => "http://test.com/",
"Accepts" => "text/plain, text/html"
# functional test
@request.headers["Accepts"] = "text/plain, text/html"
*Yves Senn*
* Http::Headers respects headers that are not prefixed with HTTP_
*Yves Senn*
* Fix incorrectly appended square brackets to a multiple select box
if an explicit name has been given and it already ends with "[]"
Before:
select(:category, [], {}, multiple: true, name: "post[category][]")
# =>