-
Notifications
You must be signed in to change notification settings - Fork 127
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 - Consider static option to avoid unsafe-inline violation #41
Comments
Thank you for pointing this out. Honestly, I didn't think about that at all! What do you mean exactly with "a static option"? Since that code gets injected into the
Both ways are fine, but I am more inclined toward the first one... it should cause less confusion than having two versions of the main JS plugin file. What do you think about that? |
@gasparesganga very good of you to get back to me so quickly. It is sincerely appreciated and the sign of a well maintained plugin! Thank you. I agree you wouldn't want two separate files to maintain. As for the first option,something that runs on first execution should be perfectly fine and is probably more self-contained. A static option was something along the lines of I've since realised I don't even use your styles at all so I'd have no need to even reference the CSS! I could just set the new option and do nothing else. I $.LoadingOverlaySetup({
backgroundClass: 'o-overlay',
fade: [150, 150],
fontawesome: 'fas fa-cog fa-spin o-overlay_spinner',
image: null
}); |
This plugin turned out to be quite popular, so I try to maintain the best way I can :) Yep, I'd reather avoid some code which relies on the loading order, a static method is clearer, more maintainable and cleaner. I will include this change in the upcoming v3 release and the separate CSS is not a problem, since I compose the dist files using Gulp, I will tweak the gulpfile. I'll leave this open and close it with a commit which includes the feature. Feel free to add anything else related to this, I'll work on that in a couple of weeks. Cheers |
Your code injects an inline style into the head on load. I'd like a static option to disable this and ideally for you to provide a CSS file alongside your distributed JS so it can be loaded more appropriately.
I don't think we should be forced to use a CSP value of
style-src 'unsafe-inline'
when using the plugin. What I am proposing is a non-breaking option to skip the following code block:If you don't want the additional overhead of managing a separate CSS file I'd be happy with an option to disable the injection. I'd simply copy the offending CSS to my local file.
The text was updated successfully, but these errors were encountered: