-
Notifications
You must be signed in to change notification settings - Fork 45
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
Remove inline event listeners to support CSP environment #614
Conversation
Would it be possible to have our build pipeline convert inline handlers to statements like that? That'd kinda give us the best of both world. I'd assume we're not the only ones who are trying to do this, so I wouldn't be surprise if there was a webpack plugin or something? |
Adding to the above, it seems that react 15 already does something about it, at least when it comes to style tags: facebook/react#5878 |
Looking at the actual changes, it's quite clear to me that I've no idea what all this EDBML stuff is :) I did, however, notice that you're specifying |
[1] You said on Slack that "The only thing we really care about is getting rid of inline JS and Again I suggest that the gradual migration of all the apps from zero policy to full policy should be avoided if possible given that |
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.
@wiredearp is this code ready to merge or are there more changes required to make it work as is?
@sampi Should be ready as in did pass our own tests (at some point) and looks good on the docs website, but smoke tests are as usual an open question. |
@zdlm @sampi @ehats
The minimum viable amount of quickfixes that at least in theory should make it possible to enable a (fairly liberal) Content Security Policy on the entire platform. We have been a blocker for getting this project off the ground, since Tradeshift UI runs on all pages.
There was also some random fixes to the docs pages.
Our target CSP aims to disable all inline JavaScript and this means that it is not enough to fix the framework (with this proposed PR). For use on the platform, it will also be required to update the implementation in all the apps so that this:
— becomes replaced by this:
— which in other words involves moving the business logic from the HTML view to some kind of JS file 😕
Apart from providing a better fit for the Angular or React way of life, where inline event listeners are the norm, it was also thought that inline event listeners would better support a scenario where the elements(s) get destroyed and created at random by the hosting framework. Now that the
onclick
statement is no longer expressed in the HTML, but instead as a method on the DOM element, Angular might in other words replace the active element with an inactive element, simply because that would be typical for Angular to do such a thing. It remains to be seen if this will actually happen in real life smoke tests.