Sfoglia il codice sorgente

task-4611 川北剩余高中危漏洞处理
漏洞修复

xiexh 9 mesi fa
parent
commit
8f182eed58

+ 3 - 2
ibps-provider-root/modules/provider-business/src/main/java/com/lc/ibps/filter/CORSFilter.java

@@ -98,7 +98,7 @@ public class CORSFilter implements Filter {
         // 有Origin头(可能是跨域)
         String currentDomain = httpRequest.getScheme() + "://" + httpRequest.getServerName();
 
-        if (requestDomain.equals(serverDomain)) {
+        if (requestDomain.equals(currentDomain)) {
             // 情况2:同源请求(协议+域名相同,端口不同也视为同源)
             filterChain.doFilter(httpRequest, response);
         } else if (bmd.contains(requestDomain)) {
@@ -111,7 +111,8 @@ public class CORSFilter implements Filter {
             filterChain.doFilter(httpRequest, response);
         } else {
             // 情况4:非法的跨域请求
-            log.warn("跨域请求被拒绝:origin{} → {}", origin, httpRequest.getRequestURI());
+            log.warn("跨域请求被拒绝:{} → {}", origin, httpRequest.getRequestURI());
+            log.warn("requestDomain:{} → serverDomain:{}->currentDomain:{}", requestDomain, httpRequest.getRequestURI(),currentDomain);
             response.setStatus(HttpServletResponse.SC_FORBIDDEN);//403
             response.getWriter().write("Cross-origin request not allowed");
         }