NVJ
NVJ

Reputation: 39

Length hiding (by adding a random number of bytes to the responses) for preventing BREACH attack in spring MVC

Length hiding (by adding a random number of bytes to the responses) is one of the mitigations for a BREACH attack. How can we implement this in a spring application?

Upvotes: 0

Views: 382

Answers (1)

tisho
tisho

Reputation: 136

You can add a random number of bytes to the responses that your application sends out by using a Spring MVC interceptor.In the postHandle method, you can use the HttpServletResponse object to add a random number of bytes to the response body and set the Content-Length header to the correct value, taking into account the additional bytes that you have added. You can take a look at HandlerInterceptor

Upvotes: 0

Related Questions