Skip to content
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

Allow TinyMCE to convert safe embed/objects to audio/img/video #16834

Conversation

cedric-anne
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -

TinyMCE recently published 2 security advisories:

By default, we are not impacted by these security issues, but it is still preferable to upgrade to a version that is not marked as vulnerable. For the moment, the 6.8.1+ versions are still considered as vulnerable, but they should probably not, see tinymce/tinymce#9513.

For the vulnerability related to usage of iframe, we already block them unless people set the GLPI_ALLOW_IFRAME_IN_RICH_TEXT to true. In this case, I think we should not set the sandbox_iframes option to true (see https://www.tiny.cloud/docs/tinymce/6/security/#sandbox-iframes-option) as I guess people may sometimes use forms or scripts in their own iframes, and that is probably the reason they are enable them.

For the vulnerability related to usage of object and embed elements, we do not allow them for the moment. I propose to allow them now, as they will be converted to audio/img/video tags when possible, or into iframe tags otherwise thanks to convert_unsafe_embeds. If GLPI_ALLOW_IFRAME_IN_RICH_TEXT is not set to true, the resulting iframe tags will be discarded automatically (once tinymce/tinymce#9516 will be fixed).

I keep this PR as a draft, waiting for tinymce/tinymce#9513 and tinymce/tinymce#9516 to be fixed.

@@ -3851,7 +3851,7 @@ public static function initEditorSystem($id, $rand = '', $display = true, $reado
$cache_suffix = '?v=' . FrontEnd::getVersionCacheKey(GLPI_VERSION);
$readonlyjs = $readonly ? 'true' : 'false';

$invalid_elements = 'applet,canvas,embed,form,object';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove embed and object? That honestly seems tags that should not be used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With convert_unsafe_embeds=true, they will be converted to audio, img or video tags. The purpose is to correctly handle pasting a content from an HTML page that uses object or embed for a media content.

Anyway, this is not mandatory, and cannot be done before tinymce/tinymce#9516 is fixed on TinyMCE side.

@cedric-anne
Copy link
Member Author

See tinymce/tinymce#9513, TinyMCE 6.8.x will never be considered as safe by npm, so this PR is not relevant anymore.

@cedric-anne cedric-anne deleted the 10.0/tinymce-safe-embed branch March 28, 2024 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants