Skip to content

Allow CSP reporting on the same domain #3062

@Eccenux

Description

@Eccenux

Prerequisites

  • I verified that this is not a filter list issue. Report any issues with filter lists or broken website functionality in the uAssets issue tracker.
  • This is NOT an issue with YouTube, Facebook or Twitch.
  • This is not a support issue or a question. For support, questions, or help, visit /r/uBlockOrigin.
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue.
  • The issue is not present after disabling uBO in the browser.
  • I checked the documentation to understand that the issue I am reporting is not normal behavior.

I tried to reproduce the issue when...

  • uBO is the only extension.
  • uBO uses default lists and settings.
  • using a new, unmodified browser profile.

Description

CSP report-uri is blocked and I know this is intentional for 3rd-party requests, but uBO also blocks same-party requests (same domain). I understand concerns about data-leaks when sending CSP reports to a 3rd party sever. That is way I've written my own, simple reporting server... But that still doesn't work for FF+uBO. Note that this is quite important, because I actually encouraged clients to install Firefox with uBlock Origin. I have server stats and they are skewed towards Firefox (more FF users then in general population).

A specific URL where the issue occurs.

http://localhost/_test/CSP-policy-report/

Steps to Reproduce

Steps:

  1. Prepare test HTML with onclick on a local Apache server. Example: CSP report test example.
  2. Add Header set ... "... ; report-uri /_test/csp-report-to/" in .htaccess.
  3. (optional) Add csp-report-to to the same local server.
  4. Open prepared test HTML.

Example .hta:

<IfModule mod_headers.c>

Header set Content-Security-Policy "\
	frame-ancestors 'self'\
	; script-src-attr 'none'\
	; frame-src 'none'\
	; report-uri /_test/csp-report-to/\
"
</IfModule>

This is the fetch request Firefox (Nightly) is doing when uBlock is disabled:

await fetch("http://localhost/_test/csp-report-to/", {
    "credentials": "omit",
    "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0",
        "Accept": "*/*",
        "Accept-Language": "pl,en-US;q=0.7,en;q=0.3",
        "Content-Type": "application/csp-report",
        "Sec-Fetch-Dest": "report",
        "Sec-Fetch-Mode": "no-cors",
        "Sec-Fetch-Site": "same-origin",
        "Pragma": "no-cache",
        "Cache-Control": "no-cache"
    },
    "body": "{\"csp-report\":{...}}",
    "method": "POST",
    "mode": "cors"
});

Expected behavior

uBO should allow 1st party requests for CSP reporting. CSP is crucial for security reasons, and reporting is, in our case at least, a service for our users. Our clients are public libraries, many lacking dedicated IT departments. Small libraries are fortunate if they receive a monthly visit from an IT professional. Our users also include children from primary schools who cannot report problems directly. Therefore, automatic reporting of security issues is essential. Both librarians and children are vulnerable to security problems such as XSS and clickjacking. If something is going on we could block a specific installation, inform librarians and investigate.

Additionally, note that CSP can report issues related to valid usages. Despite blocking our site's usage in an iframe (mostly due to clickjacking prevention), we still want the ability to identify valid use cases that we may consider allowing in the future.

Actual behavior

The CSP request is blocked. Even on the same domain. Even on localhost.

Note that FF itself doesn't block CSP reporting even in enhanced privacy mode.

uBO version

1.55.0

Browser name and version

Firefox Nightly v123.0a1

Operating System and version

Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions