aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
Commit message (Collapse)AuthorAgeFilesLines
* Remove 7 years old note-to-self by tenderloveutilum2018-05-221-2/+0
| | | | | | Introduced in rails/journey@a806beb [ci skip]
* Merge pull request #29955 from padi/update_actiondispatch_integration_docsRyuta Kamizono2018-05-041-0/+6
|\ | | | | | | | | Updates documentation on ActionDispatch::Integration::Session#process [ci skip]
| * Updates (rdoc) documentation on ActionDispatch::Integration::Session#processMarc Rendl Ignacio2017-07-271-0/+6
| | | | | | | | | | | | Adds missing information on 2 parameters: +xhr+ and +as+ [ci skip]
* | Add support for prefetch-src directiveyuuji.yaginuma2018-05-031-0/+1
| | | | | | | | | | | | | | Specification: https://w3c.github.io/webappsec-csp/#directive-prefetch-src This directive can already be used as an experimental feature in Chrome. Ref: https://bugs.chromium.org/p/chromium/issues/detail?id=801561
* | Merge pull request #32708 from bdewater/base64-screenshotAndrew White2018-04-241-1/+1
|\ \ | | | | | | Use strict_encode64 instead of gsub newline for ScreenshotHelper
| * | Use strict_encode64 instead of gsub newline for ScreenshotHelperBart de Water2018-04-231-1/+1
| | |
* | | Use the same tag as other views to display the error messageyuuji.yaginuma2018-04-231-1/+1
|/ / | | | | | | | | | | | | | | | | Since other views use the `h2` tag, should also use `h2` on `missing_exact_template.html.erb`. https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb#L5 https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.html.erb#L11 https://github.com/rails/rails/blob/76acaf6eb9ef3635e4c6f2ca9dba34edb50f541d/actionpack/lib/action_dispatch/middleware/templates/rescues/unknown_action.html.erb#L5
* | Fix Style/RedundantReturn offensesBart de Water2018-04-212-2/+2
| |
* | Merge pull request #29286 from vinistock/create_missing_exact_template_exceptionRafael Mendonça França2018-04-203-5/+29
|\ \ | | | | | | | | | Create MissingExactTemplate exception with separate template
| * | Create MissingExactTemplate exception with separate templateVinicius Stock2018-04-203-5/+29
| | |
* | | Merge pull request #32665 from albertoalmagro/fix-typos-filter-parametersRafael França2018-04-201-2/+2
|\ \ \ | | | | | | | | Fix typos related to ActionDispatch::Http::FilterParameters
| * | | [ci skip] Fix doc typos ActionDispatch::Http::FilterParametersAlberto Almagro2018-04-201-2/+2
| | | | | | | | | | | | | | | | Fixes two documentation typos found at ActionDispatch::Http::FilterParameters
* | | | Introduce ActionDispatch::DebugExceptions interceptorsGenadi Samokovarov2018-04-201-1/+23
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Plugins interacting with the exceptions caught and displayed by ActionDispatch::DebugExceptions currently have to monkey patch it to get the much needed exception for their calculation. With DebugExceptions.register_interceptor, plugin authors can hook into DebugExceptions and process the exception, before being rendered. They can store it into the request and process it on the way back of the middleware chain execution or act on it straight in the interceptor. The interceptors can be play blocks, procs, lambdas or any object that responds to `#call`.
* | | Remove unused literal introduced in #32602Andrew White2018-04-181-1/+0
| | |
* | | Pass nonce to CSP policy from outsideAndrew White2018-04-181-31/+24
| | |
* | | Output only one nonce in CSP header per requestAndrey Novikov2018-04-171-17/+30
| | |
* | | 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]
* | | Add WebSocket URI support to CSP DSL mappingsStephen Solis2018-04-121-1/+3
| | |
* | | 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.
* | | 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
* | | Add changelog entry for #32446bogdanvlviv2018-04-061-2/+2
| | | | | | | | | | | | | | | | | | | | | In #32446 was added method `dig` to `session`. Improve docs of method `dig`. [ci skip]
* | | Add #dig to ActionDispatch::Request::Sessionclaudiob2018-04-041-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### 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.
* | | Small doc fixesT.J. Schuck2018-04-021-1/+1
| | | | | | | | | | | | [ci skip]
* | | 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-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #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.
* | | Check exclude before flagging cookies as secure in ActionDispatch::SSL (#32262)Catherine Khuu2018-03-151-1/+3
| | | | | | | | | | | | | | | | | | | | | * Check exclude before flagging cookies as secure. * Update comments in ActionDispatch::SSL. [Catherine Khuu + Rafael Mendonça França]
* | | 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.
* | | Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-131-41/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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-111-1/+10
|\ \ \ | | | | | | | | Draw line of a route name to the end of row console on `rails routes --expanded`
| * | | Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-051-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to get width of console use `IO::console_size`, See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size Related to #32130
* | | | Change doc for "polymorphic_path" in polymorphic_routes.rbMahmoud2018-03-091-2/+1
| | | | | | | | | | | | | | | | | | | | The method 'polymorphic_path' is not using 'polymorphic_url' with `routing_type: :path` anymore in polymorphic_routes.rb
* | | | Quote string return values in doc examples [ci skip]Andrew White2018-03-081-2/+2
| | | |
* | | | Add example of maintaining context with `route_for`Andrew White2018-03-081-0/+6
| | | | | | | | | | | | | | | | [ci skip]
* | | | Merge pull request #32175 from bogdanvlviv/express-route_for-as-public-apiAndrew White2018-03-081-1/+13
|\ \ \ \ | | | | | | | | | | Express `ActionDispatch::Routing::UrlFor#route_for` as public api
| * | | | Express `ActionDispatch::Routing::UrlFor#route_for` as public apibogdanvlviv2018-03-071-1/+13
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This method was added by #28462 but marked as private api. Since `route_for` looks good in pair with `ActionDispatch::Routing::Mapper::CustomUrls#direct` let's make it as public api. We use it in https://github.com/rails/rails/blob/e83575ff533690db86c92447a539d76b648e9fed/activestorage/config/routes.rb Closes #31417
* / / / Allow Capybara 3.x (#32151)Thomas Walpole2018-03-051-1/+1
|/ / /
* | | `ConsoleFormatter` is no longer used as a classRyuta Kamizono2018-03-021-2/+2
| | | | | | | | | | | | It is used as a namespace for `Sheet` and `Expanded`.
* | | Add --expanded option to "rails routes"Benoit Tigeot2018-02-282-38/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using rails routes with small terminal or complicated routes it can be very difficult to understand where is the element listed in header. psql had the same issue, that's why they created "expanded mode" you can switch using `\x` or by starting psql with ``` -x --expanded Turn on the expanded table formatting mode. This is equivalent to the \x command. ``` The output is similar to one implemented here for rails routes: db_user-# \du List of roles -[ RECORD 1 ]---------------------------------------------- Role name | super Attributes | Superuser, Create role, Create DB Member of | {} -[ RECORD 2 ]---------------------------------------------- Role name | role Attributes | Superuser, Create role, Create DB, Replication Member of | {}
* | | Uses the absolute path for system test screenshotsZamith2018-02-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Why: * When getting an error that generates a screenshot it would be helpful to be able to ctrl+click it to quickly open it in the browser, which does not work with relative paths This change addresses the need by: * Changing `image_path` to disregard the relative path and use the absolute one instead
* | | Merge branch 'master' into update_default_hsts_max_ageGuillermo Iguaran2018-02-2415-55/+123
|\ \ \
| * \ \ Merge pull request #32018 from rails/add-nonce-support-to-cspAndrew White2018-02-221-0/+32
| |\ \ \ | | | | | | | | | | Add support for automatic nonce generation for Rails UJS
| | * | | Add support for automatic nonce generation for Rails UJSAndrew White2018-02-191-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the UJS library creates a script tag to process responses it normally requires the script-src attribute of the content security policy to include 'unsafe-inline'. To work around this we generate a per-request nonce value that is embedded in a meta tag in a similar fashion to how CSRF protection embeds its token in a meta tag. The UJS library can then read the nonce value and set it on the dynamically generated script tag to enable it to execute without needing 'unsafe-inline' enabled. Nonce generation isn't 100% safe - if your script tag is including user generated content in someway then it may be possible to exploit an XSS vulnerability which can take advantage of the nonce. It is however an improvement on a blanket permission for inline scripts. It is also possible to use the nonce within your own script tags by using `nonce: true` to set the nonce value on the tag, e.g <%= javascript_tag nonce: true do %> alert('Hello, World!'); <% end %> Fixes #31689.
| * | | | Merge pull request #32032 from utilum/method_redefinedAndrew White2018-02-191-2/+2
| |\ \ \ \ | | |/ / / | |/| | | Avoid method_redefined warnings in RouteSet::NamedRouteCollection
| | * | | Avoid method_redefined warnings in RouteSet::NamedRouteCollectionutilum2018-02-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` ~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb Run options: --seed 5851 .......~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ....~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ..........~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:156: warning: method redefined; discarding old custom_path ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_path was here ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:162: warning: method redefined; discarding old custom_url ~/code/rails/actionpack/lib/action_dispatch/routing/route_set.rb:321: warning: previous definition of custom_url was here ..... Finished in 13.233638s, 1.9647 runs/s, 5.8185 assertions/s. 26 runs, 77 assertions, 0 failures, 0 errors, 0 skips ``` After: ``` ~/.rbenv/versions/2.5.0/bin/ruby -w -Itest -Ilib -I../activesupport/lib -I../actionpack/lib -I../actionview/lib -I../activemodel/lib test/application/routing_test.rb Run options: --seed 38072 .......................... Finished in 12.009632s, 2.1649 runs/s, 6.4115 assertions/s. 26 runs, 77 assertions, 0 failures, 0 errors, 0 skips ```
| * | | | Remove trailing semi-colon from CSPAndrew White2018-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Although the spec[1] is defined in such a way that a trailing semi-colon is valid it also doesn't allow a semi-colon by itself to indicate an empty policy. Therefore it's easier (and valid) just to omit it rather than to detect whether the policy is empty or not. [1]: https://www.w3.org/TR/CSP2/#policy-syntax
| * | | | Revert "Merge pull request #32045 from eagletmt/skip-csp-header"Andrew White2018-02-191-10/+2
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 86f7c269073a3a9e6ddec9b957deaa2716f2627d, reversing changes made to 5ece2e4a4459065b5efd976aebd209bbf0cab89b. If a policy is set then we should generate it even if it's empty. However what is happening is that we're accidentally generating an empty policy when the initializer is commented out by default.