再次保护jsp页面xss [英] protect jsp pages againt xss

查看:123
本文介绍了再次保护jsp页面xss的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想保护我的网站表单xss,我想确保我的所有数据都是正确和一致的,所以我不想允许向我的数据库添加任何脚本,这是因为我的数据可能被其他网络服务,所以我想确保我的数据是正确的,不会给别人带来任何问题。

i want to protect my website form xss, and i want to assure that all my data are correct and consistent, so i don't want to allow to add any scripts to my db, that's because my data may be used by other web services , so i want to be sure that my data is correct and will not cause any problems to others.

我想只在输入中进行验证数据,而不是输出,因此我将只进行一次验证,并且我将确保我的数据库中没有脚本。

I want to make validation only in the input of the data , not at the output, hence i will make the validation only once, and also i will be sure that no scripts exist in my db .

编辑:请查看我添加的最后一条评论。

EDIT: please check the last comment I added.

推荐答案

使用一些过滤器来清理HTTP请求数据。

Use some Filter to sanitize HTTP request data.

你可以选择jsoup,它非常方便:

You may go for jsoup, it is very handy:

String unsafe = "<p><a href='http://example.com/' onclick='stealCookies()'>Link</a></p>";
String safe = Jsoup.clean(unsafe, Whitelist.basic());
// now: <p><a href="http://example.com/" rel="nofollow">Link</a></p>

参考: http://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer

这篇关于再次保护jsp页面xss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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