You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2023/01/25 16:18:31 UTC

[sling-org-apache-sling-xss] branch master updated: SLING-11763 All 'style' properties stay preserved in the HTML output (#31)

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-xss.git


The following commit(s) were added to refs/heads/master by this push:
     new d6c1c62  SLING-11763 All 'style' properties stay preserved in the HTML output (#31)
d6c1c62 is described below

commit d6c1c625f88e8199cf7aa0b6e36af1ee714f13c2
Author: Tatyana <36...@users.noreply.github.com>
AuthorDate: Wed Jan 25 17:18:26 2023 +0100

    SLING-11763 All 'style' properties stay preserved in the HTML output (#31)
---
 src/main/java/org/apache/sling/xss/impl/xml/Property.java       | 2 +-
 src/test/java/org/apache/sling/xss/impl/AntiSamyPolicyTest.java | 4 ++++
 src/test/java/org/apache/sling/xss/impl/XSSAPIImplTest.java     | 1 +
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/xss/impl/xml/Property.java b/src/main/java/org/apache/sling/xss/impl/xml/Property.java
index cdf8f9e..be4261f 100644
--- a/src/main/java/org/apache/sling/xss/impl/xml/Property.java
+++ b/src/main/java/org/apache/sling/xss/impl/xml/Property.java
@@ -53,7 +53,7 @@ public class Property {
     @JsonCreator
     public Property(@JacksonXmlProperty(localName = "name", isAttribute = true) String name,
             @JacksonXmlProperty(localName = "regexp") List<Regexp> allowedRegexps,
-            @JacksonXmlProperty(localName = "literal") List<Literal> allowedValue,
+            @JacksonXmlProperty(localName = "literal") List<Literal> literalList,
             @JacksonXmlProperty(localName = "shorthand") List<Shorthand> shortHandRefs,
             @JacksonXmlProperty(localName = "description", isAttribute = true) String description,
             @JacksonXmlProperty(localName = "onInvalid", isAttribute = true) String onInvalidStr,
diff --git a/src/test/java/org/apache/sling/xss/impl/AntiSamyPolicyTest.java b/src/test/java/org/apache/sling/xss/impl/AntiSamyPolicyTest.java
index 6626417..447c899 100644
--- a/src/test/java/org/apache/sling/xss/impl/AntiSamyPolicyTest.java
+++ b/src/test/java/org/apache/sling/xss/impl/AntiSamyPolicyTest.java
@@ -200,6 +200,10 @@ public class AntiSamyPolicyTest {
 
     static TestInput[] dataForCSSFiltering() {
         return new TestInput[]{
+                new TestInput("<p style=\"border-color: transparent\"> Border Color </p>", "border-color: transparent", true),
+                new TestInput("<p style=\"text-align: right\"> Text Align </p>", "text-align: right", true),
+                new TestInput("<p style=\"voice-family: male\"> Voice Family </p>", "voice-family: male", true),
+                new TestInput("<p style=\"background-color: black\"> Background Color </p>", "background-color: black", true),
                 new TestInput("<div style=\"position:absolute\">", "position", false),
                 new TestInput("<style>b { position:absolute }</style>", "position", false),
                 new TestInput("<div style=\"z-index:25\">test</div>", "z-index", false),
diff --git a/src/test/java/org/apache/sling/xss/impl/XSSAPIImplTest.java b/src/test/java/org/apache/sling/xss/impl/XSSAPIImplTest.java
index b3a2576..0855416 100644
--- a/src/test/java/org/apache/sling/xss/impl/XSSAPIImplTest.java
+++ b/src/test/java/org/apache/sling/xss/impl/XSSAPIImplTest.java
@@ -679,6 +679,7 @@ public class XSSAPIImplTest {
             {"-moz-box-sizing"                  , "-moz-box-sizing"},
             {".42%"                             , ".42%"},
             {"#fff"                             , "#fff"},
+            {"right"                            , "right"},
 
             // valid strings
             {"'literal string'"                 , "'literal string'"},