forked from jianmu-dev/jianmu-ci-server
!1804 fix: 修复由于tomcat升级导致的webhook斜杠转义不识别问题
Merge pull request !1804 from 华丽的谎言/master
This commit is contained in:
commit
70be877e3a
|
|
@ -6,9 +6,13 @@ import io.swagger.v3.oas.annotations.enums.SecuritySchemeType;
|
|||
import io.swagger.v3.oas.annotations.info.Info;
|
||||
import io.swagger.v3.oas.annotations.info.License;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityScheme;
|
||||
import org.apache.tomcat.util.buf.EncodedSolidusHandling;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
|
||||
import org.springframework.boot.web.servlet.ServletComponentScan;
|
||||
import org.springframework.retry.annotation.EnableRetry;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
|
@ -16,12 +20,14 @@ import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
|
|||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.util.UrlPathHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Ethan Liu
|
||||
* @class SpringbootApp
|
||||
* @description 项目启动类
|
||||
* @author Ethan Liu
|
||||
* @create 2021-02-12 15:35
|
||||
*/
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = "dev.jianmu")
|
||||
@MapperScan("dev.jianmu.infrastructure.mapper")
|
||||
@EnableRetry
|
||||
|
|
@ -48,9 +54,8 @@ import org.springframework.web.util.UrlPathHelper;
|
|||
)
|
||||
)
|
||||
@ServletComponentScan
|
||||
public class SpringbootApp implements WebMvcConfigurer {
|
||||
public class SpringbootApp implements WebMvcConfigurer, WebServerFactoryCustomizer<TomcatServletWebServerFactory> {
|
||||
public static void main(String[] args) {
|
||||
System.setProperty("org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH", "true");
|
||||
SpringApplication.run(SpringbootApp.class, args);
|
||||
}
|
||||
|
||||
|
|
@ -60,4 +65,12 @@ public class SpringbootApp implements WebMvcConfigurer {
|
|||
urlPathHelper.setUrlDecode(false);
|
||||
configurer.setUrlPathHelper(urlPathHelper);
|
||||
}
|
||||
|
||||
// TODO: 此配置有安全隐患,未来产品需要考虑
|
||||
@Override
|
||||
public void customize(TomcatServletWebServerFactory factory) {
|
||||
TomcatConnectorCustomizer tomcatConnectorCustomizer =
|
||||
connector -> connector.setEncodedSolidusHandling(EncodedSolidusHandling.DECODE.getValue());
|
||||
factory.setTomcatConnectorCustomizers(List.of(tomcatConnectorCustomizer));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue