Configure the HTML Sanitizer
XWiki removes from untrusted content every HTML element and attribute it does not know to be safe; xwiki.properties is where that list is adjusted.
Steps
Form elements, iframe and anything that can carry a script are not on that list, so content that legitimately needs one of them is rendered without it. Widening the list, or narrowing it further, is the one thing about the sanitizer you configure, and the threats it closes are described in Attack Vectors.
- Identify what was removed, by reading the HTML the wiki produced for the content that lost it:
curl -s https://wiki.example.org/xwiki/bin/view/Sandbox/WebHome | grep -i iframeThe command prints nothing when the element was sanitized away.
- Stop the XWiki instance, open the xwiki/WEB-INF/xwiki.properties configuration file and set the properties of its "HTML Sanitization" block that your content needs:
# Keep elements and attributes that the built-in list does not have. xml.htmlElementSanitizer.extraAllowedTags = iframe xml.htmlElementSanitizer.extraAllowedAttributes = allowfullscreen # Drop ones that it does have. These win over everything allowed above. xml.htmlElementSanitizer.forbidTags = video, audio xml.htmlElementSanitizer.forbidAttributes = styleEvery name on the first two lines is a hole you choose to open: the sanitizer stops judging it, so anyone who can write wiki syntax or leave a comment can use it.
- Restart the XWiki instance, then reload the page and read its HTML again. What you allowed is now in the output:
<iframe src="https://example.org/map" allowfullscreen></iframe>
FAQ
Why can this not be set in the wiki administration?
The sanitizer reads xwiki.properties alone, through the configuration source that ignores wiki pages. A user who can edit a page must not be able to switch off what sanitizes that page.
Why was a name attribute removed from a div?
name is allowed only on a and map, so that content cannot shadow a property of the page's JavaScript by naming an element after it. XWiki 17.10.10+ xml.htmlElementSanitizer.extraElementRestrictedAttributes widens that list, one attribute per line.
Can a link use a protocol the sanitizer refuses?
xml.htmlElementSanitizer.allowUnknownProtocols is on by default and already allows protocols such as xwiki:; switching it off restricts links to xml.htmlElementSanitizer.allowedUriRegexp. data: URIs are separate, and xml.htmlElementSanitizer.extraDataUriTags names the tags that may carry one.
Does this change the HTML macro's clean parameter?
No. Setting it to false turns the cleaning off for one macro, and using it requires Script right, so it is governed by rights rather than by these settings.