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 in single-page applications #519

Closed
MaceWindu opened this issue Oct 10, 2016 · 0 comments
Closed

CSP in single-page applications #519

MaceWindu opened this issue Oct 10, 2016 · 0 comments

Comments

@MaceWindu
Copy link

Correct me if I'm wrong, but as I can see, there is no way now for following scenario to work:

  1. There is a so-called single-page application, which use client-side routing to change current view and interact with server only using AJAX calls to server API.
  2. Application in general have very restrictive CSP
  3. One of routes("pages") of application requires different CSP. E.g. it contains WYSIWYG editor and it must support external/data-uri images, but application in general doesn't allow them.

Because client-routed navigation between pages doesn't request new document, there is no way to provide new CSP for next page.

How could it be workarounded now:

  • Define CSP compatible with all application pages. Leads to too permissive CSP and defeats its purpose.
  • Disable client-sided navigation to/from pages that requires CSP that differ from site-wide CSP. Leads to extra traffic and bad client-side performance (browser needs to reinitialize all that js, SPA-apps are so proud of).

Possible solutions on CSP-spec level:

  • allow to specify multiple policies in single header with URI binding for each policy
  • ???
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

1 participant