Package com.adobe.cq.testing.util
Class CQXSSUtils
java.lang.Object
org.apache.sling.testing.clients.util.XSSUtils
com.adobe.cq.testing.util.CQXSSUtils
public class CQXSSUtils
extends org.apache.sling.testing.clients.util.XSSUtils
Basic class for XSS Tests
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertTitleTagIsNotVulnerable(org.apache.sling.testing.clients.SlingHttpResponse response, String expectedTitle) Assert title output is sanitized in headstatic StringescapeXmlJSTL(String xmlString) Use to encapsulate escaping of XML with standard JSTL.static StringreplaceSpecialCharsForRegexp(String regexp) Replaces special chars to avoid breaking the regexpMethods inherited from class org.apache.sling.testing.clients.util.XSSUtils
encodeForHTML, encodeForHTMLAttr, encodeForJSString, encodeForXML, encodeForXMLAttr, encodeUrl, escapeHtml, escapeXml
-
Field Details
-
XSS_ATTACK_SIMPLE
- See Also:
-
XSS_ATTACK_JS_SIMPLE
- See Also:
-
XSS_ATTACK_JS_SIMPLE2
- See Also:
-
XSS_ATTACK_JS_CASE_INSENSITIVE
- See Also:
-
XSS_ATTACK_HERF_SIMPLE
- See Also:
-
-
Constructor Details
-
CQXSSUtils
public CQXSSUtils()
-
-
Method Details
-
escapeXmlJSTL
Use to encapsulate escaping of XML with standard JSTL. This is the old method of escaping in CQ5 and is beeing replaced by ESAPI. SeeXSSUtils.escapeXml(String)- Parameters:
xmlString- string to escape- Returns:
- the escaped string
-
replaceSpecialCharsForRegexp
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 pageexpectedTitle- expected title- Throws:
IOException- never
-