Class CQXSSUtils


  • public class CQXSSUtils
    extends org.apache.sling.testing.clients.util.XSSUtils
    Basic class for XSS Tests
    • Constructor Detail

      • CQXSSUtils

        public CQXSSUtils()
    • Method Detail

      • escapeXmlJSTL

        public static String escapeXmlJSTL​(String xmlString)
        Use to encapsulate escaping of XML with standard JSTL. This is the old method of escaping in CQ5 and is beeing replaced by ESAPI. See XSSUtils.escapeXml(String)
        Parameters:
        xmlString - string to escape
        Returns:
        the escaped string
      • replaceSpecialCharsForRegexp

        public static String replaceSpecialCharsForRegexp​(String regexp)
        Replaces special chars to avoid breaking the regexp
        Parameters:
        regexp - regular expression
        Returns:
        the sanitized regular expression
      • assertTitleTagIsNotVulnerable

        public static void assertTitleTagIsNotVulnerable​(org.apache.sling.testing.clients.SlingHttpResponse response,
                                                         String expectedTitle)
                                                  throws IOException
        Assert title output is sanitized in head
        Parameters:
        response - Sling response containing the page
        expectedTitle - expected title
        Throws:
        IOException - never