-
Notifications
You must be signed in to change notification settings - Fork 78
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
Unable to load custom external plugin (after applied CSP restrictions) #958
Comments
Seeing the same issue when loading a plugin file hosted in GitHub. Looks like the Content-Security-Policy header was added to https://github.com/jgraph/drawio/blob/master/src/main/webapp/WEB-INF/appengine-web.xml within release 13.1.7. Although in the latest src it's not there (but does get sent when using v13.2.4 online as far as I can see). With the header set it looks like it should be possible to serve a plugin script from Dropbox because dropbox.com is listed within script-src in the Content-Security-Policy header, but if you use a dropbox.com URL then the file is served by Dropbox as text/html so it gets blocked due to a MIME type mismatch. If you use a https://dl.dropboxusercontent.com URL then you can load the file as JS, but then this URL isn't listed in script-src so it gets blocked by the Content-Security-Policy again. Could also serve files from https://raw.githubusercontent.com, but that's only listed in the img-src part of the header, so you can only serve images and not JS scripts from that URL. The one thing I'm not sure of is why I'm still seeing that header returned when using v13.2.4 when it looks to have been removed from the source before that. Maybe it's being set somewhere else. Is it possible to update the Content-Security-Policy header to add https://dl.dropboxusercontent.com and/or https://raw.githubusercontent.com to the script-src part of the header? |
Arbitary JS injected into the app when we host it is becoming more and more of a security concern. We can't really allow those two domains, since anyone could host pretty much anything on them. One workaround for now is to use a draw.io domain with a URL parameter, www doesn't have the CSP applied. But, even then, it will at some point. Our CSP is likely to tighten even further, rather than become more loose, so I would assume the version we host isn't going to be able to use custom plugins in the long term. Is hosting a custom draw.io or using the desktop version an option? |
Thanks for responding @davidjgraph - understood and makes complete sense. I can use www for now. Desktop gives me a 'file already exists' message when I try and load the plugin file there but I'll look at that separately. Thank you, appreciated 👍 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Preflight Checklist
Describe the bug
Unable to load external custom plugin from my own domain
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Load plugin from external URL/domain as it was possible in previous versions (before 13.1.5)
Desktop:
Additional context
I've noticed that in changelog (https://github.com/jgraph/drawio/blob/master/ChangeLog) is specified version 13.1.5 with change "Adds CSP restrictions" which is causing problem described above. But unfortunately, I was unable to find any information how I could overcome this limitation. So, question is simple - What could I do, to be able to load my custom plugin from external URL again? Any URL get parameters or similar? Should I store plugin, somehow, into
https://storage.googleapis.com
orhttps://apis.google.com
?The text was updated successfully, but these errors were encountered: