zoukankan      html  css  js  c++  java
  • springMVC简单的安全防御配置

    1,使用 spring form 标签

      防 csrf 攻击

    2,标明请求方法:RequestMethod.GET,RequestMethod.POST, PATCH, POST, PUT, and DELETE

      如果不标明,默认以上所有请求类型都会接受处理(面太广),给黑客留下伪造请求的隐患。

    3,防 XSS

    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">

    4)JSTL输出

    <c:out value="${formulario}" escapeXml="true" />默认escapeXml就为true

    ${fn:escapeXml(param.nextUrl)}
  • 相关阅读:
    lesson
    lesson
    课后习题-5
    lesson
    lesson
    lesson
    重启网络服务时 Bringing up interface eth0
    课后习题-4
    基础扩展
    课后习题-3
  • 原文地址:https://www.cnblogs.com/linkstar/p/5348182.html
Copyright © 2011-2022 走看看