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

Disabling JavaScript #25

Open
NickColley opened this issue Feb 20, 2020 · 3 comments
Open

Disabling JavaScript #25

NickColley opened this issue Feb 20, 2020 · 3 comments

Comments

@NickColley
Copy link

Hello,

We're interested in this work and wondering if it'll be possible to disable JavaScript.

We have some examples in iframes within our GOV.UK Design System website that it would be useful to be able to prevent JavaScript from running conditionally.

https://design-system.service.gov.uk/patterns/addresses/

We'd also find it useful to do this so we can test our progressive enhancement approach and finally it might also be useful for performance reasons.

For example if we had this we could easily show the difference between a component when it's run with JavaScript and without.

@craigfrancis
Copy link

I think I would like this as well, but how would this be different from:

Content-Security-Policy: script-src 'none';

@mozfreddyb
Copy link

…or Content-Security-Policy: 'sandbox'

@clelland
Copy link
Collaborator

The best reason for supporting something like this is the disable-everything-by-default nature of sandbox. It would be about equivalent to

Content-Security-Policy: sandbox allow-same-origin allow-top-navigation
    allow-forms allow-popups allow-pointer-lock allow-modals
    allow-popups-to-escape-sandbox allow-orientation-lock allow-presentation
    allow-top-navigation-by-user-activation allow-storage-access-by-user-activation
    allow-downloads

(Basically every sandbox directive except allow-scripts)

There was a plan to support all of the sandbox attributes with feature policy, and eventually be able to replace sandbox with FP, or make it a shortand for a set of "sandbox best practies", but there are a couple of issues -- the biggest one being that the behaviour in popups is very different between permission-based features and sandbox features.

What I would love to do, and have been spending a lot of time thinking about, is to add sandbox directives to Document Policy. It was designed with that use case in mind, and would probably be a better fit.

In that case, you could disable scripting for a single document with

Document-Policy: no-scripts

Or you could also disable it for every site embedded within that document as well, with

Require-Document-Policy: no-scripts

That would be equivalent to just adding the single sandbox flag, without having to add sandbox and then remove them individually.

@clelland clelland transferred this issue from w3c/webappsec-permissions-policy Dec 1, 2020
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

4 participants