简体   繁体   中英

Prevent xss attack in Spring+Hibernate application

I have spring + hibernate application.

I have a lot of fields values of which I store in database. At this fields user can type anything.

These values can be rendered on client side. Thus this script can be executed.

Is there way to handle this problem in single place or I should handle each situation separately ?

Take a look at https://stackoverflow.com/a/2148120/4204904 Basically you have to set in your web.xml

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM