You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implements support for the W3C Reporting API (https://w3c.github.io/reporting/)
to enable standardized browser reporting for security violations and other issues.
Changes include:
1. New Reporting-Endpoints Header:
- Added ReportingEndpoints header class to configure named reporting endpoints
- Accepts hash configuration: { default: "https://example.com/reports" }
- Generates header: Reporting-Endpoints: default="https://example.com/reports"
2. CSP report-to Directive:
- Added report_to directive to Content Security Policy
- New :string directive type for single token values
- Positioned before legacy report-uri directive for clarity
3. Configuration Updates:
- Registered reporting_endpoints in CONFIG_ATTRIBUTES_TO_HEADER_CLASSES
- Added report_to to DIRECTIVES_3_0 (CSP Level 3)
- Updated NON_FETCH_SOURCES to include report_to
4. Tests:
- Complete test coverage for ReportingEndpoints header
- CSP tests for report-to directive
- Integration tests for both headers working together
5. Documentation:
- Added W3C Reporting API section to README
- Usage examples for both modern and legacy browser support
- Configuration examples showing endpoint definition and CSP integration
Addresses issue #512
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
- expect-ct - Only use certificates that are present in the certificate transparency logs. [expect-ct draft specification](https://datatracker.ietf.org/doc/draft-stark-expect-ct/).
18
18
- clear-site-data - Clearing browser data for origin. [clear-site-data specification](https://w3c.github.io/webappsec-clear-site-data/).
19
+
- reporting-endpoints - Configure endpoints for the W3C Reporting API. [Reporting API specification](https://w3c.github.io/reporting/).
19
20
20
21
It can also mark all http cookies with the Secure, HttpOnly and SameSite attributes. This is on default but can be turned off by using `config.cookies = SecureHeaders::OPT_OUT`.
21
22
@@ -54,6 +55,9 @@ SecureHeaders::Configuration.default do |config|
The [W3C Reporting API](https://w3c.github.io/reporting/) provides a standardized way to receive browser reports about security violations, deprecations, and other issues. To use it, you need to configure two things:
119
+
120
+
### 1. Reporting-Endpoints Header
121
+
122
+
Define named endpoints where reports should be sent:
**Note:** Modern browsers using the Reporting API will send reports in a different format than legacy `report-uri`. Your reporting endpoint should be able to handle both formats.
168
+
111
169
## API configurations
112
170
113
171
Which headers you decide to use for API responses is entirely a personal choice. Things like X-Frame-Options seem to have no place in an API response and would be wasting bytes. While this is true, browsers can do funky things with non-html responses. At the minimum, we suggest CSP:
0 commit comments