-
Notifications
You must be signed in to change notification settings - Fork 87
Content Security Policy compliant JS #24
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
Conversation
1 similar comment
|
@mschwager Thanks for the pull, I'll review and merge ASAP! |
libs/csrf/csrfprotector.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally when the config file is changed the main js file is automatically changed, that's what self::createNewJsCache(); LINE#202 does. Now if due to file permission error it fails, we had to insert the urls inline so that the system doesn't fail.
So insert this hidden field only when say count($urls) > 0. Also JS should try to retrieve urls from the hidden field only when the hidden field is available.
Initiating the init() on onload event is good, and we need to be compliant with CSP rules.
…nt of check URLs.
|
Currently how it works is, when ever the config file is changed, the library creates a new version of js code (
Now putting these data to HTML code and picking them from JS code seems a nice idea but we'd have to hardcode identifiers of those hidden fields which clashes with second advantage we had in current method. But this removes other overhead - So now we have lot of options: @abiusx how about a suggestion? |
|
@mschwager I have merged your pull to a maser-dev branch. I have made further changes and soon push it to master. |
Hey,
I moved some of the JS code around to be compliant with CSP: https://en.wikipedia.org/wiki/Content_Security_Policy
Which doesn't allow inline JS: http://www.html5rocks.com/en/tutorials/security/content-security-policy/#inline-code-considered-harmful