Commit Graph

14928 Commits

Author SHA1 Message Date
Akira Matsuda
d331e6d7dc AC::Streaming uses no AS::Concern feature since 7da88c5b297486cd90696133d287be7d60d65218 2020-11-26 01:37:55 +09:00
Akira Matsuda
ac7d112430 AC::Testing uses no AS::Concern feature since 879d540adc34603f0fd1ac1a44763598e9ccc551 2020-11-26 01:37:55 +09:00
Akira Matsuda
ec0050edf3 Fix SyntaxError in the API doc
[ci skip]
2020-11-25 23:20:56 +09:00
David Heinemeier Hansson
5636604b45 Fix CHANGELOG reference to old method name 2020-11-24 11:00:56 +01:00
David Heinemeier Hansson
1535af1c31
Get rid of the cumbersome fallback_location keyword argument for redirect_back (#40671) 2020-11-24 10:17:11 +01:00
Petrik
2e079154a8 Use Feature-Policy header name for now
In 90e710d7672b928ce6bb3ec05f8f2c05338be6c9 the FeaturePolicy middleware
was renamed to PermissionsPolicy as this will be new name of the header
as used by browsers.
The Permissions-Policy header requires a different implementation and
isn't yet supported by all browsers. To avoid having to rename the
middleware in the future, we keep the new name for the Middleware, but
use the old implementation and header name.
2020-11-19 16:08:09 +01:00
Ryuta Kamizono
151bce17b6 Rename s/feature_policy/permissions_policy/ in the CHANGELOG [ci skip] 2020-11-19 11:35:14 +09:00
Julien Grillot
90e710d767 Rename HTTP Feature Policy to Permissions Policy
HTTP Feature-Policy has been renamed to Permissions-Policy:
* Original issue: https://github.com/w3c/webappsec-permissions-policy/issues/359
* PR: https://github.com/w3c/webappsec-permissions-policy/pull/379
* Doc: https://w3c.github.io/webappsec-permissions-policy/

Mozilla documentation has been updated on July 2020:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy
2020-11-14 17:31:58 +01:00
Rafael França
a538e4dee5
Merge pull request #40567 from hahmed/ha/formatted-error-messages
Display exception messages using simple_format
2020-11-09 18:11:06 -05:00
Jonathan Hefner
2e53730d62 Document ActionController::Cookies#cookies [ci-skip]
There are several `cookies` methods that appear when searching the API
documentation, but none of them are the method commonly used in
controllers.

This makes Action Controller's `cookies` method appear in the search
results, and makes the accompanying `ActionDispatch::Cookies`
documentation more discoverable.
2020-11-09 16:38:42 -06:00
Haroon Ahmed
93f0cebd1d Display exception messages using simple_format for a better and clearer
exception message.
2020-11-09 21:48:24 +00:00
Rafael Mendonça França
8389f9902c
Preparing for 6.1.0.rc1 release 2020-11-02 21:12:47 +00:00
Chris Bisnett
1f767407cb Add request exclusion to Host Authorization
In the same way that requests may need to be excluded from forced SSL,
requests may also need to be excluded from the Host Authorization
checks. By providing this additional flexibility more applications
will be able to enable Host Authorization while excluding requests
that may not conform. For example, AWS Classic Load Balancers don't
provide a Host header and cannot be configured to send one. This means
that Host Authorization must be disabled to use the health check
provided by the load balancer. This change will allow an application
to exclude the health check requests from the Host Authorization
requirements.

I've modified the `ActionDispatch::HostAuthorization` middleware to
accept arguments in a similar way to `ActionDispatch::SSL`. The hosts
configuration setting still exists separately as does the
hosts_response_app but I've tried to group the Host Authorization
settings like the ssl_options. It may make sense to deprecate the
global hosts_response_app if it's only used as part of the Host
Authorization failure response. I've also updated the existing tests
as the method signature changed and added new tests to verify the
exclusion functionality.
2020-11-02 20:16:29 +00:00
Rafael França
0300aa802a
Merge pull request #40504 from tbrisker/paramobjects
Reduce object allocations in param wrapping
2020-11-02 12:52:24 -05:00
Tomer Brisker
1bc7cce8fe
Reduce object allocations in param wrapping
When wrapping parameters, `_extract_parameters` is called twice for
every request. In most cases, both the `include` and `exclude` options
will be empty. In that case, we can use a logical check to save
allocation of an empty array and another allocation of a new array
concatenating the empty array with the hard-coded `EXCLUDE_PARAMETERS`.
The result is 4 array allocations less per request when wrapping is
enabled and `exclude` is not set.
2020-11-01 15:07:03 +02:00
Eugene Kenny
de0f59f1ce
Merge pull request #38261 from vipulnsward/wrapper-support-alias-attrs
Adds support to wrap aliased attributed in object hash in params wrapper
2020-11-01 12:42:37 +00:00
Rafael Mendonça França
a09b04e637
Fix tests with Ruby 3 2020-10-30 02:20:04 +00:00
Ryuta Kamizono
8512213a39 Fix deprecation will be removed version s/Rails 6.1/Rails 6.2/ 2020-10-30 10:11:29 +09:00
Jonathan Hefner
614e813161
Disentangle Action Text from ApplicationController
This commit allows Action Text to be used without having an
ApplicationController defined.  In doing so, it also fixes Action Text
attachments to render the correct URL host in mailers.

It also avoids allocating an ActionController::Renderer per request.

Fixes #37183.
Fixes #35578.
Fixes #36963.
Closes #38714.

Co-authored-by: Jeremy Daer <jeremydaer@gmail.com>
2020-10-30 01:01:42 +00:00
Rafael Mendonça França
5087d00153
Always ask for a header argument in ResquestId middleware 2020-10-30 00:41:59 +00:00
Arlston Fernandes
2711dcc9a6
Customise the header name for ActionDispatch::RequestId
by setting `config.action_dispatch.request_id_header` to the desired value

* Ensure HTTP_X_REQUEST_ID presence to maintain compatiblility

* Use req.headers[] to fetch header rather than ENV methods

* Update configuration doc to match existing descriptions

* Add changelog entry for action_dispatch.request_id_header
2020-10-30 00:31:09 +00:00
Rafael Mendonça França
64efe502f3
Change ActionDispatch::Response#content_type to return the full Content-Type header
And deprecate the config to keep the previous behavior.
2020-10-30 00:25:49 +00:00
Rafael Mendonça França
cd0c99c991
Make the arguments of ActionView::Base#initialize required 2020-10-30 00:25:24 +00:00
Rafael Mendonça França
d52d773946
Remove deprecated support to passing relative paths to render file: 2020-10-30 00:25:14 +00:00
Rafael Mendonça França
3e2552db89
Remove deprecated ActionDispatch::Http::ParameterFilter 2020-10-30 00:25:10 +00:00
Rafael França
f8d7ab5f3c
Merge pull request #39705 from Shopify/actioncontroller-testcase-parameters-fix
Fix the ActionController::TestCase#process parameters serialization
2020-10-29 17:43:32 -04:00
John Hawthorn
e3130f1b84
Revert "Raise when calling render with invalid options" 2020-10-29 13:49:30 -07:00
John Hawthorn
e53e2a006b Validate arguments to render calls 2020-10-28 19:30:48 -07:00
Rafael Mendonça França
7cb4513466
Copy-edit the documentation [ci skip] 2020-10-27 18:13:40 +00:00
HParker
9a2f63acbc avoid calling custom_encoding_for when unused
if the action does not use a custom encoding, then we can skip checking if we need to fix the encoding on any of the parameters.

Instead of asking the controller about each of the parameters, we can ask the controller to tell us what params to convert once. If the controller returns nothing, we have no work to do.
2020-10-27 10:42:41 -07:00
HParker
260b4d86a8 improve param_encoding docs 2020-10-27 09:04:55 -07:00
Eileen M. Uchitelle
c9ddceab6d
Merge pull request #40457 from HParker/specify-per-param-encoding
add ability to set per param encoding
2020-10-27 09:43:55 -04:00
Akira Matsuda
b37473ebbd Mapper#resource and resources are both public methods 2020-10-27 12:13:32 +09:00
John Hawthorn
9b6162a82e
Merge pull request #40204 from jhawthorn/helper_module_copy_on_write
Avoid creating controller _helper modules until modification
2020-10-26 17:46:02 -07:00
HParker
0cbc6114dc Add ability to set per param encoding
previously you could skip encoding which would encode all parameters on an action as ASCII_8BIT
After this change you can specify the `param_encoding` for any one parameter on an action

Co-authored-by: John Hawthorn  <jhawthorn@github.com>
2020-10-26 11:26:29 -07:00
Loren Norman
1f9a5dd36b fix broken handling of unknown http methods 2020-10-23 23:34:58 +01:00
Ryuta Kamizono
92ff708476 Re-enable Layout/SpaceAroundOperators cop
We prefer space around operators, but `Layout/SpaceAroundOperators` cop
was temporarily disabled in #36943 since that cop changed to check
alignment strictly somehow.

In RuboCop 1.0.0, that is fixed by https://github.com/rubocop-hq/rubocop/pull/8906.

Related https://github.com/rails/rails/pull/38034#discussion_r359845661,
https://github.com/rails/rails/pull/39770#discussion_r448829561.
2020-10-23 16:12:15 +09:00
Ryuta Kamizono
09f364b6f6 Remove redundant begin blocks 2020-10-22 17:11:26 +09:00
Sam Bostock
a812537e4d
Handle port-less $MEMCACHE_SERVERS in MemCacheStore tests
Devs may be running tests on a machine which provides $MEMCACHE_SERVERS
without a trailing port. We should allow for this when checking if
Memcache is working.
2020-10-20 22:32:22 -04:00
Joel Hawksley
136b814144 Include layout when rendering objects from controllers
In https://github.com/rails/rails/pull/37919, support
for rendering objects that respond_to render_in in
controllers was added. However, the implementation
did not support layouts.

This change updates the implementation from #37919
to more closely match the rest of the
ActionView::Template classes, enabling the use of layouts.

Co-authored-by: Felipe Sateler <fsateler@gmail.com>
2020-10-14 11:49:45 -06:00
Akira Matsuda
5699122abf Revert "*Store implements delete_session as a public method"
This reverts commit d41939a678290c773f9a5275a4aed772b4707f06.

Reason: activerecord-session_store implements `delete_session` as a private method
https://github.com/rails/activerecord-session_store/blob/f188efb/lib/action_dispatch/session/active_record_store.rb#L94

Thank you @al for pointing this out!
https://github.com/rails/rails/commit/d41939a6#commitcomment-43152220

Co-authored-by: Alan Larkin <alan.larkin@gmail.com>
2020-10-12 09:16:39 +09:00
Eugene Kenny
ddfc54492a Add missing space before closing hash brace 2020-10-07 19:37:13 +01:00
Rafael Mendonça França
9015e37ce6
Fix style of this file 2020-10-07 17:55:18 +00:00
Rafael Mendonça França
f2caed1e73
Don't log backtrace for ActionDispatch::Http::MimeNegotiation::InvalidType 2020-10-07 17:30:07 +00:00
Rafael França
1e5e1f17d6
Merge pull request #40353 from jrochkind/more_specific_bad_content_type_error
Raise more specific exception for invalid mime type from user-agent
2020-10-07 13:14:58 -04:00
Aaron Patterson
ddcca86f0e
Prevent XSS in the Actionable Exceptions middleware
[CVE-2020-8264]
2020-10-07 09:52:55 -07:00
Jonathan Rochkind
2bad7eb111 Raise more specific exception for invalid mime type from user-agent
To be able to distinguish from other kinds of `Mime::Type::InvalidMimeType` that may be raised by user or third-party code. It's only failure in parsing client-supplied content-types in ActionDispatch::Http::MimeNegotiation that should result in special handling.

This also allows third-party error handling/tracking code to specifically target the new `ActionDispatch::Http::MimeNegotiation::InvalidType` for ignoring or other special handling, separate from  `Mime::Type::InvalidMimeType`

This is a revision of #35753 in response to #37620 and discussion with @eugeneius
2020-10-07 11:49:56 -04:00
Akira Matsuda
91d1e81832 URL helper methods are public methods 2020-10-07 21:00:26 +09:00
Chris Kruger
e06f7b3ef7 allow for only no-store in cache-control header 2020-10-07 10:33:38 +08:00
Rafael Mendonça França
d98d749222
Revert "Merge pull request #39304 from zenspider/zenspider/backtrace_filter_should_never_return_empty"
This reverts commit 2eb7aa111bbbf69fe89bdcd96b4839480e2ac076, reversing
changes made to 0b28f0c39c5b0a0009f1ea9d13ce97704e20c85b.

Rails backtrace cleaner needs to be able to return empty traces to
separate application code from the framework code and not report
exceptions that happen inside only framework code.

See
345de17caf/actionpack/lib/action_dispatch/middleware/exception_wrapper.rb (L72).
2020-10-06 22:31:41 +00:00