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

CSP 4 feature request: cookie policy #301

Open
AliceWonderMiscreations opened this issue Apr 7, 2018 · 8 comments
Open

CSP 4 feature request: cookie policy #301

AliceWonderMiscreations opened this issue Apr 7, 2018 · 8 comments
Milestone

Comments

@AliceWonderMiscreations
Copy link

I would love it if in CSP-4 a policy could be set regarding third party cookies. Default behavior should be always send (if no policy is set) but I would love the ability to say "Only send third party cookies for these domains" and the browser would simply refuse to send cookies, even if it has them, to any domain not in the white-list when requesting the resources.

It would make me feel a lot more comfortable about using some common CDNs out there like code.jquery.com if I knew for a fact that any cookies my users might have are simply not being sent with the request for jQuery.

The other day I disabled privacy badger to see what the facebook WP plugin was doing on a site I frequent - because the site was http, the iframe for the facebook like button was also http. And included a JS file that contained personal information about me. Sent over HTTP.

The site removed the plugin right away when I told them (I have screenshots from Inspect Element), but the carelessness of trackers is often so profound that I think a CSP 4 directive allowing the web application to specify a whitelist of where cookies may be sent would be of great benefit to users who don't know to install something like Privacy Badger.

As long as default is to send all cookies when there is no policy set, it would be completely backwards compatible.

@dveditz
Copy link
Member

dveditz commented Apr 16, 2018

Would the crossorigin="anonymous" attribute setting for individual elements do what you want? Not quite because it would require more page edits than a page-global policy, but breaking all 3rd party cookies is likely not what you want anyway.

The crossorigin attribute isn't available on all elements (that could be a feature request for the HTML spec), but does already exist for <script>.

@AliceWonderMiscreations
Copy link
Author

Breaking third party cookies is what I want. The problem is that WordPress is not safe to not update, plugins often sneak new trackers in. Symphony has literally nobody checking the integrity of an update, if the developer wants to add trackers they can, etc.

So a policy saying "block third party cookies except from these white-listed domains" can be very beneficial in avoiding surprise tracking after an update. Especially if you have a liberal img-src policy as many sites do.

@annevk
Copy link
Member

annevk commented Apr 17, 2018

Note that setting the crossorigin attribute would also require the response to opt into CORS.

@Malvoz
Copy link

Malvoz commented May 18, 2018

Would the ability to enforce cookie flags such as Secure, HttpOnly, SameSite etc. have to be considered?

@AliceWonderMiscreations
Copy link
Author

I'm not sure. What I'm personally looking for is a way to tell a browser "Only send cookies to third parties if they are in this white list" - kind of like how PrivacyBadger operates but defined by the CSP header rather than requiring the user have privacy badger installed and understand how it works.

The issue I'm trying to deal with is when updates to a webapp plugin (e.g. WordPress) sneaks in a new tracker, which I have seen happen before. Especially with GDPR I think it is important for webmasters to have the ability of defining who their site may be a tracking source for.

@dveditz
Copy link
Member

dveditz commented May 23, 2018

Given your April 16 comment would a site-wide policy be fine? We're discussing wrapping up CSP evolution with CSP-3, and while I'm sympathetic to your use case CSP may not be the best fit. If a site-wide policy is good enough (easier to manage in any case) then the proposed Origin Manifests could be a better place for this. https://github.com/WICG/origin-policy

If you need per-document control then CSP (or a new single-purpose header-based mechanism) is more appropriate.

@Malvoz
Copy link

Malvoz commented May 23, 2018

In w3c/webappsec-permissions-policy#16 it seems it was decided for cookie control to live in origin policy as @dveditz suggested.

@AliceWonderMiscreations
Do you want to open an issue over there?

@andypaicu andypaicu added this to the Future milestone Jun 5, 2018
@AliceWonderMiscreations
Copy link
Author

No issue, I am fine with that, feel free to close as far as I'm concerned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants