| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Follow up of #32605.
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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`.
|
|
|
|
|
| |
This autocorrects the violations after adding a custom cop in
3305c78dcd.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
The `Capybara.server=` proc acceptance restored in Capyara 3.0.1.
Ref: https://github.com/teamcapybara/capybara/commit/8f115d94e035eca992036f16e50c1dce5f555c97
|
|
|
|
|
|
|
| |
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
|
|\
| |
| | |
Add custom RuboCop for `assert_not` over `refute`
|
| |
| |
| |
| |
| |
| | |
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!
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
### 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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* Check exclude before flagging cookies as secure.
* Update comments in ActionDispatch::SSL.
[Catherine Khuu + Rafael Mendonça França]
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|\
| |
| | |
Draw line of a route name to the end of row console on `rails routes --expanded`
|
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| | |
If the app has the CSP disabled globally allow a controller action
to enable the policy for that request.
|
|/
|
|
|
|
|
|
| |
e.g:
class LegacyPagesController < ApplicationController
content_security_policy false, only: :index
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 | {}
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| | |
`Rails.application.config.content_security_policy` is configured with no
policies by default. In this case, Content-Security-Policy header should
not be generated instead of generating the header with no directives.
Firefox also warns "Content Security Policy: Couldn't process unknown
directive ''".
|
| | |
|
| |
| |
| |
| |
| | |
Before, if the application defined after an engine this method would not
recognize the route since it was not defined insdie the engine.
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
It makes sense to be as strict as possible
with headers from the outside world,
but allowing @ to support Apache's mod_unique_id
(see #31644) seems OK to me
|
| | |
|
| | |
|
| | |
|
| |\
| | |
| | | |
Move browser config to its own class
|
| | | |
|
|/ /
| |
| |
| |
| | |
- Update the default HSTS max-age value to 31536000 seconds (1 year)
to meet the minimum max-age requirement for https://hstspreload.org/.
|
| | |
|
|/
|
|
|
|
|
|
|
|
| |
These assertions did matter due to the inconsistent behavior of
[the #parameters method][1]. Today, it behaves consistently and they
could be removed. Also, one of the methods was stubbed somewhat
incorrectly, so it is better not to stub and instead, make them close
to more realistic use cases.
[1]: https://github.com/rails/rails/pull/13999#issuecomment-34601746
|
|
|
|
| |
Follow up of #31432.
|
|
|
|
| |
Follow up of #31390.
|
|
|
|
| |
haven't specified manually another server.
|
|
|
|
| |
default headers set.
|
| |
|
|
|
| |
Use Object#deep_dup to safely duplicate policy values
|
| |
|
|\
| |
| |
| |
| | |
mikeycgto/actiondispatch-cookie-store-test-updates
Update cookie_store_test to use encrypted cookies
|
| |
| |
| |
| |
| |
| |
| | |
This now modernizes these tests to use encrypted cookies instead of
using secret_token HMACs. This commit also adds a tests to ensure
session cookies with :expires_after set are invalidated and no longer
accepted when the time has elapsed.
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Not everyone uses iTerm2 and whereas Terminal.app on a mac just ignores
that and outputs the path, other terminals like those on Ubuntu do not.
A friendlier default is one that works by default.
Closes #31159
Closes #30957
|
| | |
|