-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Control script execution in HTML preview #22103
Comments
@formulahendry We still plan on allowing extensions to execute scripts in the html preview, but this capability also brings up some important security concerns with the current implementation. ProblemOne potential security problem involving the preview is a script injection attack. Script injection is especially bad in the html preview case because the preview is served from the Current WorkWe've made some initial security improvements to the html preview and to the markdown preview that uses it. This includes disabling script execution by default in the markdown preview using a content security policy. However this does help any of the other extensions that are using the html preview. If they accidentally allow an attacker to inject unsanitized html content into the preview, they still open users up to attack. Besides hardening the html preview itself, I'm working better documenting the html preview for extension authors. This will include a section on security best practices. I'm also looking into adding an optional flag in the html preview command that would disable running in the file:// origin. This would likely be an opt-in flag, at least initially. Longer TermWe want to ensure that even if arbitrary scripts can be injected into the html preview, nothing worse can happen to you than if you visited a website in Chrome. Some degree of security responsibility will still fall on extension authors, but we should certainly make exploits like the To achieve this, the first step would be to ensure that the html preview is not in the Benefits
Problems
Work Required How to migrate We may also want to have separate protocol for workspace resources and for extension resources. We may also want to allow certain resources from anywhere, such as images, while disallowing others The other approach would be to spin up a simple web server and have the html preview use this. The web server would have to gate access to local resources properly and the migration for existing extensions is still not clear. TL;DR
|
Cool~ Many thanks for your detailed information. |
As discussed, added security tips documentation with microsoft/vscode-docs#896 and c08ed01 Closing since documenting best practices was the main goal for this month |
No description provided.
The text was updated successfully, but these errors were encountered: