55632[WIP][FEATURE] Sanitize HTML markup by whitelist
Commit message
Review
-
Code review CR 0
-
Verified V 0
Files 2
Review log 912
-
Mathias Schreiber uploaded patch set 1 02/09/18, 17:36
-
TYPO3com voted on patch set 1 V -1 02/09/18, 17:37 Completed build in 10s on Fri, 9 Feb, 06:37 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19204
-
Mathias Schreiber uploaded patch set 2 02/09/18, 17:38
-
TYPO3com voted on patch set 2 V +1 02/09/18, 17:46 Completed build in 08m 12s on Fri, 9 Feb, 06:46 PM Test Summary: 30485 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19205
-
Mathias Schreiber uploaded patch set 3 02/09/18, 20:17
-
TYPO3com voted on patch set 3 V +1 02/09/18, 20:36 Completed build in 18m 41s on Fri, 9 Feb, 09:36 PM Test Summary: 30494 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-19226
-
Helmut Hummel commented on patch set 3 CR -2 02/12/18, 11:17
This needs further discussions -
Mathias Schreiber commented on patch set 3 02/12/18, 11:42
I tend to NOT have this centrally but as part of EXT:form. The original request originated from there. The benefit of not having it as central API is that we reduce the amount of usecases we need to cover and gives us the possibility to say "no" to certain wishes (imagine someone asking for onclick()) :) I'm up for a chat, call any time soon. -
Helmut Hummel commented on patch set 3 02/12/18, 11:44
StringUtility.php:122such functionality deserves its own class, maybe even its own libraryStringUtility.php:131strip_tags had flaws in its implementation in the past. it should be checked if recent php versions covered them (should be that case)StringUtility.php:136XML entity expansion vulnerability needs to be checked. also maybe enforce the user input to be strict xml and loadXML. (currently don't know what the security implications are for using either of those)StringUtility.php:142I don't understand this guard, but it looks dangerous, as it returns user input as isStringUtility.php:158this final operation looks dangerous as well. could be that it can be exploited so that payload with with these substrings enables XSSStringUtility.php:173this is in fact a blacklist. it shows that whitelisting the wrong attributes can still lead to xss. we need a way to communicate this, maybe throwing an exception instead, having default white lists in confuguration ≥ -
Mathias Schreiber commented on patch set 3 02/12/18, 11:55
StringUtility.php:122ReplyJup, personally I think we should NOT have it as central API but just as part of EXT:form.StringUtility.php:131ReplyWe could remove the strip tags entirely and reply on \DomDocument to do all parsing. My idea was just to have a fast way of getting rid of unwanted tags. Is the issue the tag whitelist of strip_tags or is strip_tags in itself the problem?StringUtility.php:136ReplyGiven the intended usecase (adding a little HTML flavor to labels in Forms), I think $oldValue = libxml_disable_entity_loader(true); $dom = new DOMDocument(); $dom->loadXML($xml); libxml_disable_entity_loader($oldValue); can be used here.StringUtility.php:142Replyif you feed non-html code into \DomDocument it will wrap the input in this code so the output is the minimal viable HTML.StringUtility.php:173Replymy idea is that IF people ask for href or src (there might be more attributes that load remote data, these are the ones that came to my mind), we could hand over the attribute value to TYPO3 LinkService. That way link validation would be in a central place and the form editor could be extended with a link picking UI if necessary. -
Oliver Hader commented on patch set 3 CR -2 02/19/18, 11:36
Not gonna happen this way. Having a very specific custom solution for ext:form only does not make sense. -
Mathias Schreiber abandoned the change 02/19/18, 18:13
noone is interested in this approach, hence abandoning it