|
|
@@ -3,8 +3,10 @@ package jp.yamoto.farm.common.config;
|
|
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
|
+import jp.yamoto.farm.common.filter.PathTraversalFilter;
|
|
|
import jp.yamoto.farm.common.resolver.DecryptFieldArgumentResolver;
|
|
|
import jp.yamoto.farm.common.resolver.DecryptRequestBodyConverter;
|
|
|
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
|
@@ -63,4 +65,17 @@ public class WebConfig implements WebMvcConfigurer {
|
|
|
// converters.add(0, decryptConverter); // springdoc v3/api-docs return base64
|
|
|
converters.add(decryptConverter);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不正パスフィルタリング
|
|
|
+ * @return 結果
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public FilterRegistrationBean<PathTraversalFilter> pathTraversalFilter() {
|
|
|
+ FilterRegistrationBean<PathTraversalFilter> registration = new FilterRegistrationBean<>();
|
|
|
+ registration.setFilter(new PathTraversalFilter());
|
|
|
+ registration.addUrlPatterns("/*"); // すべてのURL
|
|
|
+ registration.setOrder(1); // 高優先度
|
|
|
+ return registration;
|
|
|
+ }
|
|
|
}
|