aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | Add missing changelog entrybogdanvlviv2018-04-201-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/rails/rails/pull/32593 was backported to `5-2-stable` but since 5.2.0 is released the changelog entry should be in Rails 6.0.0 too. [ci skip]
* | | | | Merge pull request #32636 from yhirano55/improve_line_tasksRafael França2018-04-191-1/+1
|\ \ \ \ \ | | | | | | | | | | | | Improve redundancy in line tasks
| * | | | | Improve redundancy in line tasksYoshiyuki Hirano2018-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove needless concat from actionpack/Rakefile * Remove neesless File.join from actionview/Rakefile
* | | | | | Merge pull request #32593 from sdhull/fix-strong-params-permit-bangRafael Mendonça França2018-04-192-2/+5
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Fixes StrongParameters `permit!` to work with nested arrays
| * | | | | | Fixes StrongParameters permit! to work with nested arraysSteve Hull2018-04-163-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `permit!` is intended to mark all instances of `ActionController::Parameters` as permitted, however nested arrays of params were not being marked permitted because the method did shallow iteration. This fixes that by flattening the array before calling `permit!` on all each item.
* | | | | | | Merge pull request #32605 from composerinteralia/assert-notRafael França2018-04-1914-26/+26
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | Add RuboCop for `assert_not` over `assert !`
| * | | | | | Replace `assert !` with `assert_not`Daniel Colson2018-04-1914-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This autocorrects the violations after adding a custom cop in 3305c78dcd.
* | | | | | | Fix reference to fixed issue in actionpack/CHANGELOG.mdbogdanvlviv2018-04-191-1/+1
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull Request #32602 fixes Issue #32597. [ci skip]
* | | | | | Remove unused literal introduced in #32602Andrew White2018-04-181-1/+0
| | | | | |
* | | | | | Don't link issue number in CHANGELOG [ci skip]Andrew White2018-04-181-1/+1
| | | | | |
* | | | | | Pass nonce to CSP policy from outsideAndrew White2018-04-183-53/+97
| | | | | |
* | | | | | Output only one nonce in CSP header per requestAndrey Novikov2018-04-173-22/+59
|/ / / / /
* | | | | Fix broken nodocsChris Arcand2018-04-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes all references in the codebase missing a trailing :, which causes the nodoc not to actually work :) [skip ci]
* | | | | Fix rendering a differently-formatted partial after cachingGeorge Claghorn2018-04-133-0/+14
| | | | |
* | | | | Add WebSocket URI support to CSP DSL mappingsStephen Solis2018-04-122-1/+9
| | | | |
* | | | | Merge pull request #32484 from kddeisz/default-headersRafael França2018-04-105-6/+24
|\ \ \ \ \ | | | | | | | | | | | | Include default headers by default in API mode
| * | | | | Include default headers by default in API modeKevin Deisz2018-04-065-6/+24
| | | | | | | | | | | | | | | | | | | | | | | | ActionDispatch's default headers are now moved into their own module that are by default included in both Base and API. This allows API-mode applications to take advantage of the default security headers, as well as providing an easy way to add more.
* | | | | | Remove upper bound on Capybaraeileencodes2018-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no reason to block future versions of Capybara since we don't _know_ they are going to break. How will we know if we have a conservative option set? This change prevents us from blocking users who want to upgrade in the future.
* | | | | | Add `TestCaseTest#test_request_format_kwarg_doesnt_mutate_params` to masterbogdanvlviv2018-04-101-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initially, the test was added to 5-0-stable in #32492 and a bit modified in #32506. This test ensures that request(in tests) doesn't mutate params. It was fixed since v5.1.0.beta1 by 98b8309569a326910a723f521911e54994b112fb and then on 5-0-stable by #32492. This commit adds this test to master branch in order to prevent any regressions.
* | | | | | Merge pull request #32488 from swrobel/patch-4Rafael Mendonça França2018-04-091-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | Only disable headless chrome gpu on Windows
| * | | | | | Only disable headless chrome gpu on WindowsStefan Wrobel2018-04-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Per Chromium team this has not been necessary on other platforms for quite some time: https://bugs.chromium.org/p/chromium/issues/detail?id=737678#c1
* | | | | | | Improve the null origin error messagePatrik Bóna2018-04-091-1/+1
|/ / / / / /
* / / / / / Partially revert 0bfdd1dyuuji.yaginuma2018-04-071-1/+5
|/ / / / / | | | | | | | | | | | | | | | | | | | | The `Capybara.server=` proc acceptance restored in Capyara 3.0.1. Ref: https://github.com/teamcapybara/capybara/commit/8f115d94e035eca992036f16e50c1dce5f555c97
* | | | | Add changelog entry for #32446bogdanvlviv2018-04-062-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #32446 was added method `dig` to `session`. Improve docs of method `dig`. [ci skip]
* | | | | Fix broken `ServerTest` with Capybara 3.0.0yuuji.yaginuma2018-04-061-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It seems that it is no longer possible to specify the value held by `Capybara.server` as sever. Ref: https://github.com/teamcapybara/capybara/commit/ba7674086cbcd3b22d3614011815bc5d483e5960
* | | | | Merge pull request #32441 from composerinteralia/refute-notRafael França2018-04-043-8/+8
|\ \ \ \ \ | | | | | | | | | | | | Add custom RuboCop for `assert_not` over `refute`
| * | | | | Autocorrect `refute` RuboCop violationsDaniel Colson2018-04-033-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 73e7aab behaved as expected on codeship, failing the build with exactly these RuboCop violations. Hopefully `rubocop -a` will have been enough to get a passing build!
* | | | | | Merge pull request #32446 from sinsoku/add_dig_to_sessionRafael França2018-04-042-0/+20
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add #dig to ActionDispatch::Request::Session
| * | | | | | Add #dig to ActionDispatch::Request::Sessionclaudiob2018-04-042-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary The `session` object is not a real Hash but responds to many methods of Hash such as `[]`, `[]`, `fetch`, `has_key?`. Since Ruby 2.3, Hash also supports a `dig` method. This commit adds a `dig` method to `ActionDispatch::Request::Session` with the same behavior as `Hash#dig`. This is useful if you store a hash in your session, such as: ```ruby session[:user] = { id: 1, avatar_url: "http://example.org/nyancat.jpg" } ``` Then you can shorten your code from `session[:user][:avatar_url]` to `session.dig :user, :avatar_url`. ### Other Information I cherry-picked a commit from https://github.com/rails/rails/pull/23864, and modify a bit. The changes are below: * Converts only the first key to a string adjust to the `fetch` method. * Fixes a test case because we cannot use the indifferent access since ee5b621e2f8fde380ea4bc75b0b9d6f98499f511.
* | | | | | | Remove superfluous `ActionController::`Francois Chagnon2018-04-041-1/+1
|/ / / / / /
* | | | | | Small doc fixesT.J. Schuck2018-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | Merge pull request #32336 from vincedevendra/allow_mutating_dig_return_valueAaron Patterson2018-04-022-1/+10
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Make mutating params#dig return value mutate underlying params
| * | | | | Make mutating params#dig mutate underlying paramsVince DeVendra2018-03-242-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When #dig was called on a params object and return either a Hash or an Array, and that value was subsquently mutated, it would not modify the containing params object. That means that the behavior of `params.dig(:a, :b)[:c] = 1` did not match either `params[:a][:b][:c] = 1` nor `hash.dig(:a, :b)[:c] = 1`. Similarly to `ActionController::Parameters#[]`, use `#convert_hashes_to_parameters` to pre-convert values and insert them in the receiving params object prior to returning them.
* | | | | | Merge pull request #32277 from derekprior/dp-deprecate-force-sslGuillermo Iguaran2018-03-304-70/+48
|\ \ \ \ \ \ | | | | | | | | | | | | | | Deprecate controller level force_ssl
| * | | | | | Deprecate controller level force_sslDerek Prior2018-03-304-70/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today there are two common ways for Rails developers to force their applications to communicate over HTTPS: * `config.force_ssl` is a setting in environment configurations that enables the `ActionDispatch::SSL` middleware. With this middleware enabled, all HTTP communication to your application will be redirected to HTTPS. The middleware also takes care of other best practices by setting HSTS headers, upgrading all cookies to secure only, etc. * The `force_ssl` controller method redirects HTTP requests to certain controllers to HTTPS. As a consultant, I've seen many applications with misconfigured HTTPS setups due to developers adding `force_ssl` to `ApplicationController` and not enabling `config.force_ssl`. With this configuration, many application requests can be served over HTTP such as assets, requests that hit mounted engines, etc. In addition, because cookies are not upgraded to secure only in this configuration and HSTS headers are not set, it's possible for cookies that are meant to be secure to be sent over HTTP. The confusion between these two methods of forcing HTTPS is compounded by the fact that they share an identical name. This makes finding documentation on the "right" method confusing. HTTPS throughout is quickly becomming table stakes for all web sites. Sites are expected to operate over HTTPS for all communication, sensitive or otherwise. Let's encourage use of the broader-reaching `ActionDispatch::SSL` middleware and elminate this source of user confusion. If, for some reason, applications need to expose certain endpoints over HTTP they can do so by properly configuring `config.ssl_options`.
* | | | | | | Make engine check more explicitAndrew White2018-03-251-6/+9
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not everything that responds to `routes` is a Rails engine - for example a Grape API endpoint will have a `routes` method but can't be used with `assert_recognizes` as it doesn't respond to `recognize_path_with_request`. Fixes #32312.
* | | | | | Use ASCII-8BIT paths in ActionDispatch::StaticAndrew White2018-03-226-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rack gem returns PATH_INFO as an ASCII-8BIT encoded string but it was being converted to US-ASCII by the match? method because it was calling Rack::Utils.escape_path. To prevent incompatibile encoding warnings use ASCII-8BIT strings for the root path and let Ruby handle any filename encoding conversion. Fixes #32294, Closes #32314.
* | | | | | Merge pull request #32253 from zwass/before_action_docsRyuta Kamizono2018-03-221-0/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add cancellation info to before filter docs [ci skip]
| * | | | | | Add cancellation info to before filter docsZachary Wasserman2018-03-141-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is important for users to know that a render or redirect in a "before" filter causes the action to be cancelled. This was addressed in the guide, but not the API docs (http://guides.rubyonrails.org/action_controller_overview.html#filters). [ci skip]
* | | | | | | Merge pull request #32293 from dzirtusss/fix-system-tests-transactionsEileen M. Uchitelle2018-03-211-0/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix system tests transactions not closed between examples
| * | | | | | | Fix system tests transactions not closed between examplesSergey Tarasov2018-03-191-0/+1
| | |/ / / / / | |/| | | | |
* / | | | | | Cache url helpers moduleAndrew White2018-03-211-1/+2
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | The urls helpers module returned by Rails.application.routes.url_helpers isn't cached so to prevent the cost of building the module cache it locally.
* | | | | | Don't need to include in the changelog something that was release in 5.2Rafael Mendonça França2018-03-151-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | Check exclude before flagging cookies as secure in ActionDispatch::SSL (#32262)Catherine Khuu2018-03-153-1/+15
|/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Check exclude before flagging cookies as secure. * Update comments in ActionDispatch::SSL. [Catherine Khuu + Rafael Mendonça França]
* | | | | Fix routing inspector tests broken in ↵Kasper Timm Hansen2018-03-131-14/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://github.com/rails/rails/commit/6629d51a2756fadf961bb09df20579cacfef2c8e * Renames grep_pattern to grep throughout. * Fixes setup not calling super by calling setup with a block. * Converts test helper method to a private one, like we have it other places. * Uses keyword arguments to get around awkward draw({ grep: "x" }, Action…) construction.
* | | | | Rely on Rails::Command's help output.Kasper Timm Hansen2018-03-131-26/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We end up with: ``` Usage: bin/rails routes [options] Options: -c, [--controller=CONTROLLER] # Filter by a specific controller, e.g. PostsController or Admin::PostsController. -g, [--grep=GREP] # Grep routes by a specific pattern. -E, [--expanded], [--no-expanded] # Print routes expanded vertically with parts explained. ``` which does miss the bit about routes being printed in order. Also: * Renames options to ease help output readability, then clarifies each option. * Fixes a bunch of indentation.
* | | | | Remove changelog header for unreleased versionRafael Mendonça França2018-03-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We only add the header when releasing to avoid some conflicts. [ci skip]
* | | | | Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-132-52/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130
* | | | | Improve docs of `ActionDispatch::Routing`bogdanvlviv2018-03-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | - Add a mention about `-g`. - Improve info about `--expanded` option of `rails routes`.
* | | | | Merge pull request #32160 from bogdanvlviv/improve-rails-routes-expandedKasper Timm Hansen2018-03-112-6/+20
|\ \ \ \ \ | | | | | | | | | | | | Draw line of a route name to the end of row console on `rails routes --expanded`