on-internet
← Community

Spring: How to add XSS protection to @RequestBody in a RESTful service?

Stack Overflow ·

I am trying to add custom XSS protection by creating a RequestWrapper extending HttpServletRequestWrapper in an XSS filter. The below code provides XSS protection to: 1. Request Params 2. Payload. public class XssRequestWrapper extends HttpServletRequestWrapper { XssRequestWrapper(HttpServletRequest request) { super(request); } @Override public String getQueryString() { /* Custom XSS logic */ } @Override public String getParameterMap() { /* Custom XSS logic */ } @Override public String getParameterValues() { /* Custom XSS logic */ } } But when I configure my REST Api with @RequestBody Annotati

Comments

Sign in or sign up to comment and upvote.

No comments yet.