Application error message 这个漏洞


问题描述:

这个漏洞是因为前台参数传到后台的时候属性没有对应上导致

解决方案:

解决的方式有三种:

1.该后台对应的实体中需要有各自属性的set/get方法。

2.将这两个属性放置到try...catch...语句中就行了

3.如果还是不可以那就得前台代码对这两个属性进行验证,确保传递到后台参数的格式类型与后台的数据类型对的上。


这个问题还有其他情况就是需要对后台异常要跳转到一个页面,类是于500.html页面,下面是spring boot 通过写一个配置文件来对跳转页面的控制。


package com.qzt.config.cors;

import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.web.servlet.ErrorPage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class CorsConfig {

    //统一页码处理配置  
   @Bean  
  public EmbeddedServletContainerCustomizer containerCustomizer() {  
     return new EmbeddedServletContainerCustomizer() {  
            @Override  
           public void customize(ConfigurableEmbeddedServletContainer container) {  
                //ErrorPage error401Page = new ErrorPage(HttpStatus.UNAUTHORIZED, "/401.html");  
              // ErrorPage error404Page = new ErrorPage(HttpStatus.NOT_FOUND, "/Err404.html");  
               ErrorPage error500Page = new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/page/500.html"); 

               container.addErrorPages(error500Page);    

        }    

};  

   }

}



猜你喜欢

转载自blog.csdn.net/qq_32157851/article/details/80251801
今日推荐