From 23b0bb7453c0cbf049a314060d8bbc1929e7c273 Mon Sep 17 00:00:00 2001 From: lbw Date: Mon, 27 Dec 2021 11:28:12 +0800 Subject: [PATCH] =?UTF-8?q?:lock:=20Fixing=20security=20issues.=20close=20?= =?UTF-8?q?#3491=20=E5=85=B3=E9=97=ADswagger=E6=97=B6=EF=BC=8Cswagger?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2404=E4=BD=86=E6=98=AF/admin/v2/api-docs?= =?UTF-8?q?=E4=BB=8D=E8=83=BD=E8=8E=B7=E5=8F=96=E5=88=B0=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../swagger/config/GatewaySwaggerAutoConfiguration.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/GatewaySwaggerAutoConfiguration.java b/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/GatewaySwaggerAutoConfiguration.java index 0ce865cd7..eee6cdb71 100644 --- a/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/GatewaySwaggerAutoConfiguration.java +++ b/pigx-common/pigx-common-swagger/src/main/java/com/pig4cloud/pigx/common/swagger/config/GatewaySwaggerAutoConfiguration.java @@ -76,7 +76,9 @@ public class GatewaySwaggerAutoConfiguration { else { // 关闭时,返回404 return RouterFunctions - .route(RequestPredicates.GET("/swagger-ui/**").and(RequestPredicates.accept(MediaType.ALL)), + .route(RequestPredicates.GET("/*/v2/api-docs").and(RequestPredicates.accept(MediaType.ALL)), + serverRequest -> ServerResponse.notFound().build()) + .andRoute(RequestPredicates.GET("/swagger-ui/**").and(RequestPredicates.accept(MediaType.ALL)), serverRequest -> ServerResponse.notFound().build()) .andRoute(RequestPredicates.GET("/doc.html").and(RequestPredicates.accept(MediaType.ALL)), serverRequest -> ServerResponse.notFound().build());