Class XssRequestWrapper
java.lang.Object
jakarta.servlet.ServletRequestWrapper
jakarta.servlet.http.HttpServletRequestWrapper
org.broadleafcommerce.core.web.security.XssRequestWrapper
- All Implemented Interfaces:
jakarta.servlet.http.HttpServletRequest,jakarta.servlet.ServletRequest
public class XssRequestWrapper
extends jakarta.servlet.http.HttpServletRequestWrapper
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final org.springframework.core.env.Environmentprotected PatternFields inherited from interface jakarta.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH -
Constructor Summary
ConstructorsConstructorDescriptionXssRequestWrapper(jakarta.servlet.http.HttpServletRequest servletRequest, org.springframework.core.env.Environment environment, String[] whiteListParamNames) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancheckWhitelist(String parameter) protected StringcustomStripXss(String value) getParameter(String parameter) String[]getParameterValues(String parameter) protected Stringprotected StringWhencustomStripXssEnabledis false, it will run ESAPI's logic based on the esapiInputType.protected StringstripXssAsHTML(String value) protected StringstripXssWithESAPI(String value, String esapiInputType) Methods inherited from class jakarta.servlet.http.HttpServletRequestWrapper
authenticate, changeSessionId, getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getHttpServletMapping, getIntHeader, getMethod, getPart, getParts, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getTrailerFields, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isTrailerFieldsReady, isUserInRole, login, logout, newPushBuilder, upgradeMethods inherited from class jakarta.servlet.ServletRequestWrapper
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, isWrapperFor, isWrapperFor, removeAttribute, setAttribute, setCharacterEncoding, setRequest, startAsync, startAsyncMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.servlet.ServletRequest
getAsyncContext, getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentLengthLong, getContentType, getDispatcherType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getParameterMap, getParameterNames, getProtocol, getProtocolRequestId, getReader, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestId, getScheme, getServerName, getServerPort, getServletConnection, getServletContext, isAsyncStarted, isAsyncSupported, isSecure, removeAttribute, setAttribute, setCharacterEncoding, startAsync, startAsync
-
Field Details
-
environment
protected final org.springframework.core.env.Environment environment -
parameterPatter
-
customStripXssEnabled
@Value("${custom.strip.xss:false}") protected boolean customStripXssEnabled
-
-
Constructor Details
-
XssRequestWrapper
public XssRequestWrapper(jakarta.servlet.http.HttpServletRequest servletRequest, org.springframework.core.env.Environment environment, String[] whiteListParamNames)
-
-
Method Details
-
getParameterValues
- Specified by:
getParameterValuesin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterValuesin classjakarta.servlet.ServletRequestWrapper
-
checkWhitelist
-
getParameter
- Specified by:
getParameterin interfacejakarta.servlet.ServletRequest- Overrides:
getParameterin classjakarta.servlet.ServletRequestWrapper
-
stripXss
-
stripXss
WhencustomStripXssEnabledis false, it will run ESAPI's logic based on the esapiInputType. If esapiInputType is null or empty, it will runstripXssAsHTML(String).- Parameters:
value- - value to be strippedesapiInputType- - The name of the ESAPI validation rule defined in ESAPI validation configuration file.
-
customStripXss
-
stripXssWithESAPI
-
stripXssAsHTML
-