Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content security policy (CSP) options are ignored in user-defined filter lists #169

Open
eblosug opened this issue Sep 17, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@eblosug
Copy link
Member

eblosug commented Sep 17, 2021

CSP options can modify the header of HTTP(S) responses. For example, the filter rule

||example.com^$csp=script-src 'self' '*' 'unsafe-inline'

Adds the header

Content-Security-Policy: script-src 'self' '*' 'unsafe-inline'

to responses from example.com.

This works for the included EasyLists, but not for user-defined filter lists.

@eblosug eblosug added the bug Something isn't working label Sep 17, 2021
@eblosug
Copy link
Member Author

eblosug commented Sep 17, 2021

Filter lists are divided into categories. Each request/response processor only works on a specific category.

User-defined lists fall into the ADS or TRACKER_BLOCKER category. For example, the TrackingBlockerProcessor asks the FilterManager for the filters in the TRACKER_BLOCKER category.

The filter result of a rule with a CSP option is SET_CSP_HEADER. But the TrackingBlockerProcessor does not do anything with this result.

The ContentSecurityPoliciesProcessor is responsible for adding the CSP header field but it works only on the CONTENT_SECURITY_POLICIES category. User-defined filter lists do not add any rules to this category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant