Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added the
secure_headers
gem to my project as we needed to implement CSP. When configuring the policy, I was going to add thereport-to
directive as it seems thatreport-uri
has been deprecated. I noticed that the gem does not have support for this configuration so decided to add it.All PRs:
Adding a new CSP directive
Is the directive supported by any user agent? If so, which?
Yes, it's supported by all main browsers except Firefox.
What does it do?
It's used to indicate the name of the endpoint that the browser should use for reporting CSP violations. Intends to replace deprecated
report-uri
directive. Browsers should fallback thoreport-uri
ifreport-to
not supported, so it's recommended to set both directives.An array of endpoints is supported. But if more than one endpoint is provided, browser will default to use the first one. I added it to
report-uri
to preserve the scheme, as as far as I checked, there is no restriction on the naming of the endpoint.This directive is directly tied to the Reporting-Endpoints HTTP header, at the moment on my project I'm manually adding the
Reporting-Endpoints
header through the Railsdefault_headers
configuration, I do not know if managing this header through the gem is something on the scope of the gem.Here is the specification for
report-to
.