#94917styles.content.allowTags not working, renderd iframe as <iframe>
Description
I run a small news website. I sometimes put iframe html-code in tx_news articles.
With TYPO3 10.4.19
<iframe src="..."></iframe>
will be transformed into
<iframe src="..."></iframe>
after saving the article in ckeditor.
Since TYPO3 10.4.20, the iframe-code will be saved correctly in the editor. But unfortunately it is still rendering incorrectly on the homepage.
I have following in my template constants. I successfully checked it with TypoScript-Object-Browser.
styles.content.allowTags:= addToList(iframe)
In ckeditor preset yaml i have this (excerpt):
processing:
allowTags:
- iframe
- img
editor:
config:
extraAllowedContent: "iframe,img"
It seems to be an additional problem with htmlSanitize.
Thanks :)
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
Files 2
History 10
-
Oliver Hader commented and changed status
NewNeeds Feedback 08/25/21, 09:18 -
Peter Friesen commented 08/25/21, 11:46
Many thanks for the answer. I understand the problem of allowing unchecked iframes. In my case it is not a problem because only I enter the content. Of course it would be great if html-sanitizer supports iframe. I’ll try the solution with Behavior\Tag(). Thank you!
-
Reindl Bernd commented 09/21/21, 09:50
I have the same problem with and <map>…</map>.
Overriding a class is not a good solution. What happens if more than one extension want to add a Behavior.
Why didn’t make this configurable via TypoScript?
So the page admin (And extension developer) can configure the sanitizer. -
Oliver Hader commented 11/08/21, 11:36
Reindl Bernd wrote in #note-3:
> I have the same problem with and <map>…</map>.
>
> Overriding a class is not a good solution. What happens if more than one extension want to add a Behavior.
> Why didn’t make this configurable via TypoScript?
> So the page admin (And extension developer) can configure the sanitizer.Can those image map items be declared as rich-text content within CKEditor (or similar)? If not, please consider moving them out of
<f:format.html>sections (or whatever triggers sanitization of that part of your templates, see https://github.com/TYPO3/html-sanitizer/issues/23).Existing capabilities of TypoScript
HTMLparserwere not sufficient to declare secure/allowed markup nodes – that’s why packagetypo3/html-sanitizerhas been integrated to have a strict handling to avoid cross-site scripting.→ please see my comments at https://github.com/TYPO3/html-sanitizer/issues/70#issuecomment-963059852 demonstrating how easy it is to have insecure TypoScript settings
-
Reindl Bernd commented and changed attached clipboard-202111081500-osztj.png attached clipboard-202111081501-zlppo.png 11/08/21, 14:05
They are not inside <f:format>.<br>The <map> tag is inside a partial which is called by a FLUIDTEMPLATE</map></f:format>
clipboard-202111081500-osztj.png
clipboard-202111081501-zlppo.png
It wasn’t like this before 10.4.20. It seems that since 10.4.20 the whole FLUIDTEMPLATE is parsed with html-sanitizer.
Best regards
BerndOliver Hader wrote in #note-4:
> Reindl Bernd wrote in #note-3:
> > I have the same problem with and <map>…</map>.
> >
> > Overriding a class is not a good solution. What happens if more than one extension want to add a Behavior.
> > Why didn’t make this configurable via TypoScript?
> > So the page admin (And extension developer) can configure the sanitizer.
>
> Can those image map items be declared as rich-text content within CKEditor (or similar)? If not, please consider moving them out of<f:format.html>sections (or whatever triggers sanitization of that part of your templates, see https://github.com/TYPO3/html-sanitizer/issues/23).
>
> Existing capabilities of TypoScriptHTMLparserwere not sufficient to declare secure/allowed markup nodes – that’s why packagetypo3/html-sanitizerhas been integrated to have a strict handling to avoid cross-site scripting.
>
> → please see my comments at https://github.com/TYPO3/html-sanitizer/issues/70#issuecomment-963059852 demonstrating how easy it is to have insecure TypoScript settings -
Oliver Hader changed Related to #95903 11/15/21, 20:45
-
Oliver Hader changed
Related to #9590311/15/21, 20:45 -
Oliver Hader changed Duplicated by #95903 11/15/21, 20:45
-
Oliver Hader commented 01/14/22, 10:39
I’ve created a pull-request at https://github.com/TYPO3/html-sanitizer/pull/74 which actually would allow
iframe– currently in custom sanitizer scenarios – relying on the mandatorysandboxattribute. -
Georg Ringer commented and changed status
Needs FeedbackClosed 06/05/24, 11:08nothing to do, closing issue
The scope of recent updates with HTML sanitizer were to avoid cross-site scripting,
allowTags = iframeallowed the whole tag, without further restricting element attributes. As a result, the following scenarios were possible and considered cross-site scripting:<iframe src="javascript:alert(1)"></iframe> <iframe src="/anything.html" onload="alert(2)"></iframe>Possible changes for local site
In case you are the only one submitting content to that site, you most probably can disable HTML sanitizer by corresponding feature flag
security.frontend.htmlSanitizeParseFuncDefaultcompletely – or adjust processing for that corresponding news template or TypoScript configuration.→ see https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.5.x/Important-94484-IntroduceHTMLSanitizer.html
Alternatively, you also could override the default builder and add
Behavior\Tag('iframe')with corresponding attributes you’re using.→ see https://gist.github.com/ohader/2239dab247e18d23e677fd1b816f4fd5 as an example
Add
iframein HTML sanitizerThe overall goal in HTML sanitizer is to avoid cross-site scripting – just allowing
iframewithout further restrictions and corresponding manual tests would contradict the goals in general. However, it is of course possible to do that – it’s work, it just requires time and more automated test-cases.