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

Proposal: Document-Policy available via pragma directive #36

Open
issacgerges opened this issue Aug 3, 2021 · 2 comments
Open

Proposal: Document-Policy available via pragma directive #36

issacgerges opened this issue Aug 3, 2021 · 2 comments

Comments

@issacgerges
Copy link

Similar to Content-Security-Policy, Document-Policy should be settable via a meta tag in the head, such as

<meta http-equiv="Document-Policy" content="js-profiling">

This would make it easier for statically served sites (where customization of HTTP headers may be more painful) to opt-in. This would require changes to https://html.spec.whatwg.org/multipage/semantics.html#pragma-directives

@nornagon
Copy link

This would also make it easier to test out / use the JS self-profiling API in local development, e.g. when serving with python -mSimpleHTTPServer or npx serve, or when serving from file://.

@bathos
Copy link

bathos commented Apr 29, 2022

I’ve found pragma directives significantly increased the fraction of loads where our CSP actually gets applied as authored, fwiw. Stripping or falsifying content-security-policy & x-frame-options headers has become a normal practice in the chrome/ff extension ecosystem even in cases where an extension’s behavior can be realized without doing this. Given extensions also tend to like running sync-xhr in the origin realm (synchronization primitive for the background page? not sure), if document-policy’s adoption increases, it could become another inconvenience and end up in the same boat.

I appreciate that dynamically narrowing policies likely implies considerable spec / implementation complexity and it’s understandable if it’s not deemed worthwhile on balance. However the web’s “opt-in” security / integrity / quality policies can feel a bit hopeless once you begin paying attention to what actually arrives in the browser.

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

3 participants