fix: use banners correctly

This commit is contained in:
Nanne Baars 2024-10-27 07:49:37 +01:00
parent cf5101a633
commit e5d5a370f9
No known key found for this signature in database
GPG Key ID: A6D6C06FE4EC14E7
6 changed files with 24 additions and 15 deletions

View File

@ -1,8 +1,6 @@
package org.owasp.webgoat.server; package org.owasp.webgoat.server;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration @Configuration
@ComponentScan("org.owasp.webgoat.server")
public class ParentConfig {} public class ParentConfig {}

View File

@ -29,22 +29,30 @@ import lombok.extern.slf4j.Slf4j;
import org.owasp.webgoat.container.WebGoat; import org.owasp.webgoat.container.WebGoat;
import org.owasp.webgoat.webwolf.WebWolf; import org.owasp.webgoat.webwolf.WebWolf;
import org.springframework.boot.Banner; import org.springframework.boot.Banner;
import org.springframework.boot.ResourceBanner;
import org.springframework.boot.WebApplicationType; import org.springframework.boot.WebApplicationType;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource;
@Slf4j @Slf4j
public class StartWebGoat { public class StartWebGoat {
public static void main(String[] args) { public static void main(String[] args) {
var parentBuilder = var parentBuilder =
new SpringApplicationBuilder() new SpringApplicationBuilder().parent(ParentConfig.class).web(WebApplicationType.NONE);
.parent(ParentConfig.class) parentBuilder
.web(WebApplicationType.NONE) .child(WebWolf.class)
.bannerMode(Banner.Mode.OFF); .banner(new ResourceBanner(new ClassPathResource("banner-webwolf.txt")))
parentBuilder.child(WebWolf.class).web(WebApplicationType.SERVLET).run(args); .web(WebApplicationType.SERVLET)
.run(args);
ApplicationContext webGoatContext = ApplicationContext webGoatContext =
parentBuilder.child(WebGoat.class).web(WebApplicationType.SERVLET).run(args); parentBuilder
.child(WebGoat.class)
.banner(new ResourceBanner(new ClassPathResource("banner-webgoat.txt")))
.web(WebApplicationType.SERVLET)
.run(args);
printStartUpMessage(webGoatContext); printStartUpMessage(webGoatContext);
} }

View File

@ -15,7 +15,6 @@ server.ssl.key-store-password=${WEBGOAT_KEYSTORE_PASSWORD:password}
server.ssl.key-alias=${WEBGOAT_KEY_ALIAS:goat} server.ssl.key-alias=${WEBGOAT_KEY_ALIAS:goat}
server.ssl.enabled=${WEBGOAT_SSLENABLED:false} server.ssl.enabled=${WEBGOAT_SSLENABLED:false}
spring.banner.location=classpath:banner.txt
spring.datasource.url=jdbc:hsqldb:file:${webgoat.server.directory}/webgoat spring.datasource.url=jdbc:hsqldb:file:${webgoat.server.directory}/webgoat
spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver
spring.jpa.open-in-view=false spring.jpa.open-in-view=false

View File

@ -0,0 +1,5 @@
__ __ _ ____ _
\ \ / /__| |__ / ___| ___ __ _| |_
\ \ /\ / / _ \ '_ \| | _ / _ \ / _` | __|
\ V V / __/ |_) | |_| | (_) | (_| | |_
\_/\_/ \___|_.__/ \____|\___/ \__,_|\__|

View File

@ -0,0 +1,5 @@
__ __ _ __ __ _ __
\ \ / /__| |_\ \ / /__ | |/ _|
\ \ /\ / / _ \ '_ \ \ /\ / / _ \| | |_
\ V V / __/ |_) \ V V / (_) | | _|
\_/\_/ \___|_.__/ \_/\_/ \___/|_|_|

View File

@ -1,6 +0,0 @@
__ __ _ _____ _
\ \ / / | | / ____| | |
\ \ /\ / / ___ | |__ | | __ ___ __ _ | |_
\ \/ \/ / / _ \ | '_ \ | | |_ | / _ \ / _' | | __|
\ /\ / | __/ | |_) | | |__| | | (_) | | (_| | | |_
\/ \/ \___| |_.__/ \_____| \___/ \__,_| \__|