-
Notifications
You must be signed in to change notification settings - Fork 155
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
Proposal: define default for all #189
Comments
I second this, and came here for the same suggestion. I would prefer my features be blacklisted by default and whitelisted as needed. My Feature-Policy header is ridiculously long when I have to explicitly define all of them as I also fear that as time progresses, browsers and devices will add non-standardized features to their feature lists. It will become nearly impossible to blacklist all non-standardized features. |
Same suggestion for me: it could be useful to define a default to |
Just a note to say that this relates to some of the discussion here: #129, where a default for a specific subset of policy controlled features (client hints) was proposed. |
Definately thumbs up for at least possibility of defining default policy, having a (growing) blacklist with no default is insanity.. Even if some feature gets added and then a site with default policy breaks, it is matter of allowing that one policy.. In current form it is impossible to manage every possible new addition by hand. |
We already have some experience with this with iframe sandbox where we are having difficulty adding new directives because they break pages. With FeaturePolicy, it would be a bit different because we can add new directives without having them be part of the default policy, but it's still hard for me to see how we would be able to add new directives over time to the default policy. With iframe sandbox we can at least prioritize it due to the security benefits. It's difficult for browsers to ship things that break web sites, especially since many sites are unmaintained, so the ease of sites fixing when we break them doesn't really mitigate that concern. |
@ojanvafai (and all whom may be concerned) AFAIK What we (at least me) are wanting to have an way to tell desired default policy/policies. So without any default defined standard could very well be "opt-in", but if header has something like default 'none' then honour that and deny everything if not told otherwise.. This way sites not having this header at all will continue to work as is today, and administrators who want's to just blacklist certain things regardless of new possible directives can do so, but it would also allow most concerned admins to introduce an default policy and then whitelist allowed ones. |
@olmari, the problem I see with that proposal is that it makes it far more difficult for Feature Policy to be used to remove features from the platform -- we've done this with synchronous XHR, and are looking at other APIs, like document.write, as features we'd like developers to be able to disable. A I'd love for browsers to be able to experiment with making bigger, more fundamental parts of the platform into policy-controlled features. I'd love for JavaScript, or navigation, to be features that could be disabled in certain contexts, for instance -- if you weren't aware of that, and had set a |
@clelland then you don't just use "default none" policy... I don't know much more clearer I can be on my proposion... Having written no policy would be same as current behaviour. having written default none policy would do just that... All admin configurable... |
@olmari, I realize that you mean for there to be no behaviour changes without explicitly setting the default. The problem that I see is that setting such a default on your site is necessarily a huge risk -- your site would be at far more risk of breaking with future browser revisions than has ever been the case in the past. Although that's probably not the reality of the situation -- in reality, the existence of such an option, especially if it had any significant level of adoption on the web, would mean that browser vendors would be effectively barred from introducing any new features which would break content on all of those sites. Every new feature decision would have to include serious consideration and discussion about the impact to all of the sites which use I do think that I understand the original concern, and the problem with having to specify an ever-growing policy of features to disable. If there were a way to distinguish between "powerful features which you want to think twice about using or granting to frames" from "fundamental features of the web platform", and apply a uniform default to those, then there might be a way to make the proposal work. Without that, it either seems very reckless on the part of the developer, or else severely impacts what kind of features can be defined (which I suspect is the more likely outcome). Alternative strawman proposal: what if there were a way to set the default for all features which have a default allowlist of You could say something like " |
Maybe we could require to set up some kind of a report (see Reporting API) to be able to use |
@valtlai, probably best to Report things that fails because of restricted Feature-Policy header. Would basically be similar to CSP Since Feature-Policy are growing bigger affecting not only sensors access, but also UI like animations, fullscreen, JavaScript, etc., things gets more complicated and I hope will not break Web before spec is fixed or depreciated. For example Has anybody thought how Feature-Policy would be affected by browser settings, if Feature-Policy would overwrite browser settings or opposite (I mean these might all be browser defaults or some manually customized by user)? |
Feature Policy (and CSP, with the @laukstein, I think your other question has to to with permissions -- that screenshot appears to be about setting the default permissions for various APIs. Feature Policy and Permissions do interact, as they affect many of the same features. In general, the Permissions API is about asking the user whether a particular action is okay, while Feature Policy allows the developer to disable features, or to grant them to cross-origin frames. It's a complicated interaction, but essentially both of the APIs have to agree to allow a feature to be used in order to enable it. If either party (user or developer) says no, then the site cannot use the feature. |
I can see this being very useful for endpoints like a REST API (like in #208), which would use precisely zero of those features, and even completely static sites (e.g. readthedocs for said API) would find this useful. Just like with CSP, setting If part of your site suddenly became very broken overnight after a browser update, you know where to start looking (at least, that's my thought flow after having set such a restrictive security policy). For the small number of people who would find it useful to disable everything, they would likely be more aware of what probably caused breakage, should it occur. Even better if the browser console tells them what's breaking the site, like they do with CSP. Reporting would also help with that, whenever that gets added. I don't see the |
I tend to disagree with this, especially on sites as they're developed. Setting the default wouldn't prevent you (the developer) from using any of the APIs, it just means you have to be cognizant that when you add features you are sure to whitelist them. Personally I see this as a huge benefit as a developer to prevent third party scripts and resources from doing things I don't want. From what I've read so far about this proposal the default doesn't have to be A casual example of this (and a straw man so take it in the spirit it's given), is that of embedding a youtube video. If I have a default policy of either Those requests to use functionality are outright frustrating for users when they're not expecting them and I'd much prefer to control that interaction. |
Please implement a default directive. I'm thinking of implementing Feature-Policies on all of my sites but am not willing to name each feature individually. So this is a setting-a-default-is-possible-and-I-adopt-this-header or setting-a-default-is-NOT-possible-and-I-DON'T-adopt-this-header decision for me. Maybe something to consider: This header is meant to be a security filter where additional values are supposedly introduced as needed by individual browser vendors. At the same time you allow default values to be "*" (allow all). This means you are implementing a security filter that works as a blocklist and that has to be modified whenever a vendor introduces a new value. Security filters should work as allowlists so that the person defining it knows exactly what is (going to be) allowed. Or to put it more frankly: Having allow-all defaults is a bad decision. To remedy this bad decision people ask for a functionality to fix this broken design, namely allowing us to set a senseful default value. Edit: More inclusive wording. |
Let me be very clear, this is stupid:
The site has no <script> tags, it is a single html file, without any media of any kind. A restful API is in much the same situation. This kind of blacklisting policy is totally stupid in any security context. Always blacklist all and whitelist just what one wants. Your specification does not allow that. Oh, and I don't want to have to sit down and set such a policy again, or edit it cause a new feature is added that I'm not using anyway. |
I wonder if a good compromise here is to define some 'bundle' policies. On the polyfill service we had the problem of people needing to create a very long string of required polyfills. The first thing we did (very unwisely) was to add an Then we made a So what we ended up with was immutable bundle aliases, eg While this comparison isn't completely perfect, I think the solution we ended up with works well for feature policy: we could have some bundle names like |
I think plain After that, you would enable features using other directives. That way, nothing would break by enlarging the scope of |
I would propose an alternative of requiring a date to be provided and that whenever a feature is implemented it has an associated date. For example we might have the following policies with their dates of addition: foo-bar : 2018/07/27
baz-bar : 2018/01/23
boz-bar : 2020/11/14
// etc Now if an header like so is given by a site: How dates would be associated with a policy wouldn't really matter, all that would really need to be a requirement is that a browser couldn't add a new policy for a date in the past. |
Please keep discussion focused on productive debate of the issues. I've deleted the most recent comment on this issue as it consisted solely of a personal attack, which violates the W3C code of conduct (https://www.w3.org/Consortium/cepc/). Repeated violations will result in being blocked from commenting on the repository. |
Reading through some of the more recent responses it seems like there are two independent groups talking about different meanings of how Originally it was about setting the policy for any features not explicitly otherwise listed in the rest of the feature policy. Specifically, "If my feature policy doesn't mention feature X what policy should be applied". This covers new features that haven't been defined when the policy was configured and prevents having to specify The second camp that has recently started up, seems to be more discussion what the default setting for each feature should be and have it defined by the w3c policy rather than a developer set default. This is along the lines of "use the default feature settings as defined by the w3c as of 2019-02-28". As other have mentioned, this would be a thorny and contentious road. There is likely no good default set that won't hurt sites out there. There likely shouldn't be defaults when the header isn't present as has been done with every other security control based on HTTP headers, and when the header is present it only makes sense to allow the developer to set the default policy for everything, then override specifics. Back to the original feature, the only argument against being able to set a default policy (please correct me if I've missed something) seems to be that a future feature addition might break existing sites that haven't changed. I don't think this will ever be an issue as long as an existing feature is never broken up into more granular features. For example if In any other case, the only time a default setting would break any functionality is when new functionality is being added to the web app that requires a change to the feature policy. In this scenario the web app is actively being changed and the developer will already have to deploy a new version of the code (it's also worth noting that this would be adding new features to the site, not just a minor bug fix release). In this case part of the release of the new version would require the header being updated as well to allow for the new feature. This is the same level of effort as other security mitigations such as CSP headers and I think is completely reasonable. |
Actually my proposed idea doesn't depend on the W3C managing the dates just that a browser never adds a new policy for a date in the past, each browser could manage their own list simply based on commit date or similar. The date would be a "I have checked my site works at this date" hence if a new policy is added it should not affect any page which gives a date before the date of the new policy, this doesn't require browsers to agree or even have any rules around it other than "a date for a new policy must not be in the past". This is why I think the date strategy is feasible and very non-thorny and shouldn't even be contentious. |
Yet another +1 to wanting a default policy setting, just like CSP. How is it considered best practice to individually blacklist an ever growing feature set, rather than whitelist the features you actually want? |
Is there any other way to get the W3C's attention about this? It's been over 5 years and we've been through one header change already (FP → PP) so clearly they either don't care or never even noticed this major design flaw which is costing everyone (interested in compliance) time to maintain the list of features, and bandwidth to send those headers to browsers. A simple |
☝🏻 easily, don't use this proposal, let it die. |
@dimaqq I think I get your point, but I don't think just throwing our hands up will do much either, as we still have to make these things work and abandoning |
I don't think anyone here is talking about the content security policy since it has a sane default policy. The permission policy on the other hand does not which is what we are talking about here. |
Yes, I misspoke. But I still maintain that the abandoning the proposal without an alternative doesn't seem better than this proposal. |
In our case we're forced to output that header in order to pass basic security scans so I can't let it die. :( At best I could reduce the header to almost nothing, but that would defeat the purpose of promising to behave. As it stands, our header has 62 of the 66 known features explicitly disabled and I have to search for new features regularly. I could probably remove some benign stuff to bring it down to 20-30 but I'd still have to regularly hunt for new offenders. There have been several well-designed, backwards-compatible suggestions here these past 6 years and yet not a peep from the W3C to at least acknowledge the issue. They even mention in https://www.w3.org/TR/permissions-policy/ that "The web platform provides an ever-expanding set of features" and yet still maintain that selectively disabling individual features we know about is appropriate. It is somehow the webmaster's responsibility to discover new features as they arise and to add them to an ever-growing deny list in order to correctly promise good behavior and to help deny access to misbehaving third parties (included JS, PunchOut frame parents, etc.) |
The header obviously gets way too big, if you actually want to disable most things. It's just frustrating. This really needs to be finally solved. |
@yannikbloscheck If you read the discussions you cited, you would know that a plain default-deny directive would not be forwards-compatible and is therefore not an option. Defining new meta-directives with specific static inheritance rules is a better option. |
@Seirdy I read your ideas. A default directive would simply leave the choice to the developer though. I can still understand the fears the browser developers have about this in regards to forward-compatibility. Especially as they don't really have to worry about all the extra unnecessary traffic the current solution causes. The browser developers probably would be forced to heavily communicate some new directives and have longer roll-out times. Still any developer worried about having anything break ever could just leave the default directive out or set a very permissive one. The documentation by the browser developers etc. could for example suggest The main thing though is that this has been a problem for over five years. While there has been much discussion about whatever problems might happen with any solution in the future, there has been a real problem (incredible header bloat) in practice for all this time and it isn't getting solved. |
@clelland and I met today and we have a new concrete proposal to allow documents to turn off all features with a default allowlist of 'self':
Name bikeshed:
We are not sure about "third-party", because it implies a lot of other things if you were to read that literally. We kinda like "untrusted" because it reads kinda nice:
|
It's great that this is moving forward, thanks for coming up with this proposal. One question—will browser developers ever want to change the set of permissions that are applied to third-party iframes? Recently they have become more locked down, to reduce cross-site tracking of users. If that trend continues and there is a wish to withdraw some of the permissions we're discussing here, it could lead to divergence between the "untrusted" permissions policy and the permissions that are granted to third-party iframes in practice. I'm genuinely not sure if this is an issue or not, so I will now leave this for people more qualified than I am. 🙂 |
The concern @PeteX raises is one I share and I continue to believe we should not do this therefore. Although it is somewhat painful, it is possible to enumerate all the permissions and disable them. That in turn allows us to make further tweaks to what is allowed in nested documents more easily, such as possibly gating the |
Is it though? I don't know all the permissions on top of my head, and I shouldn't be required to to simply configure my website as a regular one. Moreover, even if I somehow found a somehow comprehensive list like |
But that is the point. Your website might be making use of a feature that the weird permission would gate. If you opted into everything your website would break and end users would be sad. This is a risk we have been willing to take at times for third-party content, but this would extend the risk to every website, making it far less tenable to do. |
I'd argue that if you want to make use of the latest new feature, it's pretty easy to add |
It's really saddening to see that even half a decade later the discussion still evolves around the same thing. As long as this fails open when set, it's not a security header (even though different security scanners started to handle it as such). As long as there's no deny-all possibility, I'll continue to tell everyone off who expects this header to be implemented as a form of security improvement. |
This fails security 101 of The principle of least privilege I therefore hand you a fail in security 101, the idea here is to deny the vast amount of permissions by default thereby gating most of them you can still enable them. I do think they should be a deny all and not just some. The principle of least privilege is not a nice thing, it is how you build secure systems, and developers can always enable to features they use and need. We already need to spin up a local webserver to get a secure context for testing, we are already doing this work. We should have a way to default to none so we can't miss one by mistake, or because browser A implemented something I don't know about because browser B is my prefered browser. If there is a problem I can enable the permission. |
This point has been made, and countless people have voiced their opinion already that it does not apply to them: I want to author a website that is secure and works now. I want it to be secure in the future, but I don't mind if it breaks in the future. If browsers introduce a permission policy for an existing feature that my website is using already, one of the following things will happen:
If somebody doesn't want that to happen to them, they simply don't need to use the proposed deny-all policy. Please just introduce a deny-all permissions policy. It's the sane thing to do. |
I'm sorry! 😢 I posted what was meant to be a question about a minor detail, then went away for the weekend. Coming back it looks as though I've managed to derail this proposal again, which wasn't my intention at all—I actually support it. It's a valid concern that websites might break when new permissions are specified. I think there are solutions, though. Suppose we started with Potentially there would end up being a lot of versions, but that's not a problem. The browser just needs to know which "generation" each permission belongs to; this tells it the version of |
There is nothing inherently wrong with a |
Why are new APIs not denied by default? |
No, I want to deny everything that I've not explicitly asked for, regardless of if that permission exists now or in the future. I know what features the websites I serve up need, they're the ones I enable - I really don't want to continually look out for an ever increasing laundry list of permission features that need disabling. I just can't see how a choice of "deny all except a,b,c features" would manage to break a site in the future, without the website itself changing. At that point I can simply add the needed "x,y,z features" to the directives whitelist and be thankful that I haven't had to waste my time disabling "d,e,f,g,h ... features" in the meantime. Besides, as originally pointed out by OP six years ago, it's how the Content-Security-Policy works and nobody's proposing to change that to this state of affairs. |
@annevk, I think that we can do this safely, and that something shaped roughly like the proposed Permissions-Policy: untrusted is a reasonable way to do it. The model I have is that there are a set of policy-controlled features which, by default, we will deny to cross-origin embedded content, on the basis that we don't trust it. This applies to any cross-origin page loaded into an However, we expect that such embedded content will continue to fundamentally work. We wouldn't choose to put an existing feature under policy-control (like the above-mentioned strawmen 'images' or 'scripts') if we believed that it would break existing embedded content. Any addition like that could only happen after very careful consideration of backwards-compatibility and interop. That's already a promise we have to make, because of existing embedded content, not because of this proposal. This proposal just allows sites to use a header directive to opt in to that same mode for their top-level documents. The risk to the site should be roughly the same as being used as embedded content -- and is actually strictly less, since a site which can set its own headers can also mitigate any breakage by adjusting those headers, unlike a third-party embed. |
I propose
Feature-Policy
adoptContent-Security-Policy
concept and be able to define all default, example:where similarity in CSP would be
Otherwise we would be stuck to define all features separately, and since the features list will grow more and more, without the global default it likely will harmful web.
The text was updated successfully, but these errors were encountered: