返回介绍

Security

发布于 2019-05-06 06:49:49 字数 2189 浏览 1125 评论 0 收藏 0

Q: Is TinyMCE protected against XSS vulnerabilities?

TinyMCE filters out some of the more common XSS content like scripts from the content since it is common that the editor is used in a single page application. For additional security, consider passing it through server-side filters like HTMLPurifier.

Q: How do I setup Content Security Policy (CSP) with TinyMCE?

You can use TinyMCE with a CSP header, however, there are a few things that need to be enabled for the editor to function properly:

Here is a list of the directives that are required by TinyMCE and why they are required:

DirectivesRequirements
script-src ‘self’ *.tinymce.com;Scripts are sometimes loaded as script element with an src attribute.
connect-src ‘self’ *.tinymce.com;XMLHttpRequest are required by some services such as spellchecking.
img-src ‘self’ *.tinymce.com data: blob:;Images within the editor are sometimes base64 encoded or blob URLs or proxied through the cloud service.
style-src ‘self’ ‘unsafe-inline’;Styles are used on dialogs/menus to position them relative to other elements.
font-src ‘self’ *.tinymce.com;Fonts are used for icons in the UI and is loaded from external files.

You can use this CSP header when served from the cloud:

<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self' *.tinymce.com *.tiny.cloud; connect-src 'self' *.tinymce.com *.tiny.cloud; img-src 'self' *.tinymce.com *.tiny.cloud data: blob:; style-src 'self' 'unsafe-inline' *.tinymce.com *.tiny.cloud; font-src 'self' *.tinymce.com *.tiny.cloud;" />

You can use this CSP header when served from a local domain excludes the *.tinymce.com domain:

<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; font-src 'self';" />

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文