Skip to content

Content Security Policy blocked #23

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

Closed
malz1987 opened this issue Jun 9, 2017 · 6 comments
Closed

Content Security Policy blocked #23

malz1987 opened this issue Jun 9, 2017 · 6 comments
Assignees

Comments

@malz1987
Copy link

malz1987 commented Jun 9, 2017

jquery-ajax-unobtrusive is blocked by CSP in line:
return Function.constructor.apply(null, argNames);
"Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'"."

In according to this site https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/Firefox_OS_apps/Building_apps_for_Firefox_OS/CSP
The function constructor is banned

@mkArtakMSFT
Copy link
Member

Thanks for contacting us, @szefik1987. One of our team members will look into it and get back to you.

@mkArtakMSFT
Copy link
Member

@javiercn, can you please look into this and see what other options can be applied here?

@javiercn
Copy link
Member

We can't do anything here. Essentially what the code is doing is building a function on the fly (a form of eval) that is being disallowed by CSP.
That form of eval is required for supporting writing expressions in the ajax related data-ajax-* attributes like data-ajax-begin, for example:

<form ... data-ajax-complete="$(this).hide()">
...
</form>

The alternative would require to either deprecate allowing expressions on the attributes or doing significant re-engineering to build all these expressions before-hand and emit proper functions for them on a script tag at the end of the page, which would likely, also have to be attributed with a nonce to bypass csp validation.

@mkArtakMSFT
Copy link
Member

Closing this as the amount of work required to fix this is not worth the effort.

@KarsonAlford
Copy link

KarsonAlford commented Mar 20, 2019

Related to Issue #49.

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

No branches or pull requests

5 participants
@malz1987 @KarsonAlford @javiercn @mkArtakMSFT and others