Fitrah M
Fitrah M

Reputation: 993

Spring MVC : How to Protect Application from CSRF and XSS

What is the best way to protect our Spring MVC application from CSRF and XSS.

Is there native Spring MVC support for this?

Upvotes: 4

Views: 4857

Answers (3)

iesen
iesen

Reputation: 65

You can use Spring Security 3.2.0.RELEASE and enable csrf support with this configuration

<http>
    <!-- ... -->
    <csrf />
</http>

Upvotes: 2

Liam
Liam

Reputation: 2837

In Spring:

Forms ( globally):

<context-param>
<param-name>defaultHtmlEscape</param-name>
<param-value>true</param-value>
</context-param>

Forms ( locally):

<spring:htmlEscape defaultHtmlEscape="true" />

Upvotes: 6

Related Questions