Skip to content

Commit 635dcd2

Browse files
committed
DOC-3147: New allow_html_in_comments option to allow HTML-like content inside comment data.
1 parent b3a9cdd commit 635dcd2

File tree

4 files changed

+57
-4
lines changed

4 files changed

+57
-4
lines changed

modules/ROOT/pages/8.0-release-notes.adoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
= {productname} {release-version}
32
:release-version: 8.0.0
43
:navtitle: {productname} {release-version}
@@ -110,10 +109,12 @@ For information on using Enhanced Skins & Icon Packs, see: xref:enhanced-skins-a
110109

111110
{productname} {release-version} also includes the following addition<s>:
112111

113-
// === <TINY-vwxyz 1 changelog entry>
114-
// #TINY-vwxyz1
112+
=== New `allow_html_in_comments` option to allow HTML-like content inside comment data
113+
// #TINY-12220
115114

116-
// CCFR here.
115+
Previously, comments containing HTML-like content were removed from the editor's content by default for security reasons. This was done using DOMPurify's `SAFE_FOR_XML` option, which ensures that any HTML-like content in comments is stripped out.
116+
117+
{productname} introduces a new configuration option, xref:content-filtering.adoc#allow_html_in_comments[allow_html_in_comments], to give users control over whether HTML-like content in comments should be retained or removed. By default, this content is removed for security, but setting the option to `true` allows HTML-like content in comments to be preserved when needed.
117118

118119

119120
[[changes]]

modules/ROOT/pages/content-filtering.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
include::partial$configuration/allow_conditional_comments.adoc[]
77

8+
include::partial$configuration/allow_html_in_comments.adoc[]
9+
810
include::partial$configuration/allow_html_in_named_anchor.adoc[]
911

1012
include::partial$configuration/allow_mathml_annotation_encodings.adoc[]

modules/ROOT/pages/security.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ include::partial$configuration/sandbox_iframes.adoc[]
113113

114114
include::partial$configuration/convert_unsafe_embeds.adoc[]
115115

116+
include::partial$configuration/allow_html_in_comments.adoc[]
117+
116118
[[insecure-transmission-and-storage-of-data]]
117119
=== Insecure Transmission and Storage of data
118120

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
[[allow_html_in_comments]]
2+
== `allow_html_in_comments`
3+
4+
The `allow_html_in_comments` option allows HTML-like content to be retained in comments within the editor content. By default, {productname} removes comments containing HTML-like content as a security measure (using DOMPurify's `SAFE_FOR_XML` option).
5+
6+
*Type:* `+Boolean+`
7+
8+
*Default value:* `+false+`
9+
10+
[WARNING]
11+
Setting this option to `true` may expose your application to XSS vulnerabilities. The DOMPurify maintainers have identified potential security risks when HTML-like content is allowed in comments. Only enable this option if you trust your content sources and understand the security implications.
12+
13+
=== Example: using `allow_html_in_comments`
14+
15+
The following example demonstrates how comments containing HTML are handled by default (removed) and how to configure {productname} to retain them:
16+
17+
[source,js]
18+
----
19+
tinymce.init({
20+
selector: 'textarea',
21+
allow_html_in_comments: true, // Enable HTML in comments
22+
});
23+
----
24+
25+
ifeval::["{docname}" != "security"]
26+
=== Comment behavior examples
27+
28+
With `allow_html_in_comments: false` (default), the editor's content after initialization will be:
29+
[source,html]
30+
----
31+
<section>
32+
<h1>Some content</h1>
33+
<h1>Some additional content</h1>
34+
</section>
35+
----
36+
37+
With `allow_html_in_comments: true`, the editor's content after initialization will be:
38+
[source,html]
39+
----
40+
<section>
41+
<h1>Some content</h1>
42+
<!--
43+
<div>This is my comment content</div>
44+
-->
45+
<h1>Some additional content</h1>
46+
</section>
47+
----
48+
endif::[]

0 commit comments

Comments
 (0)