"Applied fix from trunk for revision: 1859871"

------------------------------------------------------------------------
r1859871 | jleroux | 2019-05-24 15:24:31 +0200 (ven. 24 mai 2019) | 14 lignes

Fixed: OWASP sanitizer breaks proper rendering of HTML code
(OFBIZ-10187)

After a discussion with Dennis, I checked and the pattern ONSITE_URL would be 
useless without 

.allowAttributes("background").matching(ONSITE_URL)
.onElements("table")
.allowAttributes("background").matching(ONSITE_URL)
.onElements("td", "th", "tr")

So here they are

Thanks: Dennis Balkir for discussion
------------------------------------------------------------------------


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1859873 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2019-05-24 13:27:38 +00:00
parent 1a9943bc4c
commit add8fd7eaf
6 changed files with 35 additions and 31 deletions
@@ -17,7 +17,7 @@ import com.google.common.base.Predicate;
* has been subject to a few complex XSS attacks. Listings are allowed to
* contain much more rich content than, say, Slashdot- so it's attack surface is
* considerably larger. The following tags appear to be accepted by eBay (they
* don't publish rules): {@code <a>},... </blockquote>
* don't publish rules): {@code <a>},...
*/
public class CustomPermissivePolicy implements SanitizerCustomPolicy {
@@ -112,11 +112,15 @@ public class CustomPermissivePolicy implements SanitizerCustomPolicy {
.matching(NUMBER).onElements("table")
.allowAttributes("bgcolor").matching(COLOR_NAME_OR_COLOR_CODE)
.onElements("table")
.allowAttributes("background").matching(ONSITE_URL)
.onElements("table")
.allowAttributes("background").matching(ONSITE_URL)
.onElements("td", "th", "tr")
.allowAttributes("align").matching(ALIGN)
.onElements("table")
.allowAttributes("noresize").matching(Pattern.compile("(?i)noresize"))
.onElements("table")
.allowAttributes("bgcolor").matching(COLOR_NAME_OR_COLOR_CODE)
.allowAttributes("bgcolor").matching(COLOR_NAME_OR_COLOR_CODE)
.onElements("td", "th")
.allowAttributes("abbr").matching(PARAGRAPH)
.onElements("td", "th")