使用 Spring MVC 框架清理用户输入 [英] Sanitizing user inputs with Spring MVC framework

查看:40
本文介绍了使用 Spring MVC 框架清理用户输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 spring mvc 框架开发 Web 应用程序,我想知道有没有最好的方法来清理用户输入或清理 spring 中的所有用户输入以避免 XSS 和 Sql 注入攻击的常用方法?

I am working on web application using spring mvc framework, I wanted to know is there any best way to sanitize user inputs or common method to sanitize all the user inputs in springs to avoid XSS and Sql Injection attacks?

推荐答案

您可以使用 Spring 框架中的 Filters 来清理表单.过滤器将获取您的所有请求属性并在处理请求之前清除它们.另一种选择是使用 JSoup API.访问以下链接了解更多信息.

You can use Filters in Spring framework to clean your forms. Filters will fetch all your request attributes and clean them all before processing the request. Another option is to use JSoup API's. visit following links to know more.

JSoup XSS Api 的

防止 XSS 威胁的过滤方法

阅读 OWASP 表格,了解如何避免 XSS 和 SQL 注入.

Read OWASP sheets to know how to avoid XSS and SQL injection.

OWASP - 防止 XSS

OWASP - 防止 SQL 注入

看看与 spring 3.1 集成的 HDIV,它对 XSS 具有开箱即用的支持、CSRF、数据完整性检查.

Take a look at HDIV which integrates with spring 3.1, it has out-of-the-box support for XSS, CSRF, Data Integrity Checks.

这篇关于使用 Spring MVC 框架清理用户输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆