During a penetration test one finding was the information disclosure of using a Tomcat webserver.
If a request with an invalid URL (e.g. http://localhost:8080/[test ) is executed the configured custom error pages are not used.
Instead the embedded Tomcats ErrorReportValve is used and presents a default Tomcat Error page.
It is possible to configure it to some extends using
server.error.whitelabel.enabled=false
server.error.include-stacktrace=never
But the default HTTP Status 400 page is always returned.
It is possible to create a custom ErrorReportValve and set the properties like errorCode.400 to create a custom page, but this configuration is not possible with an application.properties file.
(At least as far as I can see)
See an example project at https://github.com/patst/tomcat-errorvalve
Maybe it would be a good idea to expose the properties for configuration.
The ErrorReportValve is created at
|
private void customizeErrorReportValve(ErrorProperties error, ConfigurableTomcatWebServerFactory factory) { |
What do you think?
During a penetration test one finding was the information disclosure of using a Tomcat webserver.
If a request with an invalid URL (e.g. http://localhost:8080/[test ) is executed the configured custom error pages are not used.
Instead the embedded Tomcats
ErrorReportValveis used and presents a default Tomcat Error page.It is possible to configure it to some extends using
server.error.whitelabel.enabled=falseserver.error.include-stacktrace=neverBut the default
HTTP Status 400page is always returned.It is possible to create a custom
ErrorReportValveand set the properties likeerrorCode.400to create a custom page, but this configuration is not possible with anapplication.propertiesfile.(At least as far as I can see)
See an example project at https://github.com/patst/tomcat-errorvalve
Maybe it would be a good idea to expose the properties for configuration.
The
ErrorReportValveis created atspring-boot/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/embedded/TomcatWebServerFactoryCustomizer.java
Line 295 in 7671561
What do you think?